# 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.

## Example

cURL:

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

## Authorizations

`x-api-key`stringheaderrequired

Your API key. [Authentication](https://staging.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 `20k`, `80k`, `400k`, `2m` |

## 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 | The request parameters are missing or malformed, or the URL is not a supported link for this endpoint. | Fix the parameter named in param (the message says how); for a link of the wrong kind, call the endpoint the message names. |

### 401

401 Unauthorized.

| Code | HTTP | Retry | Meaning | What to do |
| --- | --- | --- | --- | --- |
| `unauthorized` | 401 | No | The x-api-key header is missing, unknown or revoked (or, on the dashboard's routes, the session cookie is missing or expired). | Send a valid API key in the x-api-key header; without one, get a key at details.signup_url (AI agents: POST details.agent_signup_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 number of 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 | The Idempotency-Key was already used with a different request (another route, or another body). | Send a new Idempotency-Key for a different request; reuse a key only to retry the identical request. |

## Test mode

A test key gets a placeholder session (no Stripe call, nothing to pay).

operationId `billing.checkout.create`

---

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