- Checkout
- Get started
Handle callbacks
Choose Kustom Checkout callbacks for address, shipping and validation. Handle the ten-second validation deadline and configure fail-closed behavior.
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
Kustom can call your server when the customer changes their address, selects shipping or submits a purchase. Register the callbacks your integration needs.
Do you need any callbacks?
Section titled “Do you need any callbacks?”| Callback | You need it only if |
|---|---|
address_update | Totals depend on the destination — shipping cost or tax that varies by address |
shipping_option_update | The customer picks a shipping option inside the checkout iframe, rather than on a page of yours |
validation | Stock, 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.
Fail open, or fail closed?
Section titled “Fail open, or fail closed?”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.
Answer the validation callback
Section titled “Answer the validation callback”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 response | What happens |
|---|---|
200 | The purchase proceeds |
303 with a Location header | Kustom 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 time | Fail 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 |
When it breaks
Section titled “When it breaks”| Failure | What happens |
|---|---|
| The handler takes longer than ten seconds | Fail 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 body | Your 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 Location | Under 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 lands | Your 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 |
Prove it
Section titled “Prove it”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.
Related
Section titled “Related”- Server-side callbacks — every callback’s payload, response shape and the push retry schedule.
- Checkout URLs and callbacks — where
validationand the other callback URLs are registered. - Confirm the order — what happens once the purchase Kustom allowed actually completes.
This page is also available as Markdown — append .md to its URL — and is indexed in llms.txt.