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

# Create a checkout

> Start a new payment session for an order

Create a checkout to generate a hosted payment page for your customer.

## Authentication

Send your store key in the header: `X-API-Key: sk_...`. See the [API overview](/api-reference/api-overview) for where to find it.

## Request body

* `orderId` (string, required): Your internal order identifier.
* `priceAmount` (string, required): Decimal amount, quoted in `priceCurrency`.
* `priceCurrency` (string, required): ISO 4217 currency (e.g., `USD`).
* `successRedirectUrl` (string, optional): Where to send the buyer after a successful payment.

## Example request

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl -X POST https://api.zenobank.io/api/v1/checkouts \
      -H "Content-Type: application/json" \
      -H "X-API-Key: sk_your_store_key" \
      -d '{
        "orderId": "order-12345",
        "priceAmount": "0.01",
        "priceCurrency": "USD",
        "successRedirectUrl": "https://example.com/success"
      }'
    ```
  </Tab>

  <Tab title="JavaScript">
    ```javascript theme={null}
    const response = await fetch('https://api.zenobank.io/api/v1/checkouts', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'X-API-Key': 'sk_your_store_key',
      },
      body: JSON.stringify({
        orderId: 'order-12345',
        priceAmount: '0.01',
        priceCurrency: 'USD',
        successRedirectUrl: 'https://example.com/success',
      }),
    });

    const checkout = await response.json();
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import requests

    response = requests.post(
        'https://api.zenobank.io/api/v1/checkouts',
        headers={
            'Content-Type': 'application/json',
            'X-API-Key': 'sk_your_store_key',
        },
        json={
            'orderId': 'order-12345',
            'priceAmount': '0.01',
            'priceCurrency': 'USD',
            'successRedirectUrl': 'https://example.com/success',
        },
    )

    checkout = response.json()
    ```
  </Tab>

  <Tab title="PHP">
    ```php theme={null}
    $ch = curl_init('https://api.zenobank.io/api/v1/checkouts');

    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POST => true,
        CURLOPT_HTTPHEADER => [
            'Content-Type: application/json',
            'X-API-Key: sk_your_store_key',
        ],
        CURLOPT_POSTFIELDS => json_encode([
            'orderId' => 'order-12345',
            'priceAmount' => '0.01',
            'priceCurrency' => 'USD',
            'successRedirectUrl' => 'https://example.com/success',
        ]),
    ]);

    $response = curl_exec($ch);
    $checkout = json_decode($response, true);
    ```
  </Tab>

  <Tab title="Go">
    ```go theme={null}
    payload := map[string]string{
        "orderId":            "order-12345",
        "priceAmount":        "0.01",
        "priceCurrency":      "USD",
        "successRedirectUrl": "https://example.com/success",
    }

    body, _ := json.Marshal(payload)

    req, _ := http.NewRequest("POST", "https://api.zenobank.io/api/v1/checkouts", bytes.NewBuffer(body))
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("X-API-Key", "sk_your_store_key")

    resp, _ := http.DefaultClient.Do(req)
    ```
  </Tab>

  <Tab title="Ruby">
    ```ruby theme={null}
    require 'net/http'
    require 'json'

    uri = URI('https://api.zenobank.io/api/v1/checkouts')

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

    request = Net::HTTP::Post.new(uri)
    request['Content-Type'] = 'application/json'
    request['X-API-Key'] = 'sk_your_store_key'
    request.body = {
      orderId: 'order-12345',
      priceAmount: '0.01',
      priceCurrency: 'USD',
      successRedirectUrl: 'https://example.com/success'
    }.to_json

    response = http.request(request)
    checkout = JSON.parse(response.body)
    ```
  </Tab>
</Tabs>

## Example response

```json theme={null}
{
  "id": "ch_l0k1o87yt6",
  "orderId": "order-12345",
  "priceCurrency": "USD",
  "priceAmount": "0.01",
  "status": "OPEN",
  "expiresAt": "2025-10-04T10:30:00Z",
  "checkoutUrl": "https://pay.zenobank.io/ch_l0k1o87yt6",
  "createdAt": "2025-10-04T10:00:00Z",
  "successRedirectUrl": "https://example.com/success"
}
```
