logoAccess

Create a portal session

POST
/api/v1/billing_portal/sessions

Creates a short-lived link to a customer's portal, where they can see and pay their invoices, update their billing information, and cancel subscriptions, as the configuration allows. Use flow_data to send them straight to one task.

Authorization

apiKeyHeader
headerx-api-key<token>

API key for authentication. Generate from the dashboard or via POST /v1/api-keys.

Header Parameters

x-api-key*string

API key for authentication

Length1 <= length

Request Body

  1. body
customer*string

The ID of an existing customer.

return_url?string

Where the portal's “Return to …” link goes. Defaults to the configuration's default_return_url.

Formaturi
Lengthlength <= 2048
flow_data?
locale?string
Lengthlength <= 10
expires_in?number

Seconds until the URL stops working. 300 to 86400.

Range300 <= value <= 86400
Default3600

Response Body

Response for status 200

application/json
  1. response
id*string
object*string
configuration*string
created*number

Unix seconds

expires_at*number

Unix seconds

customer*string
flow*unknown|null
livemode*boolean
locale*string|null
return_url*string|null
url*string

The short-lived portal URL. Send the customer here; it stops working at expires_at.

curl -X POST 'https://api.tryaccess.xyz/api/v1/billing_portal/sessions' \  -H 'x-api-key: string' \  -H 'Content-Type: application/json' \  -d '{  "customer": "cus_01J9Z8K2P3Q4R5S6T7U8V9W0X1"}'
{  "id": "bps_01J9Z8K2P3Q4R5S6T7U8V9W0X1",  "object": "billing_portal.session",  "configuration": "string",  "created": 0,  "expires_at": 0,  "customer": "string",  "flow": null,  "livemode": true,  "locale": "string",  "return_url": "string",  "url": "string"}

How is this guide?