Skip to content

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.

You need a recurring_token from a completed order — see creating a customer token at checkout — and the merchant ID that created it. A token can’t be charged under a different MID.

POST /customer-token/v1/tokens/{customerToken}/order
Authorization: Basic <token>
Content-Type: application/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.

A successful response:

{
"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

Section titled “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 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.

StatusBodyMeaningRetry?
403PAYMENT_METHOD_FAILEDThe charge failedYes, with backoff, then ask the customer to update
400emptyThe token is cancelled, or recurring isn’t enabled on your accountNo
400BAD_VALUEA field in the request is invalid (named in error_messages) — including any shipping_address field left empty — or the token belongs to another merchant IDNot until you fix the request
404emptyNo such tokenNo
500emptyKustom faultOnly after checking the order wasn’t created

The error catalogue carries the coded errors with the causes behind each one.

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.

This page is also available as Markdown — append .md to its URL — and is indexed in llms.txt.