Skip to main content
POST
Sell prepaid credit

Authorizations

Authorization
string
header
required

Use a Bouclay secret key (sk_test_..., sk_live_...) or restricted key (rk_test_..., rk_live_...).

A secret key can call every endpoint. A restricted key can only call the endpoints its scopes cover. A scope is {resource}:{access}, for example customers:read or refunds:write, and write includes read. GET requests need read access and everything else needs write, except POST /subscriptions/{id}/items/{item}/preview, which only needs subscriptions:read. A request outside the key's scopes gets 403 permission_denied naming the missing scope, and its Idempotency-Key is not used up.

Publishable keys (pk_...) are rejected by server-side API endpoints. A key's mode scopes what it can see and charge: a test key can never reach a live card.

Headers

Idempotency-Key
string
required

Required for POST and PATCH requests. Replays identical method + path + body requests and rejects mismatched re-use.

Required string length: 1 - 255

Path Parameters

customer
string
required

Body

application/json
priceId
string

A credit pack. Leave out amount, currency and creditAmount.

Example:

"price_123"

amount
number

What the customer pays, in major units of currency (before VAT added on top, for at_purchase when your prices exclude VAT). At least the minimum charge for the currency.

Example:

10000

currency
string

Defaults to the customer's.

Example:

"NGN"

creditAmount
number

The credit received, when more than amount. The difference is a bonus.

vatTiming
enum<string>

at_redemption: no VAT on the top-up, VAT on what the credit pays for. at_purchase: VAT on the top-up, and the credit is spent before tax.

Available options:
at_redemption,
at_purchase
taxCategory
enum<string>

A custom amount's tax category, which taxes an at_purchase top-up and decides the lines its credit may pay. Defaults to standard. A pack uses its product's; leave this out with priceId.

Available options:
standard,
zero_rated,
exempt
revenueCode
string

A custom amount's revenue code, kept on the top-up line. Leave out with priceId.

Maximum string length: 64
expiresAfterMonths
integer | null
Required range: 1 <= x <= 120
collectionMode
enum<string>
default:manual
Available options:
manual,
automatic
paymentMethod
string

A saved card for automatic collection.

customData
object | null

Kept on the prepaid lot.

Response

The top-up invoice and its lots.

data
object