OnePay Production Configuration
canonical term: OnePay hosted checkoutDoc Status: Production-only | House of Legends no longer supports the OnePay sandbox/test environment in active runtime configuration.
houseoflegends.vn. OnePay runtime keys are Cloudflare Worker secret bindings. Credential values must never be committed to git, added to examples, pasted in support tickets, or shown in screenshots.
Why This Matters
The booking flow now creates real guest payment attempts. Any sandbox URL orTEST merchant credential would send guests into the wrong payment environment and make payment reconciliation unreliable.
The Hono Worker fails closed when OnePay runtime configuration contains known sandbox URL signals such as mtf.onepay.vn. Credential names and values are supplied by Cloudflare Worker secret bindings, not source code.
Current Secret Check
Checked against Cloudflare with
wrangler secret list on 2026-06-03. Only secret names were inspected; credential values were not read, logged, copied, or committed.hol-hono Worker currently has every OnePay runtime key required by apps/hono/src/lib/onepay/env.ts.
| Secret name | Required | Used for |
|---|---|---|
ONEPAY_MERCHANT_ID | Yes | vpc_Merchant |
ONEPAY_ACCESS_CODE | Yes | vpc_AccessCode |
ONEPAY_HASH_CODE | Yes | vpc_SecureHash signing and response verification |
ONEPAY_PAYMENT_URL | Yes | Hosted checkout URL |
ONEPAY_QUERYDR_URL | Yes | QueryDR reconciliation endpoint |
ONEPAY_RETURN_URL | Yes | Default browser return URL |
ONEPAY_IPN_URL | Yes | Dynamic IPN callback URL / vpc_CallbackURL |
ONEPAY_VERSION | Yes | vpc_Version |
ONEPAY_CURRENCY | Yes | vpc_Currency |
ONEPAY_VPC_USER | Yes | QueryDR API username |
ONEPAY_VPC_PASSWORD | Yes | QueryDR API password |
Raw Folder Findings
The legacy raw OnePay PHP files were checked on 2026-06-03:| File | Finding |
|---|---|
ref/raw/ticket-booking/onepay/config.php | Reads OnePay values from PHP $_ENV; embedded fallback values are sandbox/test values only |
ref/raw/ticket-booking/onepay/config_backup.php | Same pattern as config.php; embedded fallback values are sandbox/test values only |
ref/raw/ticket-booking/onepay/create_payment.php | Builds checkout parameters from the config constants; does not define production credentials |
ref/raw/ticket-booking/onepay/helper.php | Signs and verifies OnePay payloads from config constants; does not define production credentials |
ref/raw/ticket-booking/onepay/query_dr.php | Queries OnePay from config constants; does not define production credentials |
Production Runtime Values
These values are not passwords, but production stores them as Worker secrets because the Hono runtime loads all OnePay payment settings through the same secret binding path.| Field | Runtime key | Value |
|---|---|---|
| Payment URL | ONEPAY_PAYMENT_URL | https://onepay.vn/paygate/vpcpay.op |
| QueryDR URL | ONEPAY_QUERYDR_URL | https://onepay.vn/msp/api/v1/vpc/invoices/queries |
| Return URL | ONEPAY_RETURN_URL | https://houseoflegends.vn/api/onepay/return |
| IPN URL | ONEPAY_IPN_URL | Production IPN URL configured in Cloudflare |
| Version | ONEPAY_VERSION | 2 |
| Currency | ONEPAY_CURRENCY | VND |
Required Credential Secrets
| Secret | Description |
|---|---|
ONEPAY_MERCHANT_ID | Production OnePay merchant identifier |
ONEPAY_ACCESS_CODE | Production OnePay API access code |
ONEPAY_HASH_CODE | HMAC-SHA256 secret key for SecureHash signing |
ONEPAY_VPC_USER | Production QueryDR API username |
ONEPAY_VPC_PASSWORD | Production QueryDR API password |
Manage Secrets
Checkout Request Rules
The hosted checkout start route isPOST /api/reservations/{id}/onepay/start. Hono builds the OnePay request; frontend code must not hand-compose OnePay URLs.
| OnePay field | Hono value | Rule implemented in code |
|---|---|---|
vpc_MerchTxnRef | HOL-{reservationId} | Maximum 40 characters; no timestamp suffix |
vpc_OrderInfo | Booking {reservationReference} | Maximum 34 characters; mirrors the legacy OnePay invoice format |
vpc_TicketNo | First valid non-loopback IPv4 from Cloudflare/proxy headers; fallback IPv4 only when unavailable | OnePay requires this field; production should supply the real customer IP through Cloudflare |
vpc_ReturnURL | /api/onepay/return | Required browser return URL; locale is inferred from OnePay’s returned vpc_Locale |
vpc_CallbackURL | ONEPAY_IPN_URL | Kept enabled for server-to-server IPN |
vpc_Amount | Reservation total multiplied by 100 | Required by OnePay even for VND |
vpc_CardList | Optional request body value | Use only OnePay-supported method codes |
vpc_SecureHash | Generated by Hono from sorted request parameters | Uses ONEPAY_HASH_CODE |
vpc_CardList values in the local OnePay integration reference include INTERNATIONAL, INTERCARD, DOMESTIC, VIETQR, QR, BNPL, and APPLEPAY. Omit cardList unless the product flow needs to force one payment group.
Troubleshooting OnePay Rejections
Use a fresh checkout URL
OnePay error URLs are immutable. If code was redeployed, start a new reservation checkout and inspect the new
order_info, merch_txn_ref, and create_time query values.Read the OnePay error name
INVALID_INVOICE usually points at invoice/order fields such as vpc_OrderInfo, duplicate invoice references, or merchant-account invoice rules. INVALID PARAMETER is broader and can include URL, currency, access-code, card-list, amount, or ticket-number problems.Confirm account consistency
Ask OnePay to confirm the production merchant ID, access code, hash code, currency, payment URL, QueryDR username, and QueryDR password all belong to the same technical account.
Check ticket number input
If OnePay returns
INVALID PARAMETER, confirm Cloudflare is forwarding a real customer IPv4 to Hono. vpc_TicketNo is required by OnePay and fallback values are only used to avoid blocking checkout before the redirect.Production Verification
Confirm Worker configuration
Verify the Hono Worker is deployed with production OnePay URLs and the five production OnePay secrets above.
Start a real checkout
Create a controlled reservation and confirm the hosted checkout redirects to
https://onepay.vn/paygate/vpcpay.op.Complete payment
Complete a real OnePay transaction using an operator-approved payment method and amount.
See Also
- Payment - How payments work in the booking system
- Payment step - The booking flow payment step
