1.0.0 • Published 4 years ago
khqr v1.0.0
KHQR (Khmer QRCode)
KHQR is the centralized QRCode for Cambodia, where every mobile banking app in Cambodia can scan and pay. KHQR ~ Scan.Pay.Done.
How to use KHQR Javascript Library?
Generate KHQRCode
There are 3 methods that are required which are
- setMerchantName
- setMerchantType
- setBakongAccount
Example below:
const {BakongKHQR, khqrData} = require("../src");
const khqr = new BakongKHQR()
.setMerchantName("ដេវីត")
.setMerchantType("merchant")
.setAmount(1000)
.setCurrency(840)
.setBakongAccount("devit_huotkeo_2000@abaa")
.setBillNumber("#0069")
.setTerminalLabel("Starbuck BKK I")
.setStoreLabel("Starbuck BKK");
const response = khqr.generate();
console.log(response)
Decode
const {BakongKHQR, khqrData} = require("../src");
const khqr = new BakongKHQR()
const KHQRString =
"00020101021230190015john_smith@devb5204599953038405405500.05802KH5910John Smith6010Phnom Penh62640111Invoice#0690314Coffee Khlaing0727Cooooooooooooooooooounter 299170013161406568381963040F76";
const decodeResult = khqr.decode(KHQRString)
console.log(decodeResult);