Skip to main content
GET
/
api
/
v1
/
operations
/
payment
/
customer-portal
curl -X GET "https://app.lance.so/api/v1/operations/payment/customer-portal" \
  -H "Authorization: Bearer <token>" \
  -L
HTTP/1.1 302 Found
Location: https://billing.stripe.com/p/session/test_abc123...
This endpoint creates a Stripe Customer Portal session and redirects the user to manage their subscription, payment methods, and billing history. The portal is hosted by Stripe and provides a secure, self-service interface for customers.

Authentication

This endpoint requires authentication. The user must be authenticated and associated with an organization that has a Stripe customer record.

Request

This endpoint does not require any request parameters. The organization is identified automatically from the authentication context.

Response

redirect
HTTP 302 Redirect
required
On success, this endpoint performs an HTTP 302 redirect to the Stripe Customer Portal URL. The browser will automatically navigate to the Stripe-hosted portal page.

Portal Features

The Stripe Customer Portal allows customers to:
FeatureDescription
Subscription ManagementView, upgrade, downgrade, or cancel subscriptions
Payment MethodsAdd, update, or remove payment methods
Billing HistoryView past invoices and payment history
Invoice DownloadDownload PDF invoices for accounting purposes

Return URL

After the user completes their actions in the Customer Portal, they are redirected back to:
https://{host}/organization#/plans
This ensures a seamless return to the organization settings page within the application.
curl -X GET "https://app.lance.so/api/v1/operations/payment/customer-portal" \
  -H "Authorization: Bearer <token>" \
  -L
HTTP/1.1 302 Found
Location: https://billing.stripe.com/p/session/test_abc123...

Error Codes

Status CodeError CodeDescription
401UNAUTHORIZEDUser is not authenticated
400VALIDATION_ERRORUser is not associated with an organization
404NOT_FOUNDOrganization does not have a Stripe customer record
500INTERNAL_ERRORServer error while creating portal session

Prerequisites

Before a user can access the Customer Portal, the organization must:
  1. Have a Stripe customer record - Created automatically when the organization first subscribes or purchases credits
  2. Be properly authenticated - User must be logged in via Clerk
  3. Be associated with an organization - User must be a member of an organization

Notes

  • This endpoint performs a redirect and does not return JSON on success
  • The Stripe Customer Portal session is valid for a limited time
  • All billing operations in the portal are handled securely by Stripe
  • Changes made in the portal (subscription updates, cancellations) are synchronized back to the application via Stripe webhooks