> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://doc.cheddar.biz/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://doc.cheddar.biz/_mcp/server.

# Create a checkout

POST https://api.cheddar.biz/v1/checkouts
Content-Type: application/json

Idempotent on `idempotencyKey` — a replay returns 200 with the existing checkout.

Reference: https://doc.cheddar.biz/api/api-reference/checkouts/create-a-checkout

## Authentication

- `x-api-key` header (required) — API Key authentication via header

## Servers

- `https://api.cheddar.biz/v1` (Production, default)
- `https://staging-api-aws.cheddar.biz/v1` (Staging)

## Request

### Body (application/json)

This endpoint expects an object.

- `items` (list of CheckoutsPostRequestBodyContentApplicationJsonSchemaItemsItems, required)
- `idempotencyKey` (string, required)
- `expiresInSeconds` (integer, optional)
- `successUrl` (string, optional)
- `cancelUrl` (string, optional)
- `metadata` (map from string to any, optional)

## Response

### 200

Existing checkout (idempotent replay)

- `id` (string, required)
- `organizationId` (string, required)
- `idempotencyKey` (string, required)
- `priceUsdSnapshot` (string, required) — Decimal string, 2dp
- `acceptedNetworksTokensSnapshot` (list of map from string to any, required)
- `matchToleranceBpsSnapshot` (integer, required)
- `refundGasPayerSnapshot` (enum, required)
  - Allowed values: `COMPANY`, `BUYER`
- `expiresAt` (datetime, required)
- `hostedUrl` (string, required) — Shareable checkout link
- `successUrl` (string, required, nullable)
- `cancelUrl` (string, required, nullable)
- `status` (enum, required)
  - Allowed values: `OPEN`, `SESSION_ACTIVE`, `PAID`, `OVERPAID`, `UNDERPAID_REFUNDED`, `EXPIRED`, `CANCELED`, `FLAGGED_PENDING_REVIEW`, `FLAGGED_PLATFORM_HELD`, `FLAGGED_AUTO_RETURNED`, `RISK_SCAN_PENDING`
- `metadata` (map from string to any, required, nullable)
- `lineItems` (list of CheckoutLineItemsItems, required)
- `createdAt` (datetime, required)
- `updatedAt` (datetime, required)

### 201

Created

- `id` (string, required)
- `organizationId` (string, required)
- `idempotencyKey` (string, required)
- `priceUsdSnapshot` (string, required) — Decimal string, 2dp
- `acceptedNetworksTokensSnapshot` (list of map from string to any, required)
- `matchToleranceBpsSnapshot` (integer, required)
- `refundGasPayerSnapshot` (enum, required)
  - Allowed values: `COMPANY`, `BUYER`
- `expiresAt` (datetime, required)
- `hostedUrl` (string, required) — Shareable checkout link
- `successUrl` (string, required, nullable)
- `cancelUrl` (string, required, nullable)
- `status` (enum, required)
  - Allowed values: `OPEN`, `SESSION_ACTIVE`, `PAID`, `OVERPAID`, `UNDERPAID_REFUNDED`, `EXPIRED`, `CANCELED`, `FLAGGED_PENDING_REVIEW`, `FLAGGED_PLATFORM_HELD`, `FLAGGED_AUTO_RETURNED`, `RISK_SCAN_PENDING`
- `metadata` (map from string to any, required, nullable)
- `lineItems` (list of CheckoutLineItemsItems, required)
- `createdAt` (datetime, required)
- `updatedAt` (datetime, required)

## Errors

### 400 Bad Request Error

Bad request

- `error` (string, required)

### 401 Unauthorized Error

Unauthorized — missing or invalid API key

- `error` (string, required)

### 403 Forbidden Error

Forbidden — the request IP address is not whitelisted

- `error` (string, required)

### 422 Unprocessable Entity Error

Unprocessable entity

- `error` (string, required)

## Types

### CheckoutsPostRequestBodyContentApplicationJsonSchemaItemsItems

- `sku` (string, required)
- `priceUsd` (string, required)
- `quantity` (integer, required)
- `name` (string, optional)
- `description` (string, optional)
- `imageUrl` (string, optional, nullable)
- `acceptedNetworksTokens` (list of CheckoutsPostRequestBodyContentApplicationJsonSchemaItemsItemsAcceptedNetworksTokensItems, optional)
- `productMetadata` (map from string to any, optional)

### CheckoutLineItemsItems

- `id` (string, required)
- `productId` (string, required)
- `quantity` (integer, required)
- `unitPriceUsdSnapshot` (string, required)
- `lineTotalUsdSnapshot` (string, required)
- `productSnapshot` (map from string to any, required)
- `sortOrder` (integer, required)

### CheckoutsPostRequestBodyContentApplicationJsonSchemaItemsItemsAcceptedNetworksTokensItems

- `chain` (string, required)
- `token` (string, required)

## Examples

### Example 1

**Request**

```json
{
  "items": [
    {
      "sku": "string",
      "priceUsd": "string",
      "quantity": 1
    }
  ],
  "idempotencyKey": "string"
}
```

**Response**

```json
{
  "id": "string",
  "organizationId": "string",
  "idempotencyKey": "string",
  "priceUsdSnapshot": "string",
  "acceptedNetworksTokensSnapshot": [
    {}
  ],
  "matchToleranceBpsSnapshot": 1,
  "refundGasPayerSnapshot": "COMPANY",
  "expiresAt": "2024-01-15T09:30:00Z",
  "hostedUrl": "string",
  "successUrl": "string",
  "cancelUrl": "string",
  "status": "OPEN",
  "metadata": {},
  "lineItems": [
    {
      "id": "string",
      "productId": "string",
      "quantity": 1,
      "unitPriceUsdSnapshot": "string",
      "lineTotalUsdSnapshot": "string",
      "productSnapshot": {},
      "sortOrder": 1
    }
  ],
  "createdAt": "2024-01-15T09:30:00Z",
  "updatedAt": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python
import requests

url = "https://api.cheddar.biz/v1/checkouts"

payload = {
    "items": [
        {
            "sku": "string",
            "priceUsd": "string",
            "quantity": 1
        }
    ],
    "idempotencyKey": "string"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.cheddar.biz/v1/checkouts';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"items":[{"sku":"string","priceUsd":"string","quantity":1}],"idempotencyKey":"string"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.cheddar.biz/v1/checkouts"

	payload := strings.NewReader("{\n  \"items\": [\n    {\n      \"sku\": \"string\",\n      \"priceUsd\": \"string\",\n      \"quantity\": 1\n    }\n  ],\n  \"idempotencyKey\": \"string\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.cheddar.biz/v1/checkouts")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"items\": [\n    {\n      \"sku\": \"string\",\n      \"priceUsd\": \"string\",\n      \"quantity\": 1\n    }\n  ],\n  \"idempotencyKey\": \"string\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.cheddar.biz/v1/checkouts")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"items\": [\n    {\n      \"sku\": \"string\",\n      \"priceUsd\": \"string\",\n      \"quantity\": 1\n    }\n  ],\n  \"idempotencyKey\": \"string\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.cheddar.biz/v1/checkouts', [
  'body' => '{
  "items": [
    {
      "sku": "string",
      "priceUsd": "string",
      "quantity": 1
    }
  ],
  "idempotencyKey": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.cheddar.biz/v1/checkouts");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"items\": [\n    {\n      \"sku\": \"string\",\n      \"priceUsd\": \"string\",\n      \"quantity\": 1\n    }\n  ],\n  \"idempotencyKey\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "items": [
    [
      "sku": "string",
      "priceUsd": "string",
      "quantity": 1
    ]
  ],
  "idempotencyKey": "string"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.cheddar.biz/v1/checkouts")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Example 2

**Request**

```json
{
  "items": [
    {
      "sku": "string",
      "priceUsd": "string",
      "quantity": 1
    }
  ],
  "idempotencyKey": "string"
}
```

**Response**

```json
{
  "id": "string",
  "organizationId": "string",
  "idempotencyKey": "string",
  "priceUsdSnapshot": "string",
  "acceptedNetworksTokensSnapshot": [
    {}
  ],
  "matchToleranceBpsSnapshot": 1,
  "refundGasPayerSnapshot": "COMPANY",
  "expiresAt": "2024-01-15T09:30:00Z",
  "hostedUrl": "string",
  "successUrl": "string",
  "cancelUrl": "string",
  "status": "OPEN",
  "metadata": {},
  "lineItems": [
    {
      "id": "string",
      "productId": "string",
      "quantity": 1,
      "unitPriceUsdSnapshot": "string",
      "lineTotalUsdSnapshot": "string",
      "productSnapshot": {},
      "sortOrder": 1
    }
  ],
  "createdAt": "2024-01-15T09:30:00Z",
  "updatedAt": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python
import requests

url = "https://api.cheddar.biz/v1/checkouts"

payload = {
    "items": [
        {
            "sku": "string",
            "priceUsd": "string",
            "quantity": 1
        }
    ],
    "idempotencyKey": "string"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.cheddar.biz/v1/checkouts';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"items":[{"sku":"string","priceUsd":"string","quantity":1}],"idempotencyKey":"string"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.cheddar.biz/v1/checkouts"

	payload := strings.NewReader("{\n  \"items\": [\n    {\n      \"sku\": \"string\",\n      \"priceUsd\": \"string\",\n      \"quantity\": 1\n    }\n  ],\n  \"idempotencyKey\": \"string\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.cheddar.biz/v1/checkouts")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"items\": [\n    {\n      \"sku\": \"string\",\n      \"priceUsd\": \"string\",\n      \"quantity\": 1\n    }\n  ],\n  \"idempotencyKey\": \"string\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.cheddar.biz/v1/checkouts")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"items\": [\n    {\n      \"sku\": \"string\",\n      \"priceUsd\": \"string\",\n      \"quantity\": 1\n    }\n  ],\n  \"idempotencyKey\": \"string\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.cheddar.biz/v1/checkouts', [
  'body' => '{
  "items": [
    {
      "sku": "string",
      "priceUsd": "string",
      "quantity": 1
    }
  ],
  "idempotencyKey": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.cheddar.biz/v1/checkouts");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"items\": [\n    {\n      \"sku\": \"string\",\n      \"priceUsd\": \"string\",\n      \"quantity\": 1\n    }\n  ],\n  \"idempotencyKey\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "items": [
    [
      "sku": "string",
      "priceUsd": "string",
      "quantity": 1
    ]
  ],
  "idempotencyKey": "string"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.cheddar.biz/v1/checkouts")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```