Prerequisites
- An API key with the
customers:writescope. See Permissions. - The customer’s
customer_id, prefixedcust_. See Manage customers.
Steps
1
Create the session
Call
POST /v1/customers/{customer_id}/portal-sessions. There is no request body: what the customer can do in the portal comes from your portal settings, not from this call.2
Redirect the customer
Send the customer to The URL signs the customer in, so don’t log it or store it.
url and nothing else.3
React to what they do
The customer’s session is now theirs. Anything they change emits the same webhook as the equivalent API call:
customer.subscription.updated on a plan change or scheduled cancellation, customer.subscription.deleted on a cancellation, invoice.paid when a recovery payment succeeds.There is no redirect back to you unless you’ve set a return URL in your portal settings, and the customer may close the tab at any point. Treat webhooks as the only reliable signal that something changed.Errors
Next steps
- Customer portal covers what the portal does and how to configure what customers can change.
- Manage customers shows how to create and look up the
customer_idthis endpoint needs. - Webhooks explains how to receive the events a portal action emits.

