Skip to main content
POST
Purchase credits

Authorizations

Authorization
string
header
required

JWT authentication token

Body

application/json
action
enum<string>
required

"estimate" to get pricing preview, "purchase" to buy

Available options:
estimate,
purchase
credits
number<double>
required

Number of credits to purchase (100-3000)

Required range: 100 <= x <= 3000
payment_method_id
string

Stripe Payment Method ID to charge (optional, defaults to customer default PM)

redirect_cancel_url
string

Optional cancel redirect for the hosted checkout.

redirect_success_url
string

Optional success redirect for the hosted checkout.

Response

Purchase initiated or completed

action
enum<string>
required

"estimate" for pricing preview, "redirect" for first purchase (Stripe Checkout), "charged" for direct charge

Available options:
estimate,
redirect,
charged
amount_cents
integer
required
amount_display
string
required
credits
number<double>
required
has_payment_method
boolean

Whether saved payment methods exist (only in estimate)

invoice_id
string

Stripe Invoice ID (only when action is "charged")

invoice_url
string

Stripe hosted invoice URL (only when action is "charged")

payment_methods
object[]

All saved payment methods (only in estimate)

session_id
string

Stripe Checkout Session ID (only when action is "redirect")

unit_price
number<double>

Price per credit in USD (e.g. 5.00)

url
string

Stripe Checkout URL (only when action is "redirect")