Skip to content

Create checkout session

POST
/billing/checkout

Creates a checkout session for subscribing to the core usage-based plan. The checkout URL is valid for a limited time. Redirect the user to the returned URL to complete checkout.

Request body for creating a checkout session.

object
cancel_url
required

URL to redirect to if the customer cancels.

string
success_url
required

URL to redirect to on successful checkout.

string
Example
{
"cancel_url": "https://app.primatomic.com/billing?status=cancelled",
"success_url": "https://app.primatomic.com/billing?status=success"
}

Checkout session created

Response containing the checkout session URL.

object
session_id
required

The checkout session ID.

string
url
required

URL to redirect the customer to for completing checkout.

string
Example
{
"session_id": "cs_test_abc123",
"url": "https://checkout.stripe.com/c/pay/cs_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"
}