StatsHub Docs
APIEndpoint referenceStripe

/stripe/create-checkout-session

There are two paths.

POST
/api/stripe/create-checkout-session

There are two paths. A user who is already subscribed is sent to the billing portal's plan-change flow, because running them through checkout again would create a second subscription and bill them twice. Everyone else gets a normal checkout session, reusing their Stripe customer if they have lapsed and come back so their billing history stays on one customer.

Authorization

AuthorizationBearer <token>

Supabase access token.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/stripe/create-checkout-session" \  -H "Content-Type: application/json" \  -d '{    "priceId": "string"  }'
{  "url": "string"}