Skip to main content
PATCH
/
v0
/
usage
/
{id}
Refund
curl --request PATCH \
  --url https://api.paygentic.io/v0/usage/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "refunded": true,
  "reason": "<string>"
}
'
{
  "id": "usg_t3u4v5w6x7y8z9a0",
  "object": "usageEvent",
  "billing": {
    "billingEventId": "bev_p1q2r3s4t5u6v7w8",
    "currency": "USD",
    "price": 6345000000000,
    "totalAmount": 6916050000000,
    "totalTax": 571050000000
  },
  "consumerId": "org_j9k0l1m2n3o4p5q6",
  "createdAt": "2024-05-20T14:45:35Z",
  "customerId": "cus_b1c2d3e4f5g6h7i8",
  "description": "Customer data warehouse storage allocation",
  "entitlementId": "com_z5a6b7c8d9e0f1g2",
  "idempotencyKey": "usg_2024_05_20_xyz789",
  "merchantId": "org_j9k0l1m2n3o4p5q6",
  "metadata": {
    "data_center": "eu-west-1",
    "encryption": "enabled",
    "storage_tier": "premium"
  },
  "properties": [
    {
      "billableMetricId": "bm_h3i4j5k6l7m8n9o0",
      "price": null,
      "quantity": 42.3
    }
  ],
  "refund": {
    "reason": "Customer request",
    "refundedAt": "2024-05-22T10:15:00Z"
  },
  "subscriptionId": "sub_r7s8t9u0v1w2x3y4",
  "timestamp": "2024-05-20T14:45:30Z"
}

Authorizations

Authorization
string
header
required

API key authentication

Path Parameters

id
string
required

Unique identifier for a usage event

Body

application/json
refunded
enum<boolean>
required

Set to true to mark the usage event as refunded. Once refunded, the event cannot be un-refunded.

Available options:
true,
false
reason
string

Optional reason for the refund. Sample values: 'Customer request', 'Billing error', 'Service credit', 'System error correction'

Response

Usage event refunded successfully

id
string

Unique identifier for a usage event

object
enum<string>
Available options:
usageEvent
billing
object

Billing information for the usage event when it has been billed. This object is populated by the server and returned in GET and PATCH responses. It cannot be set directly in request bodies.

consumerId
string
createdAt
string<date-time>
customerId
string
description
string

Readable summary explaining what triggered this consumption event. Sample values: 'Claude language model text generation', 'Customer data warehouse storage allocation', 'DALL-E image creation batch job', 'GPT-4 fine-tuning compute session', 'Vector database query operations'

entitlementId
string

Commitment identifier used for this consumption event. Sample values: 'com_abc123xyz', 'com_789def456'

idempotencyKey
string
merchantId
string
metadata
object
properties
object[]
refund
object

Refund information for the usage event when it has been refunded. This object is populated by the server and returned in GET and PATCH responses. It cannot be set directly in request bodies.

subscriptionId
string
timestamp
string<date-time>