Create Checkout Session
Stripe Checkout
Create Checkout Session
Create a Stripe checkout session for subscription or one-time payment
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.Documentation Index
Fetch the complete documentation index at: https://devkit4ai.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Authentication
This endpoint requires end user authentication via HTTP Bearer Token with project scope.
Query Parameters
Use test mode credentials. Set to
false for production payments.Request Body
Stripe Price ID for the product or subscription (e.g.,
price_1ABC...)URL to redirect after successful payment. Include
{CHECKOUT_SESSION_ID} placeholder.URL to redirect if user cancels checkout
Checkout mode:
subscription or payment (one-time)Quantity of items (minimum: 1)
Additional metadata to attach to the checkout session
If
true, allows checkout even if user already has an active subscriptionResponse
Stripe Checkout Session ID
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:Price IDs
Get Price IDs from your Stripe Dashboard:- Navigate to Products > Pricing
- Click on a price to view its ID
Error Responses
| Status | Description |
|---|---|
400 | User already has active subscription (when allow_existing_subscription: false) |
401 | Unauthorized - Invalid or missing authentication |
404 | Project not found or Stripe not configured |
422 | Validation error - Invalid price_id or URLs |
Related Pages
Get My Subscription
Check user’s subscription status
Stripe Webhook
Handle checkout completion
Update Subscription
Change subscription plans
Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Query Parameters
Use test mode credentials
Body
application/json
Request to create a Stripe checkout session.
Minimum string length:
1Minimum string length:
1Minimum string length:
1Pattern:
^(subscription|payment)$Required range:
x >= 1If true, allows checkout even if user has active subscription

