POST /api/subscription/create-portal-session
Creates a Stripe Customer Portal session where users can manage their subscription, update payment methods, view invoices, and cancel their subscription. Only available for users with paid plans (BASIC or PRO).Authentication
This endpoint requires authentication. Include your access token in the request cookies.Response
URL to redirect the user to the Stripe Customer Portal
Success message
Example Request
Example Response
Customer Portal Features
The Stripe Customer Portal allows users to:- View current subscription details
- Update payment methods
- View billing history and download invoices
- Change subscription plan
- Cancel subscription
- Update billing information
Usage Flow
- Call this endpoint to create a portal session
- Redirect the user to the returned
url - User manages their subscription on Stripe’s hosted portal
- User is redirected back to your return URL
- Stripe webhooks update subscription changes automatically
Error Responses
Authentication required or token expired
User does not have a paid subscription
Stripe customer not found
Server or Stripe error occurred
The portal session URL is single-use and expires after the user leaves the portal or after a certain period of inactivity.