Hosted checkout for outlets
Hosted checkout lets a customer pay for one or more Villa orders on a Villa-hosted payment page.
A registered outlet can send the customer back to its own site after checkout. The outlet checks
GET /checkout/status/{sessionId}. The browser return is not proof of payment.
See the Checkout API and Return to the channel.
Availability as of 2 Dec 2026
- Current dev stack: Hosted checkout and outlet returns are enabled for testing. The older dev addresses do not have hosted checkout. See Base URLs.
- Production: Off. The owner decided on 2 Dec 2026 to keep hosted checkout on dev for now.
When production starts, the plan in PR #255 is
CheckoutMethods=card,amex: Thai QR and Apple Pay stay off at launch. Card and Thai QR use the shop's existing K Bank merchant and callback URLs. Addthai_qronly after one live Thai QR payment proves that the ID in K Bank's notification works for charge inquiry and identifies the checkout attempt (review blocker B2). A sandbox payment or the QR order ID is not that proof.
The planned production bridge uses the existing /callback, /notify and /thaiqr/notify endpoints.
It routes checkout charges to hosted checkout and leaves regular shop payments on their existing paths.
Checkout checks the charge with K Bank before recording it or handing orders off for fulfilment.
Do not register the checkout gateway routes as the merchant's callback URLs.
Price changes and late payments
- Price gaps. The cap is THB 20 per order and THB 20 across the entire session.
Add the absolute gaps. An increase on one order cannot cancel a decrease on another.
Even an accepted nonzero gap raises a
NeedsAttentionalert. If the price check exceeds the cap, the confirmed charge remains paid, but no order is sent for fulfilment. If an order's price moves beyond its reserved gap later, fulfilment of that order stops and staff are alerted. - Late payments. A verified payment can still fulfil eligible orders after a link expires.
Expiry frees the order for a replacement link. If another payment has already paid an order,
checkout keeps that payment and flags the duplicate as
already_paidandNeedsAttention. Checkout does not refund it automatically.
Reconcile a K Bank payment that did not reach checkout
Villa Payments on-call owns the match and any replay. Villa order operations decides whether the orders can still be fulfilled. Only authorized Finance staff issue refunds. Keep one reconciliation case per charge.
- Find the charge. Start with the K Bank settlement report for the right environment and time
window. Record the transaction reference, charge ID, status, currency, amount and time.
The Thai QR order ID (
qrOrderId) is not the charge ID. Use K Bank's merchant transaction detail or ask K Bank support for the charge ID. Checkout cannot discover an unknown QR charge by itself. - Verify and match. Use K Bank merchant inquiry to verify the successful charge, amount and
currency. For Thai QR, match the bank description
Checkout <sessionId> <attemptId>. For card, match the description<sessionId>and the<attemptId>suffix inreference_order. Read the original session and match the method, attempt, frozen amount in satang and each order's share. A notification shows delivery only. An amount, a timestamp or a replacement link does not prove ownership. - Check the orders. Inspect each order's payment record, any active fulfilment claim and the session's fulfilment and price-check results. If the same charge has already paid the order, do not fulfil or refund it again just because a notification was missed.
- Replay only a proven match. If the order is unpaid and order operations confirms that it can
still be fulfilled, on-call submits the original session and charge IDs to the IAM-only checkout
verifier (
action=verify,gateway=kbank_qrorkbank_charge,ref=<chargeId>). The verifier checks K Bank again. Check the resulting session, order payment record and fulfilment result. A session that readspaidconfirms the charge, not that fulfilment finished. Never mark the order paid by hand or bypass a blocked result. - Resolve duplicates or blocked orders. On-call and order operations check that no fulfilment is still in flight. Finance checks for prior refunds, then refunds the eligible amount against the original charge. Reconcile each share of a bulk payment and do not refund fulfilled shares. If the match is uncertain, hold both fulfilment and refund until K Bank confirms it. Record the decision and the fulfilment or refund reference in the case.