---
title: "Create Checkout"
method: POST
path: "/api/billing/checkout"
tags: ["billing"]
---

# Create Checkout

`POST /api/billing/checkout`

## Request

- Base URL: `https://api.halalterminal.com`
- URL: `https://api.halalterminal.com/api/billing/checkout`
- Auth: API key in header `X-API-Key`

Create a checkout session for a plan upgrade.

Requires the `X-API-Key` header — the calling key is the one that
will be upgraded. The returned URL should be opened in the user's
browser to complete payment.

**curl example**:
```bash
curl -X POST https://api.halalterminal.com/api/billing/checkout \
  -H "X-API-Key: ht_abc123def456" \
  -H "Content-Type: application/json" \
  -d '{"plan": "starter"}'
```

## Request body

- CheckoutRequest: Request body for creating a checkout session. Authentication is via the `X-API-Key` header. The `api_key` body field is retained for backwards compat with older clients; if provided it must match the header value, otherwise the request is rejected. New clients should send the key in the header only.
  - `api_key` string, nullable: Deprecated — set the `X-API-Key` header instead. If provided here it must match the header value.
  - `plan` string, required: Target plan name (starter, pro, or enterprise)

## Response `200`

Checkout session URL and ID

- CheckoutResponse: Response containing the checkout session URL.
  - `checkout_url` string, required: Hosted checkout page URL — open in the user's browser
  - `session_id` string, required: Checkout session identifier

## Other responses

- `400`: No price configured for the requested plan
- `401`: Missing or invalid API key
- `403`: Body api_key does not match X-API-Key header
- `404`: API key not found
- `422`: Validation Error
- `429`: Rate limit exceeded
- `503`: Payment processing is temporarily unavailable

---

[API](https://skmtc.dev/halalterminal/apis/halal-terminal-api.md) · [All operations](https://skmtc.dev/halalterminal/apis/halal-terminal-api/llms.txt) · [OpenAPI document](https://skmtc.dev/halalterminal/apis/halal-terminal-api/revisions/78768b250943?raw)
