- Checkout
- Features
Saved payment methods
Read, display and disable saved payment methods using Kustom customer tokens. Check token status, masked card details, errors and cancellation behavior.
Read a customer token to check its status and display the saved payment method. Disable the token when the customer removes the method or cancels the subscription. Kustom stores the payment details; your system stores the token ID against the customer.
Before you start
Section titled “Before you start”- A customer token, created during a Checkout purchase flagged
recurring: true. Creating one requires a completed purchase. See Create a customer token. - Playground API credentials. See Authentication and environments.
- The token id you stored against the customer’s account in your own system. Kustom holds the payment details. You hold the mapping from customer to token.
Step by step
Section titled “Step by step”Read the token to find out what it represents
Section titled “Read the token to find out what it represents”GET /customer-token/v1/tokens/{customerToken}Content-Type: application/jsonA 200 returns the token’s status, its payment method type and, for a card, the details
a customer would recognize:
{ "payment_method_type": "CARD", "status": "ACTIVE", "card": { "brand": "visa", "expiry_date": "11/2031", "masked_number": "************4242" }}payment_method_type is one of CARD, INVOICE, DIRECT_DEBIT or WALLET. A card
token carries a card block, and a SEPA direct debit token a direct_debit block holding only
masked_number. For the others the type is all there is, and the blocks that don’t apply come
back null, so branch on payment_method_type rather than assuming a card object is present,
and allow for the type itself to be missing on a cancelled token. status is ACTIVE or
CANCELLED.
Show the saved method to the customer without re-collecting it
Section titled “Show the saved method to the customer without re-collecting it”Use masked_number, brand and expiry_date to display a saved card, such as “Visa ending
4242”. Only the last four digits are visible. The expiry uses month/year without a leading
zero, for example 3/2030. Kustom does not return the full payment credentials.
Check status before you offer the token as a payment option. A token that isn’t
ACTIVE should not be presented, and the customer should be sent through checkout again.
Handle the error response
Section titled “Handle the error response”Most failed reads carry no body, so branch on the status code:
| Status | Body | Means |
|---|---|---|
404 | empty | The token doesn’t exist or the id is wrong — usually a token that was never created because the purchase failed, or one your system stored against the wrong customer. |
400 | BAD_VALUE, Token do not belong to merchant | The token exists but was created under a different merchant ID. A token can only be read and charged by the MID that created it. |
Don’t wait for an error_code on a 404; there isn’t one.
Error handling conventions covers the error object where there is one.
Disable a token the customer no longer wants you to hold
Section titled “Disable a token the customer no longer wants you to hold”You disable a token by setting its status to CANCELLED:
PATCH /customer-token/v1/tokens/{customerToken}/statusContent-Type: application/json{ "status": "CANCELLED"}A success is 202 with an empty body. CANCELLED is the only status you can set, and it’s
final: a cancelled token can’t be made active again, and cancelling it a second time returns
400. A cancelled token stops working immediately for new orders. Orders already created against it are
unaffected and continue through capture and refund as normal.
Disable a token when the customer cancels a subscription, removes a saved card or asks you to stop holding their details. Don’t simply delete your own mapping row and leave the token active in Kustom.
Why a customer token outlives the order that created it
Section titled “Why a customer token outlives the order that created it”A token links the customer’s details and payment method to your merchant account. It remains active while used to create orders, with no fixed expiry schedule. Capturing or refunding the original order doesn’t disable it; cancel it explicitly when it’s no longer needed.
Tell customers that you’re creating a token and will use it for future orders. Obtain their agreement before storing the payment method.
Check that it works
Section titled “Check that it works”- Read a token you created in Playground and confirm
statusisACTIVEand the masked number matches the test card you used. - Read a token id that doesn’t exist and confirm you handle an empty
404without breaking the customer’s page. - Disable a token, read it again and confirm
statusisCANCELLEDand your reorder screen no longer offers it.
Related
Section titled “Related”- Order lines and tax — what Kustom validates on every order line.
- Capture an order — settle an order you created against a token.
- Error handling conventions — read the error object every Kustom API returns.
- Test data — sample cards and customers for creating a token in Playground.
- Refunds — give money back on an order placed with a token.
This page is also available as Markdown — append .md to its URL — and is indexed in llms.txt.