1 KHQR & Bakong in a Nutshell
KHQR is Cambodia’s national, EMV-compatible merchant-presented QR standard, operated by the Bakong real-time payment platform. In 2023 it handled 601.3 million transactions worth KHR 311 trillion (≈ US$75.8 billion)—a 28 % YoY volume jump. Bakong itself processed 75.6 million transfers in H1 2024 (↑ 180 % YoY) on its blockchain-based core.
- Spec roots: KHQR inherits the global EMV QR fields (tags 00–63) plus Cambodia-specific extensions.
- Open API: NBC publishes REST endpoints for onboarding, credit-transfer and settlement.
- Cross-border reach: Live links with Malaysia, Japan, Korea and Alipay+ already let overseas wallets scan the same code.
2 Why Add Bitcoin?
Cambodians rank 17th worldwide for crypto adoption, driven by remittances and P2P transfers. Lightning brings millisecond settlement and sub-cent fees, while QR codes are already how locals pay—perfect habit fit.
- Lightning invoices are just bech32 blobs that wallets display as QR.
- The protocol is open; self-hosted nodes or SaaS bridges (Strike-style) can issue or read those invoices.
3 Inside a KHQR Code (for Devs)
| Tag | Meaning (MPM) | Typical KHQR value | Map to BTC flow |
| 00 | Payload format indicator | “01” | constant |
| 26 | Merchant bank/Bakong ID | e.g., “000005XXX” | destination KHR account |
| 52 | MCC | “5411” (grocery) | optional meta |
| 53 | Currency | “116” = KHR | rate lookup for sats |
| 54 | Transaction amount | “25000.00” | FX convert to sats |
| 62 | Additional data | bill ID, tips | LN memo / metadata |
Parse it with open-source Java/Kotlin libs: phannaly/emv-qr-code or mvallim/emv-qrcode.
4 Three Integration Blueprints
A. Custodial Bridge (Fast-to-Market)
- Decode KHQR ➜ extract amount+merchant ID.
- Quote BTC↔KHR; tack on margin & FX buffer.
- Generate dynamic Lightning invoice QR for the payer.
- On settle, custodial PSP auto-swaps sats to KHR and pushes a Bakong creditTransfer to the merchant via NBC API.
- Pro: No licensing burden on merchant.
- Con: Counter-party/FX risk sits with the bridge.
B. Self-Hosted Node + PSP Partner
You run a Lightning node + BTC/KHR liquidity.
- Node listens for invoice paid event ➜ executes an authorised KHR top-up through a partnered Bakong member bank.
- Works well for large retailers; needs a Payment Service Institution licence and robust AML stack.
C. Hybrid POS Terminal
Next-gen hardware can show one composite screen: tap-to-card or scan-to-Lightning; merchants never see BTC, they get KHR in the same Bakong settlement batch.
5 Step-by-Step Dev Recipe
- Parse QR: qr = emv.decode(raw)
- Validate tag 53 == “116”; reject unsupported currencies.
- FX Quote: Pull live BTC/KHR price (or use stablecoin hedge).
- Invoice: bolt11 = lnd.addinvoice(msats, memo=qr.tag62)
- Display: Render bolt11 string as QR for the payer.
- Webhook: When paid, call POST /creditTransfer at Bakong API with merchant ID & KHR amount.
- Notify: Push receipt to both payer (Lightning keysend metadata) and merchant (Bakong push).
6 Compliance & Risk Lens
- NBC allows crypto holding but not yet retail crypto denominated sales; settlement must land in KHR or USD. Use the bridge to stay fiat-native.
- Maintain KYC on-ramp for liquidity providers; log Lightning pubkeys & IP for forensic trail.
- FX spreads, slippage, and Lightning channel liquidity limits need monitoring dashboards.
7 Dev Toolbelt & Docs
- EMV/KHQR Spec v3.0 (PDF) – tag rules & CRC.
- EMVCo Merchant-Presented QR Guide – field examples.
- Bakong Open API portal – endpoints & sandbox.
- Lightning Network docs – payment flow & BOLT11.
- Strike & BitPay articles – production QR/Lightning UX hints.
Ready, Set, Build!
With KHQR’s massive merchant footprint and Lightning’s turbo-charged sats, you can craft a wallet that lets anyone anywhere scan the same cashier sticker and choose KHR, USD, or Bitcoin on the fly—all in one joyful beep. Time to light up Cambodia’s cashless future! 💥