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

# Create checkout session

`POST /api/v1/billing/checkout`

## Request

- Base URL: `https://api.cadencz.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.cadencz.com/api/v1/billing/checkout`
- Auth: HTTP bearer

Creates a Dodo Payments subscription checkout. There is no trial: the Free plan is what a customer tries the product on, and checkout charges immediately.

## Request body

- CheckoutRequest
  - `tier` string, nullable
  - `billing_period` 'monthly' | 'yearly'
  - `topup_credits` 100 | 500, nullable
  - `return_url` string, nullable
  - `cancel_url` string, nullable

## Response `200`

Successful Response

- CheckoutResponse: One response for every way a plan click can resolve. `checkout` opens Dodo's hosted session; `plan_change` carries Dodo's payment page for the switch when money is due (`checkout_url` set), or reports an already-applied zero-charge change (`checkout_url` empty); `resumed` means a scheduled cancellation was lifted and nothing else needed doing; `portal` sends the customer to Dodo's portal because the subscription needs its payment method fixed there (`on_hold`/`paused`), which no API call of ours can do for them.
  - `action` 'checkout' | 'plan_change' | 'unchanged' | 'resumed' | 'portal'
  - `attempt_id` string, nullable
  - `session_id` string, nullable
  - `checkout_url` string, nullable, required
  - `mode` 'test' | 'live', required
  - `client_secret` string, nullable
  - `payment_id` string, nullable
  - `publishable_key` string, nullable
  - `effective_at` 'immediately' | 'next_billing_date', nullable
  - `message` string, nullable

## Other responses

- `400`: The request payload is invalid.
- `401`: Missing or invalid Supabase bearer token.
- `422`: Validation Error
- `503`: Required infrastructure or provider config is unavailable.

---

[API](https://skmtc.dev/cadencz/apis/cadencz-api.md) · [All operations](https://skmtc.dev/cadencz/apis/cadencz-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cadencz/apis/cadencz-api/revisions/3392fe5e93db?raw)
