Decode VietQR and VNPayQR
masterTo decode a QR string, instantiate the QRPay class with the raw content. You can then access provider, merchant, consumer, and amount information.
import { QRPay } from 'vietnam-qr-pay';
// Decoding VietQR
const vietQR = new QRPay('00020101021238530010A0000007270123000697041601092576788590208QRIBFTTA5303704540410005802VN62150811Chuyen tien6304BBB8');
console.log(vietQR.isValid); // true
console.log(vietQR.provider.name); // VIETQR
console.log(vietQR.consumer.bankBin); // 970416
// Decoding VNPay
const vnPay = new QRPay('00020101021126280010A0000007750110010531314453037045408210900005802VN5910CELLPHONES62600312CPSHN ONLINE0517021908061613127850705ONLHN0810CellphoneS63047685');
console.log(vnPay.isValid); // true
console.log(vnPay.provider.name); // VNPAY
console.log(vnPay.merchant.merchantId); // 0105313144