Skip to content

Handle callbacks

Choose Kustom Checkout callbacks for address, shipping and validation. Handle the ten-second validation deadline and configure fail-closed behavior.

Starting playground session…
  1. Order payload
  2. Create order
  3. Render and update
  4. Callbacks · optional
  5. Confirm order

On this page you'll

  • Decide which of the three in-session callbacks your integration actually needs
  • State whether your integration is fail open or fail closed, and why
  • Answer the validation callback with the response shape Kustom expects
Validation and other callbacks
0 calls

Kustom can call your server when the customer changes their address, selects shipping or submits a purchase. Register the callbacks your integration needs.

CallbackYou need it only if
address_updateTotals depend on the destination — shipping cost or tax that varies by address
shipping_option_updateThe customer picks a shipping option inside the checkout iframe, rather than on a page of yours
validationStock, an expiring price or a fraud check can invalidate the order between creation and purchase

If none of these conditions apply, you need none of these callbacks.

See Server-side callbacks for the address_update and shipping_option_update request and response formats.

Validation must answer within ten seconds. By default, Kustom treats a timeout as approval and redirects the customer to confirmation. This is fail-open behavior.

Set options.require_validate_callback_success: true to block the purchase on a timeout or any response other than a 2xx or a redirect. Use this fail-closed behavior when validation must succeed, such as a stock check, an expiring price or a required legal check.

Register merchant_urls.validation. Kustom POSTs the full order, including line items, addresses and amounts, while its status is still checkout_incomplete.

{
"merchant_urls": {
"validation": "https://shop.example/api/kustom/validate"
}
}

Reply within the ten-second window:

Your responseWhat happens
200The purchase proceeds
303 with a Location headerKustom sends the customer to that URL instead of confirmation — this is the rejection message the customer actually sees, so make the page explain why: out of stock, price changed, no longer available
Anything else, or no reply in timeFail open (the default): treated the same as 200. Fail closed (require_validate_callback_success: true): the customer gets a generic error and the purchase stops
FailureWhat happens
The handler takes longer than ten secondsFail open lets the purchase through. Fail closed shows the customer a generic error
The handler reads or updates the order through the API instead of reading the POST bodyYour own call can race the response you’re about to send — treat the callback body as the order, don’t refetch it
A response that is neither a 2xx nor a 3xx with LocationUnder fail open — the default — it is treated as an approval and the purchase completes, whatever the status was. It stops the purchase only with require_validate_callback_success: true. The exception either way is a 400 carrying error_type: address_error or approval_failed, which denies and shows the customer your error_text
The customer authenticates with 3D Secure before your answer landsYour 200 doesn’t by itself mean the purchase completed. Deny after that authentication and Kustom cancels the payment — refunding it if it had already been captured — so the reservation is released and you see no order

The docs’ validation endpoint always returns 200. To test failure handling in your integration, use an endpoint that returns 500 or doesn’t answer. Complete a Playground purchase and check that it proceeds or stops according to options.require_validate_callback_success.

Inspect requests and responses in the console above for the docs’ endpoint, or in Developer Logs for your own endpoint.

Next: Confirm the order.

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