Skip to main content
POST
Purchase credits

Authorizations

Authorization
string
header
required

API key authentication

Path Parameters

id
string
required
Pattern: ^crp_[a-zA-Z0-9]+$

Body

application/json
grantAmount
number
required

The number of credits to grant upon payment completion.

Must be a multiple of 1e-8
idempotencyKey
string
required

Caller-provided deduplication key. Retrying with the same key returns the existing invoice.

Required string length: 1 - 255
subscriptionId
string

The subscription to anchor the invoice to. Required to disambiguate when the pool's customer has more than one active subscription.

Pattern: ^sub_
effectiveAt
string<date-time>

When the grant becomes effective. Defaults to now.

expiresAt
string<date-time> | null

When the grant expires. If omitted, the grant does not expire.

successUrl
string<uri>

URL to redirect the customer to after successful payment.

cancelUrl
string<uri>

URL to redirect the customer to if payment is cancelled.

paymentExpiresAt
string<date-time>

When the payment session expires. If omitted, uses the default expiry.

Response

Grant purchase invoice created with payment session

object
enum<string>
default:grant_purchase
required
Available options:
grant_purchase
invoiceId
string
required

The invoice ID for this grant purchase.

Pattern: ^inv_
poolId
string
required

The pool that will receive the grant.

Pattern: ^crp_[a-zA-Z0-9]+$
grantAmount
number
required

The number of credits that will be granted on payment.

price
string
required

The price in decimal format (e.g., '5.00').

currency
string
required

The three-letter ISO 4217 currency code (e.g., 'usd').

paymentSessions
object[]
required

Payment session(s) for the customer to complete the purchase.