# Charge a customer token

Charge a stored customer token through the Customer Token API, with no checkout and no customer present, and tell declines worth retrying from permanent ones.

Use the Customer Token API for charges after the first purchase. Each charge creates an
order in Order Management without opening checkout or requiring the customer to be present.

## Before you start

You need a `recurring_token` from a completed order — see [creating a customer token at
checkout](/checkout/recurring/minting-a-token/) — and the merchant ID that created it. A
token can't be charged under a different MID.

## Step by step

### 1. Post the charge

```http
POST /customer-token/v1/tokens/{customerToken}/order
Authorization: Basic <token>
Content-Type: application/json
```

```json
{
  "merchant_reference1": "45aa52f387871e3a210645d4",
  "auto_capture": true,
  "purchase_currency": "EUR",
  "order_amount": 999,
  "order_tax_amount": 0,
  "order_lines": [
    {
      "type": "digital",
      "reference": "19-402",
      "name": "Streaming Service Monthly",
      "quantity": 1,
      "unit_price": 999,
      "tax_rate": 0,
      "total_amount": 999,
      "total_discount_amount": 0,
      "total_tax_amount": 0
    }
  ]
}
```

**`auto_capture` defaults to `false`.** Set it to `true` to capture the full amount when
the order is created. Otherwise, the charge remains authorized until you capture it
through Order Management in a single capture.

**Send a complete `shipping_address` or omit it to use the token's stored address.**
Kustom doesn't merge addresses. Include `given_name`, `family_name`, `email`,
`street_address`, `postal_code`, `city` and `country`. Missing or empty fields return
`400` `BAD_VALUE`, naming the first missing field, such as `Bad value: shipping_address.email`.

**Check that the token belongs to the customer you intend to charge.** The API can't
verify your customer-to-token mapping.

### 2. Read the result

A successful response:

```json
{
  "order_id": "a89ec121-1276-419d-882a-c343d58fd1bc",
  "fraud_status": "ACCEPTED",
  "authorized_payment_method": {
    "type": "card"
  }
}
```

A `200` always carries `fraud_status: ACCEPTED`. If you sent
`merchant_urls.confirmation`, the response echoes it as `redirect_url`.

Store the `order_id` with your charge record. Use it to find the order in Order Management.

### 3. Decide what a failure means before you retry

Branch on HTTP status first; many errors have no body. Use the table below to decide
whether to retry.

For `PAYMENT_METHOD_FAILED`, retry with backoff and keep the `correlation_id` for support.
Temporary card declines, such as insufficient funds, may recover. If failures continue,
ask the customer to update their payment method through a **new first purchase and a new
token**. The old token can't be repaired.

For an empty `400`, [read the token](/api/customer-tokens/read-token/) to distinguish a
cancelled token (`status: CANCELLED`) from missing recurring access on your account.
For an empty `500`, check the Kustom Portal for the order before charging again. The
outcome is unknown; don't ask the customer to resolve this server error.

## Troubleshooting

| Status | Body | Meaning | Retry? |
|---|---|---|---|
| `403` | `PAYMENT_METHOD_FAILED` | The charge failed | Yes, with backoff, then ask the customer to update |
| `400` | empty | The token is cancelled, or recurring isn't enabled on your account | No |
| `400` | `BAD_VALUE` | A field in the request is invalid (named in `error_messages`) — including any `shipping_address` field left empty — or the token belongs to another merchant ID | Not until you fix the request |
| `404` | empty | No such token | No |
| `500` | empty | Kustom fault | Only after checking the order wasn't created |

The [error catalogue](/api/errors/#errors-customer-token) carries the coded errors with the
causes behind each one.

## Check that it works

In Playground:

1. `POST` a charge against a token you created and confirm you get an `order_id` and `fraud_status: ACCEPTED`.
2. Confirm the resulting order appears in Order Management, captured if you sent `auto_capture: true`.
3. Charge an invalid token id and confirm your code handles the empty `404` without retrying.
4. Cancel a token, charge it and confirm the empty `400` stops your retries.

## Related

- [Capture an order](/order-management/capture/) — collecting charges made without `auto_capture`
- [Recurring and on-demand payments](/checkout/recurring/) — how the two halves fit together
- [Order management](/order-management/) — where every token charge lands
- [Checkout API reference](/api/checkout/) — the order schema in full
