# Quickstart

> Connect a provider, create an API key, and take your first sandbox payment.

This guide takes you from a new account to a paid sandbox checkout. You won't handle card data: the customer pays on a hosted page, and you get the result back.

> **Note**
>
> Prefer to let your AI assistant do it? Copy the prompt from [Build with AI](https://camelpayment.com/docs/ai.md).

## 1. Create an account

[Create an account](https://camelpayment.com/overview?mode=register) and a project. A project holds your connections, API keys, and payments. Everything in this guide happens in **sandbox**, where no real money moves.

## 2. Connect a provider

Open **Connections** in the dashboard and add a sandbox connection with your provider's test credentials, for example a Mercado Pago test access token or a Stripe test secret key. Camel checks the credentials, encrypts them, and never shows them again.

## 3. Create an API key

Open **Developers** and create an API key. The full key is shown only once, so copy it now. Sandbox keys start with `pay_test_`. Keep it on your server, for example in an environment variable:

**Terminal**

```bash
export CAMEL_API_KEY="pay_test_…"
```

## 4. Create a checkout

A checkout is a payment page for a list of items. Amounts are integers in the currency's smallest unit, so `425000` is ARS 4,250.00. The `Idempotency-Key` header makes the request safe to retry; use something unique to the order.

**cURL**

```bash
curl -X POST https://api.camelpayment.com/v1/checkouts \
  -H "Authorization: Bearer $CAMEL_API_KEY" \
  -H "Idempotency-Key: order-1524" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "name": "Desk lamp",
        "quantity": 2,
        "unit_amount": 425000
      }
    ],
    "currency": "ARS",
    "success_url": "https://shop.example.com/orders/1524/return",
    "cancel_url": "https://shop.example.com/orders/1524",
    "external_reference": "ORDER-1524",
    "metadata": {
      "order_id": "1524"
    }
  }'
```

**Node.js**

```javascript
const response = await fetch('https://api.camelpayment.com/v1/checkouts', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CAMEL_API_KEY}`,
    'Idempotency-Key': 'order-1524',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "items": [
      {
        "name": "Desk lamp",
        "quantity": 2,
        "unit_amount": 425000
      }
    ],
    "currency": "ARS",
    "success_url": "https://shop.example.com/orders/1524/return",
    "cancel_url": "https://shop.example.com/orders/1524",
    "external_reference": "ORDER-1524",
    "metadata": {
      "order_id": "1524"
    }
  })
});
const data = await response.json();
```

**Python**

```python
import os
import requests

response = requests.post(
    "https://api.camelpayment.com/v1/checkouts",
    headers={
        "Authorization": f"Bearer {os.environ['CAMEL_API_KEY']}",
        "Idempotency-Key": "order-1524",
    },
    json={
        "items": [
            {
                "name": "Desk lamp",
                "quantity": 2,
                "unit_amount": 425000
            }
        ],
        "currency": "ARS",
        "success_url": "https://shop.example.com/orders/1524/return",
        "cancel_url": "https://shop.example.com/orders/1524",
        "external_reference": "ORDER-1524",
        "metadata": {
            "order_id": "1524"
        }
    },
)
data = response.json()
```

The response includes a `checkout_url`:

**Response**

```json
{
  "id": "chk_01JBX9C3D4E5F6G7H8J9KMNPQR",
  "object": "checkout",
  "mode": "hosted",
  "provider": null,
  "connection_id": null,
  "provider_checkout_id": null,
  "amount": 850000,
  "currency": "ARS",
  "charge": null,
  "items": [
    {
      "name": "Desk lamp",
      "quantity": 2,
      "unit_amount": 425000
    }
  ],
  "status": "open",
  "provider_status": null,
  "checkout_url": "https://camelpayment.com/pay/chk_01JBX9C3D4E5F6G7H8J9KMNPQR",
  "success_url": "https://shop.example.com/orders/1524/return",
  "cancel_url": "https://shop.example.com/orders/1524",
  "external_reference": "ORDER-1524",
  "metadata": {
    "order_id": "1524"
  },
  "expires_at": "2026-11-13T15:04:05Z",
  "created_at": "2026-11-12T15:04:05Z",
  "updated_at": "2026-11-12T15:04:05Z"
}
```

## 5. Send the customer to pay

Redirect the customer to `checkout_url`. They pick a payment method and pay into your connected provider account. When they finish, Camel sends them back to your `success_url` with `checkout_id` and `payment` (`approved` or `pending`) added to the query string.

> **Warning**
>
> Anyone can open your `success_url`, so don't mark the order paid from the redirect alone. Confirm it with a webhook or by retrieving the checkout.

## 6. Confirm the payment

Retrieve the checkout. Its `status` becomes `completed` once the payment is approved:

**cURL**

```bash
curl https://api.camelpayment.com/v1/checkouts/chk_01JBX9C3D4E5F6G7H8J9KMNPQR \
  -H "Authorization: Bearer $CAMEL_API_KEY"
```

**Node.js**

```javascript
const response = await fetch('https://api.camelpayment.com/v1/checkouts/chk_01JBX9C3D4E5F6G7H8J9KMNPQR', {
  method: 'GET',
  headers: {
    Authorization: `Bearer ${process.env.CAMEL_API_KEY}`
  }
});
const data = await response.json();
```

**Python**

```python
import os
import requests

response = requests.get(
    "https://api.camelpayment.com/v1/checkouts/chk_01JBX9C3D4E5F6G7H8J9KMNPQR",
    headers={
        "Authorization": f"Bearer {os.environ['CAMEL_API_KEY']}",
    },
)
data = response.json()
```

In production, let Camel tell you instead: add an endpoint under **Webhooks** and listen for `checkout.completed`. See [Webhooks](https://camelpayment.com/docs/webhooks.md).

## Next steps

- [Verify webhook signatures](https://camelpayment.com/docs/webhooks.md) before you trust an event.
- [Create payments](https://camelpayment.com/docs/payments.md) directly if you tokenize cards on your own page.
- [Go live](https://camelpayment.com/docs/environments.md) with a production connection and a `pay_live_` key.
