This endpoint generates an authentication token for a customer, given at least one identifier (customer ID, email, or customer reference). It returns a URL that you can provide to the customer so their browser can be redirected to the billing portal with a valid authentication token.
Always perform an authorization check on your backend first and never pre-generate the secret URL, as it would otherwise expire before the customer opens it.
In your customer dashboard, add a “Billing Portal” button or link. This should be connected to an internal endpoint in your backend. When your customer clicks the button, verify that their login session on your application is still valid. Then, call this endpoint, providing Wingback ID (or alternatively the customer email or reference). This will return a 201 text response if successful. Finally, redirect the customer to the URL returned by the authenticate endpoint using a 302 redirect (see example).Once there, your customer will have access to their billing portal, where they can: