Skip to main content
POST
Create Checkout Session
Create a Stripe Checkout session to redirect users to Stripe’s hosted checkout page. Supports both subscription and one-time payment modes.

Authentication

This endpoint requires end user authentication via HTTP Bearer Token with project scope.

Query Parameters

boolean
default:"true"
Use test mode credentials. Set to false for production payments.

Request Body

string
required
Stripe Price ID for the product or subscription (e.g., price_1ABC...)
string
required
URL to redirect after successful payment. Include {CHECKOUT_SESSION_ID} placeholder.
string
required
URL to redirect if user cancels checkout
string
default:"subscription"
Checkout mode: subscription or payment (one-time)
integer
default:"1"
Quantity of items (minimum: 1)
object
Additional metadata to attach to the checkout session
boolean
default:"false"
If true, allows checkout even if user already has an active subscription

Response

string
Stripe Checkout Session ID
string
URL to redirect user to Stripe Checkout

Example Request

Example Response

Checkout Flow

Integration Example

Frontend (React)

Backend (Next.js API Route)

Existing Subscription Handling

By default, users with active subscriptions cannot start a new checkout:
Set allow_existing_subscription: true for upgrade/downgrade flows, or use the Update Subscription endpoint instead.

Price IDs

Get Price IDs from your Stripe Dashboard:
  1. Navigate to Products > Pricing
  2. Click on a price to view its ID
(((REPLACE_THIS_WITH_IMAGE: stripe-dashboard-price-id.png: Stripe Dashboard showing a product’s pricing section with Price ID visible)))

Error Responses

Get My Subscription

Check user’s subscription status

Stripe Webhook

Handle checkout completion

Update Subscription

Change subscription plans

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Query Parameters

test_mode
boolean
default:true

Use test mode credentials

Body

application/json

Request to create a Stripe checkout session.

price_id
string
required
Minimum string length: 1
success_url
string
required
Minimum string length: 1
cancel_url
string
required
Minimum string length: 1
mode
string
default:subscription
Pattern: ^(subscription|payment)$
quantity
integer
default:1
Required range: x >= 1
metadata
Metadata · object | null
allow_existing_subscription
boolean
default:false

If true, allows checkout even if user has active subscription

Response

Successful Response

Stripe checkout session response.

session_id
string
required
checkout_url
string
required