Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Create Checkout Session

POST
/api/v1/billing/checkout
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.

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
default: http://localhost:3000/dashboard?success=true
cancel_url
Cancel Url
string
default: http://localhost:3000/dashboard?canceled=true

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>
ValidationError
object
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": {}
}
]
}