# Retrieve a checkout session

`GET https://api.anyshop.io/v1/checkout_sessions/{id}`

Its status: open, paid (with its order), expired or canceled. A session paid by bank debit stays open while the bank confirms it (expires_at moves up to 14 days out), then turns paid, with order.paid, when the money clears.

- Part of the [API reference](https://docs.anyshop.io/reference.md), [Checkout sessions](https://docs.anyshop.io/reference.md#checkout-sessions).
- Scope: `checkouts:read`.

## Path parameters

- `id` (string, required)

## Returns

The **checkout_session** object.

## Errors

| Status | error.type | When |
| --- | --- | --- |
| 400 | `invalid_request` | The request is not valid; `error.param` names the field |
| 401 | `authentication` | No API key, or it is not valid |
| 403 | `permission` | The key does not have the scope this needs, or the store is suspended (store_suspended) |
| 404 | `not_found` | Not found in the key's store and mode |
| 409 | `conflict` | Conflicts with the object's state (type conflict), or an Idempotency-Key reused for another request (type idempotency, code idempotency_key_reused) |
| 429 | `rate_limited` | Too many requests; see Retry-After |

## Example

curl:

```bash
curl https://api.anyshop.io/v1/checkout_sessions/id_example \
  -H "Authorization: Bearer $ANYSHOP_API_KEY"
```

Node:

```js
const response = await fetch("https://api.anyshop.io/v1/checkout_sessions/id_example", {
  headers: {
    Authorization: `Bearer ${process.env.ANYSHOP_API_KEY}`,
  },
});
const answer = await response.json();
```

Python:

```python
import os
import requests

response = requests.get(
    "https://api.anyshop.io/v1/checkout_sessions/id_example",
    headers={
        "Authorization": f"Bearer {os.environ['ANYSHOP_API_KEY']}",
    },
)
answer = response.json()
```

Answer (200):

```json
{
  "object": "checkout_session",
  "id": "",
  "livemode": true,
  "status": "open",
  "url": "",
  "expires_at": "2026-10-02T14:21:07.000Z",
  "amount": 0,
  "currency": "",
  "payment_method": null,
  "order": null,
  "success_url": "",
  "cancel_url": "",
  "metadata": {},
  "agreement": {
    "text": "I agree to the terms of sale and want my key right away.",
    "terms_url": "https://anyshop.io/buyer-terms",
    "version": 4,
    "collected_by": "seller_site"
  },
  "created_at": "2026-10-02T14:21:07.000Z"
}
```

Answer (400):

```json
{
  "error": {
    "type": "invalid_request",
    "code": "invalid_query",
    "message": "The request is not valid; `error.param` names the field",
    "param": null
  }
}
```

Answer (409):

```json
{
  "error": {
    "type": "conflict",
    "code": "conflict",
    "message": "Conflicts with the object's state (type conflict), or an Idempotency-Key reused for another request (type idempotency, code idempotency_key_reused)",
    "param": null
  }
}
```

The IDs and keys in these examples are made up. Every schema is in the OpenAPI document, https://api.anyshop.io/v1/openapi.json.
