> For the complete Lynkow documentation index in agent-friendly format, see [llms.txt](/llms.txt).

# Place an order

**Published**: 2026-11-30
**Category**: Commerce

## `POST /checkout`

**Place an order**

Places an order from the caller's active cart and closes the cart.

A guest sends `X-Lynkow-Cart-Token` and an `email`. When the site requires accounts, a
guest gets 403 `ACCOUNT_REQUIRED`.

A card payment returns `payment.checkoutUrl`. With `paymentFlow: 'embedded'` it returns
what mounts the payment form in your page instead. A retry with the same `paymentFlow`
while the payment is open returns the same response.

Fires the `order.placed` webhook and sends a confirmation email.

Errors (422): `TERMS_PAGE_NOT_CONFIGURED`, `TERMS_NOT_ACCEPTED`, `CART_EMPTY`,
`OUT_OF_STOCK`, `DELIVERY_COUNTRY_REQUIRED`, `MARKET_COUNTRY_NOT_SERVED`,
`PRODUCT_NOT_SOLD_IN_MARKET`, `SHIPPING_OPTION_INVALID`, `SHIPPING_UNAVAILABLE`,
`PICKUP_POINT_REQUIRED`, `PICKUP_POINT_INVALID`, `TOTAL_CHANGED`,
`DESTINATION_NOT_TAXABLE`, `TAX_RATE_UNAVAILABLE`, `CHECKOUT_TAX_DISABLED`,
`PAYMENT_METHOD_UNAVAILABLE`, `PAYMENT_FLOW_UNAVAILABLE`. A
refused checkout leaves the cart open. No cart returns 404 `CART_NOT_FOUND`, a completed cart 409
`CART_ALREADY_COMPLETED`, and a payment page that cannot open 503
`PAYMENT_CHECKOUT_UNAVAILABLE`.

> **Note:** Available only on sites with e-commerce enabled.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Lynkow-Cart-Token` | header | string | No | Guest cart secret returned when the cart was created. Omit for an authenticated customer checkout. |


### Request Body

Content-Type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `email` | string | No | Guest receipt email. Optional for an authenticated customer. |
| `contact` | object | No | Optional buyer contact snapshot for this order. |
| `address` | object | No | Optional delivery or collection address snapshot. |
| `paymentMethod` | "on_site" \| "cash_on_delivery" \| "click_and_collect" \| "card" | No | Payment method selected by the buyer. One of: on_site, cash_on_delivery, click_and_collect, card. Card requires online payment availability. |
| `paymentFlow` | "hosted" \| "embedded" | No | How a card order is paid: `hosted`, the default, returns `payment.checkoutUrl`; `embedded` returns what the in-page payment form needs. Ignored for other methods. |
| `fulfillmentMode` | "delivery" \| "pickup" | No | How the order is fulfilled: `delivery`, the default, or `pickup`, collected at the merchant's premises with no shipping charge. |
| `shippingOptionId` | string | No | A shipping option (prefixed `shp_`) from `GET /shipping-options` for the delivery country. Omit it to use the cart option. |
| `expectedTotalCents` | integer (0 to 9007199254740991) | No | The total shown to the buyer, in minor units. Any other total returns 422 `TOTAL_CHANGED`. Optional. |
| `acceptsTerms` | boolean | No | Must be `true`, else 422 `TERMS_NOT_ACCEPTED`. A site without a terms page refuses every request with 422 `TERMS_PAGE_NOT_CONFIGURED` |
| `locale` | string | No | Buyer language, never rejected. It becomes the order language when the cart has none, which sets the emails, terms and payment page. Unsupported email languages fall back to the base language (`pt-BR` to `pt`), then English. |
| `recaptchaToken` | string | No | Verification token when the site uses reCAPTCHA spam protection. For v3 checkout, mint it with the `checkout` action. |
| `_hp` | string | No | Spam-trap field that must remain empty when the site uses honeypot protection. |
| `_ts` | integer | No | Form-load Unix timestamp in milliseconds when the site uses honeypot protection. |


### Responses

| Status | Description |
| --- | --- |
| `201` | Successful response |
| `400` | Spam protection failed: the `_ts` timestamp is too old, or the verification token is missing or invalid. |
| `401` | Missing or invalid storefront publishable key |
| `402` | The site subscription does not currently permit this operation |
| `403` | The storefront key origin is not allowed, or a customer account is required by this storefront |
| `404` | Site, resource, or commerce feature not found |
| `409` | The cart has already been completed |
| `422` | Validation error |
| `429` | Rate limit exceeded, or the `_ts` timestamp is missing, malformed or too recent. |
| `503` | Hosted checkout initialization failed; the order is not paid, and a site that tracks stock cancels it |


> **Notes:** Limit: 10 per 15 minutes per site and client. A server placing orders
> for its buyers sends the server key and buyer IP to count each buyer.

### SDK

```typescript
import { createClient } from 'lynkow'

const lynkow = createClient({
  siteId: process.env.LYNKOW_SITE_ID!,
  publishableKey: process.env.LYNKOW_PK,
})

const result = await lynkow.checkout.placeOrder(input)
```

---