POST
/
v1
/
c
/
customer
/
authenticate

Code Example

Refer to our Billing Portal Integration Guide for more information and code examples.

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:

  • View and update their billing information
  • Manage their payment methods
  • View their subscription details
  • Track their current usage
  • Upgrade or downgrade their plan
  • View their billing history and download invoices

Authorizations

wb-key
string
headerrequired

Body

application/json
email
string | null

Find Customer by Email

id
string

Unique identifier of an object. Consists of object class prefix and a UUID

reference
string | null

Find Customer by Reference

Response

201 - application/json

The response is of type string.