Gaps and what is next
Status as of 2 Dec 2026. The current dev stack has outlet returns and signed site callbacks enabled for testing.
| # | Gap | Effect on a new channel | Where |
|---|---|---|---|
| 1 | Hosted checkout returns customers to registered outlets on the current dev stack only. Two test outlets paid and returned on 1 Dec 2026. See the test below | Outlet returns are not available in production | Channel registry (#231) |
| 2 | Direct Thai QR returns only to https://shop.villamarket.com | A channel that is not the shop cannot use the direct QR flow | functions/callback/qrcallback.py |
| 3 | The Villa-order Apple Pay route (/stripe/applepay) accepts Villa web origins only for its redirect. The separate site route uses its configured HTTPS origin | The Villa-order route falls back to https://villa.kitchen on dev and https://shop.villamarket.com in production for other origins or app schemes | Apple Pay |
| 4 | Direct Amex is routed by villaWalletBackend2 | villaPayment3 cannot choose the channel | functions/callback/amexcallback.py |
| 5 | The K Bank signed site callback covers card_charge only. It is live for https://site.villamarket.ai. Thai QR, WeChat, Alipay and Amex still send no signed site callback | Sites with their own orders get trusted production confirmation for direct K Bank cards only | Signed server callback |
| 6 | Multi-outlet hosted checkout is on in dev and off in production. The production plan uses the shop's existing K Bank merchant and callback bridge. One live Thai QR payment must prove the inquiry ID before enablement (B2) | New outlets cannot use production hosted checkout yet | Hosted checkout for outlets, PR #255 |
| 7 | callback is free text on each direct card request; the list of known channels (the registry of gap 1) is read by the hosted checkout only | For a direct card payment nothing stops a typo, and nothing tells staff which channel it came from | functions/cardtoken/app.py |
| 8 | A partner cannot start a hosted checkout by itself: a customer session needs a Villa sign-in, a staff link needs a Villa staff key | A partner shop is paid through links that Villa staff or a Villa service make. The Commerce API's partner stores use their own payment link, not this checkout | functions/checkout/app.py; partner-api branch feat/p-partner-stores |
| 9 | On dev, the public addresses (/api/payment3dev/* and /api/payment3devapi/* on villa.kitchen, shop.villamarket.com and dev.villamarket.net) reach an older dev stack, last deployed on 4 Oct 2026 and without the hosted checkout (/checkout/... answers 403 there), and K Bank's sandbox sends the customer back there after 3-D Secure. Measured on 1 Dec 2026 | A card payment started on the current dev stack's own address ends, in the browser, on the older stack's error page ("Card payment record not found"). A hosted checkout payment is still confirmed, because the checkout asks K Bank itself (page poll, and every 5 minutes): open /checkout/return/{sessionId} to go on. A direct card payment (/cardpayment) does not finish by itself: its result is recorded by the return handler, which the bank never reaches on that stack. In a test it can be finished by posting the bank's return (the form the browser carried to the older stack) to the current stack's own callback address | CloudFront origins of those paths; the return address held by K Bank's sandbox merchant |
| 10 | Stripe Apple Pay for sites with their own orders is enabled on current dev with test keys. Production is off pending end-to-end testing and an approved live change window | Use the site endpoint for tests only | Site Apple Pay, PR #259 merged, PR #258 off |
| 11 | The Villa shop takes live Apple Pay. Its Apple Pay button fix is pending | Live payment support does not mean the button issue is fixed | Apple Pay |
Hosted checkout return
Gap 1 is the one that matters most: the hosted checkout is the only place where K Bank, MPGS and Stripe all come
back to the same point (/checkout/return/{sessionId}), so it is the natural place to send the customer on to the
right channel.
On the current dev stack, switched on (1 Dec 2026): the channel registry (pull request #231). On 1 Dec 2026 two test channels (outlet-a, outlet-b, each with its own Villa-hosted return site) were registered there, one staff link was made for each, and both were paid with the K Bank sandbox card through 3-D Secure. After 3-D Secure the browser was on the older stack's error page (gap 9), so /checkout/return/{sessionId} was opened on the current stack by hand. From there it went by itself: the session's status was paid, the result page said "Taking you back to Test outlet A…" (or B) and moved to that outlet's own /thankyou?sessionId=…&status=success&state=paid, and the outlet's page read /checkout/status and showed "Payment confirmed".
- One SSM parameter per channel holds an id, a label and a return base.
sourceonPOST /checkout/sessions(orchannelonPOST /checkout/links) names the channel; the entry is copied into the session.- The result page shows "Return to label" and, once the payment is confirmed, continues to
{returnBase}/thankyou?sessionId=…&status=success|pending|failure&state=…. - The return base comes from the registry, never from the request, so no caller can turn the result page into an open redirect.
- The channel still confirms with
GET /checkout/status/{sessionId}.
How to use it: Return to the channel. How to give a new shop a channel in one step: Launch a shop.
Done on 1 Dec 2026: an independent review, the merge to dev, a deploy to the current dev stack (the one built from
dev; gap 9 is about an older one that the public addresses still reach), CheckoutChannelRegistry switched on
there, and two channels registered and paid through on K Bank's sandbox.
What is still open before a customer sees it:
- The bank's return must reach the current dev stack, so the customer comes back without anyone opening
/checkout/return/{sessionId}by hand (gap 9). - The public dev proxy paths need to reach the current dev stack. The current stack is reachable directly at its API Gateway address.
- Production stays off until a live Thai QR payment proves the inquiry ID (gap 6).
The registry does not close gaps 2, 3, 4 or 7: the direct flows return as before.