Skip to main content

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

string
required
URL to redirect the user to the Stripe Customer Portal
string
required
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

  1. Call this endpoint to create a portal session
  2. Redirect the user to the returned url
  3. User manages their subscription on Stripe’s hosted portal
  4. User is redirected back to your return URL
  5. Stripe webhooks update subscription changes automatically

Error Responses

error
Authentication required or token expired
error
User does not have a paid subscription
error
Stripe customer not found
error
Server or Stripe error occurred
This endpoint is only available for users with BASIC or PRO subscriptions. FREE plan users will receive a 403 Forbidden error.
The portal session URL is single-use and expires after the user leaves the portal or after a certain period of inactivity.