Decode KHQR Code
Decode a KHQR string into detailed payment + merchant fields.
Endpoint: POST /khqr/decode
Auth Headers
http
x-auth-type: api-key
x-api-key: <your-api-key>
Content-Type: application/jsonRequest
json
{ "qrData": "00020101021230510016abaakhppxxx@abaa..." }Success Response (Example)
json
{
"status": { "code": 0, "errorCode": null, "message": null },
"data": {
"merchantType": "30",
"bakongAccountID": "abaakhppxxx@abaa",
"merchantID": "125061922175364",
"acquiringBank": "ABA Bank",
"merchantCategoryCode": "4722",
"transactionCurrency": "840",
"transactionAmount": "20.00",
"countryCode": "KH",
"merchantName": "REAB DANET",
"merchantCity": "PHNOM PENH",
"crc": "28D2"
}
}On parse failure status.code will be non‑zero and data may be empty / partial.
Important Data Fields
merchantType | bakongAccountID | merchantID | acquiringBank | merchantCategoryCode | transactionCurrency | transactionAmount | merchantName | merchantCity | countryCode | crc
cURL
bash
curl --location 'http://localhost:3000/khqr/decode' \
--header 'x-auth-type: api-key' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <your-api-key>' \
--data '{"qrData":"0002010102123051..."}'Typical Flow
- Optionally verify first (
/khqr/verify-khqr). - Decode to extract business + merchant attributes.
- Validate amount/currency vs expected.
- Persist or compare merchant identity fields.
Quick Validation Helper (JS)
js
function isDecodeOk(r) {
return (
r?.status?.code === 0 && r.data?.merchantName && r.data?.transactionAmount
);
}Notes
- Check
status.code === 0for success. - Cache decoded structures for repeated scans.
- Always re-run server-side before settlement.
Related
Last updated: August 10, 2025
