Skip to main content
The useCustomerPortal hook creates Stripe customer portal sessions using your backend route. By default it calls POST /api/priceos/v1/customer-portal.
Setup first: see the React integration guide.

Usage

Parameters

string
Optional fallback customerId used when openCustomerPortal/createCustomerPortalSession are called without customerId.

Returns

(body?) => Promise<CreateCustomerPortalResponse>
Creates a portal session and returns { url }.
(body?) => Promise<CreateCustomerPortalResponse>
Creates a portal session, then redirects the browser to Stripe Customer Portal.

Body fields

string
Optional customer override. If omitted, the hook uses options.customerId or your backend identifyCustomer.
"payment_method_update"
Opens Stripe directly to payment-method management. Omit it for the billing portal homepage, which supports invoices and customer details but never subscription changes.

Example