# Create a customer token

What the customer's first purchase must do to produce a reusable customer token — flag the order as recurring, let the customer complete it and read the token off the completed order.

A customer token is a by-product of an ordinary purchase. You don't call an API to create
one — you flag the checkout order, let the customer complete it and read the token off the
finished order.

## Before you start

**Recurring must be enabled on your merchant account.** Contact Kustom merchant support.
Without it the create-order call is rejected outright — `400` with `error_code: BAD_VALUE`
naming the `recurring` field. Nothing is silently accepted.

You also need a working checkout integration — [create an
order](/checkout/integrate/create-order/) and [render the
snippet](/checkout/integrate/render-checkout-snippet/) — because this is that flow with
two extra fields.

Two constraints shape what the customer sees, and neither is reversible on an open order:

- **Flagging an order as recurring removes the financing payment methods.**
- **A token belongs to the merchant ID that created it.** You can't create a token under one MID and charge it under another.

## Step by step

### 1. Flag the order as recurring

Add `recurring` to the create-order call:

```json
{
  "recurring": true
}
```

The customer is told they are setting up a recurring payment by Kustom's own notice in the
checkout, which names your store. You don't supply that copy.

### 2. Read the token off the completed order

Once the customer completes the purchase, the order carries a `recurring_token`. Read the
order, store that token against your customer and treat it as a credential — it can
charge them, and nothing downstream can tell you it belongs to somebody else.

## Check that it works

In Playground:

1. Create an order with `recurring: true` and complete it with [test data](/basics/test-data/).
2. Confirm the checkout offers no financing methods — that's the flag taking effect, not a fault.
3. Read the completed order and confirm a `recurring_token` is present.
4. Confirm your own store holds that token against exactly one customer.

## Related

- [Charge a customer token](/checkout/recurring/charging-a-token/) — what to do with the token you just created
