- Checkout
- Features
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
Section titled “Before you start”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.
Step by step
Section titled “Step by step”1. Post the charge
Section titled “1. Post the charge”POST /customer-token/v1/tokens/{customerToken}/orderAuthorization: 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.
2. Read the result
Section titled “2. Read the result”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.
Troubleshooting
Section titled “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 carries the coded errors with the causes behind each one.
Check that it works
Section titled “Check that it works”In Playground:
POSTa charge against a token you created and confirm you get anorder_idandfraud_status: ACCEPTED.- Confirm the resulting order appears in Order Management, captured if you sent
auto_capture: true. - Charge an invalid token id and confirm your code handles the empty
404without retrying. - Cancel a token, charge it and confirm the empty
400stops your retries.
Related
Section titled “Related”- Capture an order — collecting charges made without
auto_capture - Recurring and on-demand payments — how the two halves fit together
- Order management — where every token charge lands
- Checkout API reference — the order schema in full
This page is also available as Markdown — append .md to its URL — and is indexed in llms.txt.