Leave Localhost logoLeave LocalhostDocs
Billing

Customer Portal

The customer portal lets users manage their billing details (update payment method, view invoices, cancel subscription) through the payment provider's hosted UI.

The customer portal lets users manage their billing details (update payment method, view invoices, cancel subscription) through the payment provider's hosted UI.

How It Works

  1. User clicks "Manage Billing" in the app.
  2. Frontend calls the createCustomerPortal action.
  3. The billing adapter generates a portal session URL from the provider.
  4. The app redirects the user to the provider's portal.
  5. After changes, the user is redirected back to the app.

Access Control

The customer portal requires:

  • Permission: billing.manage (owner role by default)
  • Capability: billing.portal (granted by Pro plans)
  • Step-up verification: Level 1 (billing.openPortal) — a recently created session (within 30 minutes) is sufficient

If the user's plan does not include billing.portal, the portal button is not shown.

Provider Behavior

ProviderPortal Type
StripeStripe Customer Portal (hosted)
PolarPolar customer dashboard
Lemon SqueezyLemon Squeezy customer portal

Return URL

After the user finishes in the portal, they are redirected to the app's return URL. The return URL is configured via the SITE_URL environment variable.

Next Reads

On this page