Testing a channel
1. Without any backend: the demo
Open the channel demo. Type your callback base and see whether it is
accepted, the exact return URL for success and failure, every hop for each gateway, and the code to send. Nothing
leaves the page.
2. The redirect, on the dev stack
Post a card payment with bypass_order=1. It needs no order, charges the amount you post on K Bank's sandbox,
and never marks any order paid.
| Field | Value |
|---|---|
callback | Your base, for example yourapp://payments |
bypass_order | 1 |
orderId, userId, basketId | Any text, for example TEST-001 |
grandTotal | For example 10.00 |
mid | The sandbox merchant id (the test pages below carry it) |
K Bank's script adds token.
Sandbox card: 5444 8801 1727 6129, any future expiry, any CVV, OTP 123456.
A page with the form ready is in the repository: debug/cardpayment-mock.html (npx serve debug/), and
subrepos/payment3-test-ui/index.html.
bypass_order is for the dev stackWhether production honours bypass_order is under review (pull request #199). Do not build a production flow on
it without the payments owner's go-ahead.
3. A real order, on the dev stack
- Create an order through your channel.
- Pay it with the sandbox card.
- Check, in this order: the customer is back on your screen; your server reports the order paid; the confirmation e-mail arrived.
- Repeat and fail 3-D Secure: you are back with
status=failureand the order stays unpaid. - Repeat, pass 3-D Secure and close the tab before the return page loads: the order should still turn paid, from K Bank's server notify. There is no set deadline; if it is still unpaid after a few minutes, report it with the order id.
4. The hosted checkout, on the dev stack
This needs the current dev stack: the public dev addresses reach an older one that has no hosted checkout
(Base URLs). After 3-D Secure the bank sends the browser to the older stack, which shows an
error page (gap 9); the payment is confirmed all the same. Open /checkout/return/{sessionId} yourself
to see the result (done this way with the sandbox card on 1 Dec 2026).
POST /checkout/sessionsfor your order and openurl.- Pay with the sandbox card, then again with the sandbox Thai QR on another order. Use a total that is not a whole number of baht at least once.
- Poll
GET /checkout/status/{sessionId}untilpaid. - Do not test American Express on dev until the dev wallet secret holds the MPGS TEST merchant.
- Apple Pay needs a real iPhone and the Stripe keys on that stack.
5. The channel return, on your own machine
The return to a registered channel is on on the current dev stack (two test channels paid through on 1 Dec 2026: Return to the channel). That stack has no public address yet (Base URLs), so the everyday test is still local. The browser test starts the checkout with stand-ins for the gateways, registers a channel, pays by card and follows the customer back:
npm ci && npx playwright install chromium
node functions/checkout/tests/e2e/checkout.e2e.mjs e2e-out # checks 12a to 12m are the channel
python3 channel-kit/channel.py validate --id hotel-x --label 'Hotel X shop' --return-base https://shop.hotelx.example
The last line checks your own id and return base against the checkout's rules, with no AWS call. More in Return to the channel.
6. The backend's own tests
None of these reach AWS or a gateway.
| What | Command |
|---|---|
| Return address rules | cd functions/callback && python -m pytest tests/test_payment_redirect.py --noconftest |
| K Bank, Amex, wallet callbacks and the checkout bridge | cd functions/callback && python -m pytest tests --noconftest --ignore=tests/test_query_index.py |
| Hosted checkout, with the channel registry | cd functions/checkout && python -m pytest tests |
| The channel kit | python -m pytest channel-kit/tests -q -p no:cacheprovider |
| Apple Pay | cd functions/stripe && python -m pytest tests |
Before production
Nothing reaches production without the payments owner's approval. Merging to master deploys.