POST /api/subscription/create-checkout
Creates a Stripe Checkout session to upgrade or subscribe to a paid plan (BASIC or PRO). Returns a session ID and URL to redirect the user to complete payment.Authentication
This endpoint requires authentication. Include your access token in the request cookies.Request Body
string
required
Plan to subscribe to. Options:
BASIC, PROstring
Promotional code for discounts (3-50 characters). Will be converted to uppercase
string
default:"monthly"
Billing period. Options:
monthly, annualResponse
string
required
Stripe Checkout session ID
string
required
URL to redirect the user to complete the checkout process
string
required
Success message
Example Request
Example Response
Usage Flow
- Call this endpoint to create a checkout session
- Redirect the user to the returned
url - User completes payment on Stripe’s hosted checkout page
- User is redirected back to your success URL
- Stripe webhook updates the subscription status
Error Responses
error
Authentication required or token expired
error
Invalid request parameters
error
User already has an active subscription to the requested plan
error
Server or Stripe error occurred
The checkout session expires after 24 hours. Users must complete payment within this timeframe.