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

> ## Agent Instructions
> Money is always a decimal string at the currency's precision (for example "29.00"), paired with an ISO 4217 currency field. Never use minor units.
> Build against the sandbox first: base URL https://sandbox-api.bachs.io with sk_sandbox_ keys. Production is https://api.bachs.io with sk_live_ keys; going live is a key swap.
> Treat webhooks (for example collection.succeeded) as the source of truth for fulfilment, never client-side events or redirects.
> Subscriptions are created by completing a checkout for a recurring product. There is no direct create-subscription endpoint.
> IDs carry resource prefixes (cust_, prod_, sub_, chk_, inv_, ref_) and timestamps are ISO 8601 UTC.

# Checkout API

> Create Checkout Sessions and redirect customers to hosted checkout.

Use Checkout Sessions for hosted checkout flows.

## Endpoint

```http theme={"dark"}
POST /v1/checkout-sessions
```

<CardGroup cols={2}>
  <Card title="API Reference" href="/api-reference/payments/create-checkout-session">
    Full request and response schema.
  </Card>

  <Card title="Checkout Sessions Guide" href="/guides/checkout/checkout-sessions">
    End-to-end integration walkthrough.
  </Card>
</CardGroup>

***

## Request example

```json theme={"dark"}
{
  "product_cart": [
    { "product_id": "prod_abc123", "quantity": 1 }
  ],
  "customer": {
    "email": "customer@example.com",
    "name": "Jane Doe"
  }
}
```

## Response example

```json theme={"dark"}
{
  "checkout_id": "chk_1M2N3o4P5q6R7s8T",
  "checkout_url": "https://checkout.bachs.io/c/Ht4qLp9NvZ3xKrB",
  "status": "open",
  "expires_at": "2026-01-24T15:30:00.000Z",
  "created_at": "2026-01-24T14:30:00.000Z"
}
```

***

## Flow

<Steps>
  <Step title="Create session">
    Create the session with products, customer context, and redirect URLs.
  </Step>

  <Step title="Redirect customer">
    Redirect to `checkout_url`.
  </Step>

  <Step title="Handle completion">
    Process webhook events. Recover missed events with a scheduled sweep, not by checking each charge on a timer.
  </Step>
</Steps>

<Info>
  Always treat webhooks as source of truth for final payment outcomes.
</Info>
