Skip to content

Create billing portal session

POST
/billing/portal

Creates a billing portal session. The portal allows customers to view usage, manage subscriptions, update payment methods, and view invoices. The portal URL is valid for a limited time. Redirect the user to the returned URL.

Request body for creating a billing portal session.

object
return_url

URL to redirect to after the customer exits the portal.

string | null
Example
{
"return_url": "https://app.primatomic.com/billing"
}

Portal session created

Response containing the billing portal URL.

object
url
required

URL to redirect the customer to for accessing the billing portal.

string
Example
{
"url": "https://billing.stripe.com/p/session/test_abc123"
}

Unauthorized

Billing not configured

Error response for billing operations.

object
error
required

Error message.

string
Example
{
"error": "Billing service not available"
}

Server error

Error response for billing operations.

object
error
required

Error message.

string
Example
{
"error": "Billing service not available"
}

Billing service unavailable

Error response for billing operations.

object
error
required

Error message.

string
Example
{
"error": "Billing service not available"
}