v1

latestOpenAPI 3.1.02026-08-042453938.9 KB
Charges

Get a charge

Retrieve details for a specific charge by ID.

get/v1/charges/{id}

Path parameters

idstring required

Charge ID

Response

Charge details

idstring

Unique charge identifier

customerIdstring

Customer ID

usageIdstring

Associated usage event ID

amountUsdcstring

Amount charged in USDC

amountTokenstring

Amount in token units (6 decimals)

txHashstring nullable

On-chain transaction hash when confirmed

blockNumberstring nullable

Block number when charge was confirmed

status'PENDING' | 'PENDING_SETTLEMENT' | 'CONFIRMED' | 'FAILED' | 'REFUNDED' | 'REFUND_PENDING'

Current charge status: PENDING (processing), PENDING_SETTLEMENT (in batch), CONFIRMED (settled), FAILED (error), REFUNDED (returned)

failureReasonstring nullable

Error message if charge failed

createdAtstring date-time

When the charge was created

confirmedAtstring date-time nullable

When the charge was confirmed on-chain

Example response

{
  "id": "chg_abc123def456",
  "customerId": "cus_abc123",
  "customer": {
    "id": "cus_abc123",
    "onchainAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f00000",
    "externalCustomerId": "user_123"
  },
  "usageId": "usg_xyz789",
  "usageEvent": {
    "id": "usg_xyz789",
    "type": "api_call",
    "quantity": "100",
    "metadata": {
      "endpoint": "/v1/chat",
      "model": "gpt-4"
    },
    "createdAt": "2024-01-15T10:30:00.000Z"
  },
  "amountUsdc": "0.100000",
  "amountToken": "100000",
  "txHash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
  "blockNumber": "12345678",
  "status": "CONFIRMED",
  "createdAt": "2024-01-15T10:30:00.000Z",
  "confirmedAt": "2024-01-15T10:30:05.000Z"
}