Sell prepaid credit
Sells a customer prepaid credit: a credit pack (priceId, a one-time
price on a product with kind: credit) or a custom amount. It
issues a top-up invoice (billingReason: credit_purchase) and the
lots it pays for, pending_payment until the invoice is paid. Manual
collection (the default) returns the invoice with its hostedUrl;
automatic collection charges paymentMethod, or the customer’s
default card. A voided top-up cancels its lots.
When VAT is charged comes from vatTiming, else the pack’s product,
else your team default; a purchase that resolves to none is refused.
at_redemption: the top-up carries no VAT and is numbered in its own-PP-sequence. The credit is spent after tax, like cash, and VAT is charged on what it pays for.at_purchase: the top-up is a normal tax invoice in your invoice sequence, taxed by the pack’s product’s tax category (ortaxCategoryfor a custom amount) with VAT included or added on top as your prices are. The lot holds what was bought before VAT and is spent before tax, only on lines with the same tax category and rate, so the usage it covers isn’t taxed again.
Expiry comes from expiresAfterMonths (send null for never), else
the pack’s product; it counts from payment. A bonus pack, or
creditAmount above amount, gives the extra as its own promotional
lot with no VAT, spent first and forfeited if the top-up is refunded
or charged back. A refund is capped at the credit not yet spent; for
at_purchase that is the unspent credit plus its VAT, which the
credit note reverses at the top-up’s rate.
Needs credits:write on a restricted key. Emits
credit_grant.created for each lot, then credit_grant.updated
when the invoice is paid.
Authorizations
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
Required for POST and PATCH requests. Replays identical method + path + body requests and rejects mismatched re-use.
1 - 255Path Parameters
Body
A credit pack. Leave out amount, currency and creditAmount.
"price_123"
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.
10000
Defaults to the customer's.
"NGN"
The credit received, when more than amount. The difference is a bonus.
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.
at_redemption, at_purchase 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.
standard, zero_rated, exempt A custom amount's revenue code, kept on the top-up line. Leave out with priceId.
641 <= x <= 120manual, automatic A saved card for automatic collection.
Kept on the prepaid lot.
Response
The top-up invoice and its lots.