Create a top-up checkout session
POST /api/billing/checkout/topup
Creates a Stripe Checkout session for a prepaid top-up and returns its URL, session ID, and amount in cents. The return URL must be HTTP(S) on an allowed dashboard host; amount/VAT checks return 422 and Stripe-session failures return 502.
Authenticate with a portal session token.
Request body
application/json object
amount_centsinteger requiredRange: 500 to 200000return_urlstring (uri) requiredLength: at most 2048 characters
Generated sample
{
"amount_cents": 500,
"return_url": "https://example.com"
}Responses
200 Stripe Checkout session created.
application/json object
amount_centsinteger requiredcheckout_urlstring (uri) requiredsession_idstring required
Generated sample
{
"amount_cents": 0,
"checkout_url": "https://example.com",
"session_id": "string"
}401 Missing or invalid bearer token.
application/json object
Any keys are accepted.
403 Authenticated caller lacks the required permission, ability, or role.
application/json object
Any keys are accepted.
409 The Idempotency-Key cannot be used for this request because it conflicts with another request (idempotency_key_conflict), is still in progress (idempotency_request_in_progress), or its response was not retained (idempotency_response_not_retained).
application/json IdempotencyError
errorobject requiredcodestring requiredOne of:"idempotency_key_conflict","idempotency_request_in_progress","idempotency_response_not_retained"messagestring requiredtypestring requiredValue:"idempotency_error"
422 Invalid amount/return URL or billing details are incomplete.
application/json GenericError
erroranyOne of
- string
- object
Any keys are accepted.
error_codestringcodestringmessagestringdetailstringstatusanyOne of
- string
- integer
errorsobjectAny keys are accepted.
429 The request was rate limited. API-generated responses are JSON;
Response headers
Retry-Afterstring headerSeconds to wait before retrying, when provided.
X-RateLimit-Scopestring headerIdentifies the scope of the request limit, when provided.
application/json GenericError
erroranyOne of
- string
- object
Any keys are accepted.
error_codestringcodestringmessagestringdetailstringstatusanyOne of
- string
- integer
errorsobjectAny keys are accepted.
text/html string
502 Checkout session creation failed.
application/json GenericError
erroranyOne of
- string
- object
Any keys are accepted.
error_codestringcodestringmessagestringdetailstringstatusanyOne of
- string
- integer
errorsobjectAny keys are accepted.