# Capture a checkout

> Complete a PayPal checkout after the customer approves it.

`POST https://api.camelpayment.com/v1/checkouts/{checkout_id}/capture`

Only PayPal checkouts need a capture; other providers return 422. The response is the resulting payment, and the checkout becomes completed once it is approved.

## Path parameters

- `checkout_id` (string, required): The checkout id, starting with chk_.

## Headers

- `Idempotency-Key` (string, required): A unique key for this operation, up to 255 characters. Retrying with the same key and body returns the original response. See Idempotency.

## Request

**cURL**

```bash
curl -X POST https://api.camelpayment.com/v1/checkouts/chk_01JBX9C3D4E5F6G7H8J9KMNPQR/capture \
  -H "Authorization: Bearer $CAMEL_API_KEY" \
  -H "Idempotency-Key: capture-1524"
```

**Node.js**

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

**Python**

```python
import os
import requests

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

## Response

**201**

```json
{
  "id": "pay_01JBX7Q2M4N8K5R6T9V3W1Y0ZA",
  "object": "payment",
  "provider": "paypal",
  "connection_id": "con_01JC4P2Q6R8S0T2V4W6X8Y0Z2A",
  "provider_payment_id": "3C679366HH908993F",
  "amount": 4999,
  "currency": "USD",
  "conversion": null,
  "usd_amount": 4999,
  "status": "approved",
  "provider_status": "COMPLETED",
  "description": "Order #1524",
  "external_reference": "ORDER-1524",
  "payment_method": {
    "type": "hosted_checkout"
  },
  "failure": null,
  "metadata": {},
  "next_action": null,
  "created_at": "2026-11-12T15:04:05Z",
  "updated_at": "2026-11-12T15:04:07Z"
}
```

## Errors

| Status | When |
| --- | --- |
| `202` | The provider did not give a definitive answer (a timeout, for example). The resource is returned with status unknown and Camel reconciles it. Do not create it again. |
| `401` | The API key is missing, malformed, or revoked. |
| `404` | No checkout with this id, or it has no provider checkout to capture. |
| `409` | The Idempotency-Key was used with a different body, or the first request is still running. |
| `422` | The checkout provider does not need a capture. |
| `429` | Too many requests. Wait for Retry-After seconds. |
| `502` | The provider returned an error. The body is still the resource, with status failed. |
