Card Payment UI Sample
A reference HTML sample for UI designers and UI developers to test the card payment flow, callback redirects, and integration with the Villa Payment API.
Quick Start
Option A: Open directly in browser
# From project root
open debug/cardpayment-mock.html
Option B: Serve locally (recommended for CORS)
npx serve debug/
# Open http://localhost:3000/cardpayment-mock.html
What the Sample Includes
| Section | Purpose |
|---|---|
| For Designers | Flow diagram, redirect URL format, test card numbers |
| For Developers | Parameter table, code snippets, links to full docs |
| Test Controls | Preset callback buttons, bypass_order checkbox, editable orderId/grandTotal |
Manual Test Steps
- Open
debug/cardpayment-mock.html(viaopenornpx serve debug/) - Set callback to e.g.
https://example.comoryourapp://payments - Leave bypass_order checked (skips order verification)
- Click Load KBank payment form
- Enter KBank test card (see Credit Card Payments)
- Complete 3DS if prompted
- Redirect target:
{callback}/thankyou?orderId=...&status=...&amount=...
Automated Integration Tests
Run the HTTP integration tests (POST to dev cardpayment API):
python -m pytest tests/cardtoken/test_cardpayment_http_integration.py -v
Tests cover:
- Basic success flow
- Callback parameter (app deep link)
- bypass_order parameter
- Callback + bypass_order combined
- Invalid token
- Missing orderId
Related Docs
- Credit Card Payments — Form fields, KBank script, endpoints
- Callback URL — App Integration — Redirect format, deep links, bypass_order