Credits & Payments
Customer Portal
Redirect to the Stripe Customer Portal for subscription and billing management
GET
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.
This ensures a seamless return to the organization settings page within the application.
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
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:| Feature | Description |
|---|---|
| Subscription Management | View, upgrade, downgrade, or cancel subscriptions |
| Payment Methods | Add, update, or remove payment methods |
| Billing History | View past invoices and payment history |
| Invoice Download | Download PDF invoices for accounting purposes |
Return URL
After the user completes their actions in the Customer Portal, they are redirected back to:Error Codes
| Status Code | Error Code | Description |
|---|---|---|
401 | UNAUTHORIZED | User is not authenticated |
400 | VALIDATION_ERROR | User is not associated with an organization |
404 | NOT_FOUND | Organization does not have a Stripe customer record |
500 | INTERNAL_ERROR | Server error while creating portal session |
Prerequisites
Before a user can access the Customer Portal, the organization must:- Have a Stripe customer record - Created automatically when the organization first subscribes or purchases credits
- Be properly authenticated - User must be logged in via Clerk
- 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