# POST /api/v1/onboarding/prepare-checkout

> Create Stripe Checkout session for onboarding

- **Tag:** onboarding
- **Operation ID:** `prepare_checkout`

## Description

Collects plan and add-on selections, creates a Stripe Checkout session with a 30-day free trial. Business is NOT created until /complete is called. Fully Managed (dz-managed) and Firm Enterprise start with a free pilot and are refused with 400 VALIDATION_912.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Request body

Schema: `PrepareCheckoutRequest`

- `account_type` (string · required) — 'self-managed', 'dz-managed', 'advisory-firm', or 'personal'. 'dz-managed' (Fully Managed) starts with a free pilot and is refused here with VALIDATION_912.
- `business_name` (string · required)
- `mailbox` (string)
- `personal_plan_tier` (string) — Personal Finance plan tier when account_type is 'personal' ('personal_core' or 'personal_plus', defaults to 'personal_core').
- `monthly_income_target_cents` (integer) — Optional monthly take-home income target in cents for personal finance workspaces.
- `default_currency` (string) — Default business currency. Supported out of the box: USD, CAD, AUD, EUR, GBP.
- `tax_year_end_month` (integer)
- `selected_addons` (array · string) — Optional list of addon slugs to include on the Stripe Checkout. Capped at 50 entries.
- `trial_agreed` (boolean · required) — User has agreed to the 30-day free trial terms
- `billing_interval` (string) (one of: month, year) — Billing cadence for the subscription. 'year' resolves the discounted annual catalog prices; defaults to 'month'.
- `hidden_nav_ids` (array · string) — Optional nav catalog ids to hide on initial workspace creation (e.g. 'workspace:inventory', 'books-section:Projects & Time').
- `nav_focus_preset` (string) — Optional focus preset chosen during onboarding: essentials, services, ecommerce, saas_b2b, full, or custom.
- `nav_focus_summary` (string) — Optional short description of the chosen workspace focus.
- `firm_name` (string)
- `firm_plan_tier` (string) — Graduated firm plan tier (defaults to firm_starter). firm_enterprise starts with a free pilot and is refused here with VALIDATION_912.
- `ein` (string)
- `logo_url` (string) — Either the S3 key returned by /onboarding/upload-url (onboarding/{user_id}/{uuid}.{ext}) or a public https URL.
- `address` (string)
- `num_full_time_accountants` (integer)
- `num_part_time_accountants` (integer)
- `current_tools` (array · string)
- `referral_source` (string) — Self-reported acquisition channel: referral, accountant, search, social, ads, event, marketplace, other.
- `referred_by_email` (string) — Email of whoever referred this user. Free text — not resolved against existing accounts.
- `utm_source` (string)
- `utm_medium` (string)
- `utm_campaign` (string)
- `utm_term` (string)
- `utm_content` (string)
- `gclid` (string)
- `fbclid` (string)
- `li_fat_id` (string)
- `msclkid` (string)
- `ga_client_id` (string)
- `referral_code` (string)
- `promo_code` (string)
- `landing_page` (string)
- `referrer` (string)
- `success_path` (string) — Optional path-only override (no host) to land on after Stripe Checkout. Defaults to /onboarding/complete.
- `cancel_path` (string) — Optional path-only override (no host) for cancelled checkout. Defaults to /welcome.

## Responses

### 201 — Successful Response

Schema: `SuccessEnvelope_PrepareCheckoutResponse_`

- `success` (boolean)
- `message` (string)
- `code` (string)
- `data` (PrepareCheckoutResponse)

### 400 — Bad Request - Invalid input

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 409 — Conflict - Resource already exists or is in an incompatible state

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 422 — Validation Error

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 429 — Too Many Requests - Rate limit exceeded; back off and retry

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 503 — Service Unavailable

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/onboarding/prepare-checkout' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "account_type": "string",
  "business_name": "string",
  "trial_agreed": false
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/onboarding/prepare-checkout', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "account_type": "string",
  "business_name": "string",
  "trial_agreed": false
}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {'account_type': 'string',
 'business_name': 'string',
 'trial_agreed': False}

response = httpx.post("https://api.ondayzero.com/api/v1/onboarding/prepare-checkout", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/onboarding/prepare-checkout
- OpenAPI slice: https://www.ondayzero.com/docs/reference/onboarding/prepare-checkout/openapi.json
- Other endpoints in **onboarding**: https://www.ondayzero.com/docs/reference/onboarding (markdown bundle: https://www.ondayzero.com/docs/reference/onboarding.md, OpenAPI: https://www.ondayzero.com/docs/reference/onboarding/openapi.json)
- Endpoint catalog: https://www.ondayzero.com/docs/reference/index.md
