# Buy a credit pack

Opens a Stripe checkout page for one AI credit pack and answers its `checkoutUrl` for a person to open. `pack` is a `priceId` from `GET /v1/billing/catalog`; anything that is not a live credit pack is refused. The credits land on the ledger when the payment clears, never when this call returns. Needs the workspace's owner or admin seat.

Access class: `workspace:admin`.

## Endpoint

`POST /v1/billing/credits/purchase`

## Request body

Content type: `application/json`.

```json
{
  "body": {
    "pack": "string"
  },
  "params": {},
  "query": {}
}
```

## Responses

### 201

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "checkoutUrl": "string"
  }
}
```

### default

a refusal: `{"error": "<what a person needs to read>"}`. 401 no credential, 402 the plan does not include this, 403 the seat does not, 404 the thing does not exist or is not yours to see.

Content type: `application/json`.

```json
{
  "error": "string"
}
```
