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

# Create Embed Checkout

> Start an embeddable checkout session for a product.

Create a draft order and return a checkout URL for the embed modal (`Markt.open` / `data-markt-product-id` buttons).

Public CORS: `Access-Control-Allow-Origin: *`. Rate limit: **30 / 60s** → `429`.

<ParamField body="productId" type="string" required>
  Product CUID (`Product.id`).
</ParamField>

<ParamField body="variantId" type="string">
  Stable variant UUID when the product has variants.
</ParamField>

<ParamField body="quantity" default="1" type="number">
  Quantity from 1–99.
</ParamField>

<ParamField body="theme" default="auto" type="string">
  Embed theme: `auto`, `light`, or `dark`.
</ParamField>

<ParamField body="email" type="string">
  Prefill checkout email.
</ParamField>

<ParamField body="couponCode" type="string">
  Apply a coupon at checkout.
</ParamField>

<ParamField body="returnUrl" type="string">
  Parent page URL after paid / close.
</ParamField>

<ParamField body="affiliateCode" type="string">
  Affiliate / referral code.
</ParamField>

<ParamField body="metadata" type="object">
  String-valued metadata map.
</ParamField>

## Response

<ResponseField name="orderId" type="string" required>
  Draft order CUID.
</ResponseField>

<ResponseField name="url" type="string" required>
  Checkout URL including `?embed=1&theme=…`.
</ResponseField>

```json theme={null}
{
  "orderId": "clxxxxxxxxxxxxxxxxxxxx",
  "url": "https://joinmarkt.com/checkout/clxxx?embed=1&theme=auto"
}
```

## Errors

| Status | When                              |
| ------ | --------------------------------- |
| `400`  | Validation, hold, missing variant |
| `404`  | Unknown product or store          |
| `429`  | Rate limited                      |

```json theme={null}
{ "error": "Product not found" }
```

See also: [Embed SDK](/embed/overview).
