> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a checkout handler

> Creates a Stripe Checkout session for the authenticated tenant. **Required scope:** billing:write

Creates a Stripe Checkout session for the authenticated tenant.

**Required scope:** `billing:write`

### Request body

`CreateCheckoutRequest`

<ParamField body="cancel_url" type="string" required>
  URL to redirect to if the customer cancels
</ParamField>

<ParamField body="price_id" type="string" required>
  Stripe Price ID to subscribe to (e.g. `price_1Abc...`)
</ParamField>

<ParamField body="success_url" type="string" required>
  URL to redirect to after successful checkout
</ParamField>

### Response

`CreateCheckoutResponse`

<ResponseField name="checkout_url" type="string" required>
  Full Stripe Checkout URL to redirect the customer to
</ResponseField>

### Status codes

| Code  | Meaning                                            |
| ----- | -------------------------------------------------- |
| `200` | Checkout session created                           |
| `401` | Unauthorized — missing or invalid credentials      |
| `403` | Forbidden — the key/token lacks the required scope |
| `429` | Rate limited — see Retry-After / X-RateLimit-Reset |
| `503` | Billing not configured                             |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.nsr.stateset.com/api/v1/billing/checkout' \
    --header 'X-API-Key: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
    "cancel_url": "string",
    "price_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "success_url": "string"
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "checkout_url": "string"
  }
  ```
</ResponseExample>
