# Buy a credit pack (Stripe Checkout)

Billing

POST `/v1/billing/checkout`

Creates a Stripe Checkout session for a credit pack; open the returned url to pay. Credits are added when payment completes; GET /v1/billing/checkout/{id} follows it.

## Example

cURL:

```shell
curl -X POST 'https://socialtap.dev/v1/billing/checkout' \
  -H "x-api-key: $SOCIALTAP_API_KEY" \
  -H "content-type: application/json" \
  -d '{
  "pack": "1k"
}'
```

## Authorizations

`x-api-key`stringheaderrequired

Your API key. [Authentication](https://socialtap.dev/docs/authentication/index.md)

## Headers

| Name | Type | Description | Example |
| --- | --- | --- | --- |
| `idempotency-key` optional | `string` | On any POST: your unique key for the request (1–255 printable ASCII characters; a UUID is ideal), kept 24 hours. Retrying with the same key and body never repeats the work: the answer is the first request's result, in its current state. | — |

## Body

JSON. Fields marked nullable may be `null`; optional ones may be left out.

| Field | Type | Description |
| --- | --- | --- |
| `pack` | `string` | Pack ID.<br>One of `1k`, `30k`, `250k`, `2m`, `starter_topup`, `growth_topup`, `scale_topup` |

## Response

### 200

Checkout session

| Field | Type | Description |
| --- | --- | --- |
| `id?` | `string` |  |
| `url?` | `string` |  |

### 400

400 Bad Request.

| Code | HTTP | Retry | Meaning | What to do |
| --- | --- | --- | --- | --- |
| `invalid_input` | 400 | No | A parameter is missing or malformed, or the link is not one this endpoint takes. | Fix the parameter named in param as the message says. For a link of the wrong kind, call an endpoint listed in details.endpoints, when there is one. |

### 401

401 Unauthorized.

| Code | HTTP | Retry | Meaning | What to do |
| --- | --- | --- | --- | --- |
| `unauthorized` | 401 | No | The x-api-key header is missing, or its key is unknown or revoked. On the dashboard's routes: the session cookie is missing or expired. | Send a valid API key in the x-api-key header. No key yet? A person gets one at details.signup_url; an AI agent follows details.agent_auth_url. |

### 409

409 Conflict.

| Code | HTTP | Retry | Meaning | What to do |
| --- | --- | --- | --- | --- |
| `idempotency_key_in_progress` | 409 | Yes, later | A request with this Idempotency-Key is still running. | Retry after the seconds in the retry-after header to get that request's result. |

### 422

422 Unprocessable.

| Code | HTTP | Retry | Meaning | What to do |
| --- | --- | --- | --- | --- |
| `idempotency_key_reused` | 422 | No | This Idempotency-Key was already used for a different request (another route or body). Or it was used for this same request, which ran and returned a secret we no longer keep (details.reason answer_expired): running it again would create another. | Use a new Idempotency-Key for a different request, and reuse a key only to retry the identical request. With reason answer_expired, check what the first request created (GET /v1/api_keys, GET /v1/webhook_endpoints) before sending it again under a new key. |

operationId `billing.checkout.create`

---

[HTML version](https://socialtap.dev/docs/reference/billing/checkout-create/) · [Docs index for AI agents](https://socialtap.dev/llms.txt) · [All docs in one file](https://socialtap.dev/llms-full.txt)
