Skip to content
Sign in Create account

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_cents integer required
    Range: 500 to 200000
  • return_url string (uri) required
    Length: at most 2048 characters

Generated sample

{
  "amount_cents": 500,
  "return_url": "https://example.com"
}

Responses

200 Stripe Checkout session created.

application/json object

  • amount_cents integer required
  • checkout_url string (uri) required
  • session_id string 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

  • error object required
    • code string required
      One of: "idempotency_key_conflict", "idempotency_request_in_progress", "idempotency_response_not_retained"
    • message string required
    • type string required
      Value: "idempotency_error"
422 Invalid amount/return URL or billing details are incomplete.

application/json GenericError

  • error any

    One of

    • string
    • object

      Any keys are accepted.

  • error_code string
  • code string
  • message string
  • detail string
  • status any

    One of

    • string
    • integer
  • errors object

    Any keys are accepted.

429 The request was rate limited. API-generated responses are JSON;

Response headers

  • Retry-After string header

    Seconds to wait before retrying, when provided.

  • X-RateLimit-Scope string header

    Identifies the scope of the request limit, when provided.

application/json GenericError

  • error any

    One of

    • string
    • object

      Any keys are accepted.

  • error_code string
  • code string
  • message string
  • detail string
  • status any

    One of

    • string
    • integer
  • errors object

    Any keys are accepted.

text/html string

502 Checkout session creation failed.

application/json GenericError

  • error any

    One of

    • string
    • object

      Any keys are accepted.

  • error_code string
  • code string
  • message string
  • detail string
  • status any

    One of

    • string
    • integer
  • errors object

    Any keys are accepted.