Skip to content
Customer experiences

Design checkout that can recover

Checkout is a small state machine: validate the cart, place the order, then either redirect to hosted payment or show bank-transfer instructions.

Before checkout

Refresh the cart immediately before submission, load shipping and payment options, and validate the customer's delivery details in your own form.

Submit once

Generate one idempotency key for the attempt. If the network fails after submission, retry with that same key instead of creating a new order.

Request headerscopy
X-Storefront-Host: shop.example.com
X-Cart-Token: cart_secret
Idempotency-Key: order_2026_01_01_001

After checkout

Every payment goes through Cartly Checkout. Keep the returned sessionToken server-side (an HttpOnly cookie on your store) and show the checkout for it: it reads the session with paymentSession, starts an online payment with startPaymentSession, takes a bank-transfer report with submitBankTransferProof, and on the way back from the provider asks Cartly to verify with refreshPaymentSession. Amounts, methods and the gateway come from the session, never from your code. Always display the order number.