Create Checkout Session
POST
/api/v1/billing/checkout
const url = 'https://example.com/api/v1/billing/checkout';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"success_url":"http://localhost:3000/dashboard?success=true","cancel_url":"http://localhost:3000/dashboard?canceled=true"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/billing/checkout \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "success_url": "http://localhost:3000/dashboard?success=true", "cancel_url": "http://localhost:3000/dashboard?canceled=true" }'Create a Stripe Checkout session for subscription.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ” Media type application/json
CheckoutRequest
Checkout request.
NOTE: price_id is intentionally NOT a client-controlled field. A
malicious frontend could otherwise post the price_id of a cheaper
tier and check out for less than the subscription costs. The
price_id is resolved server-side from settings.stripe_price_id.
If you need per-tier price IDs in your own SaaS, extend the Settings
with stripe_price_id_pro, stripe_price_id_agency, etc., and
select among them server-side based on the authenticated user’s
plan, NOT from request input.
object
success_url
Success Url
string
cancel_url
Cancel Url
string
Responses
Section titled “ Responses ”Successful Response
Media type application/json
CheckoutResponse
object
url
required
Url
string
Example generated
{ "url": "example"}Validation Error
Media type application/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Example generated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}