npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vietqr-payment

v0.0.2

Published

Completed client side and server solution for generating the VietQR for payment with new specification updated in Oct 2022 by Napas (Vietnam)

Downloads

8

Readme

VietQR Generation Library

This is a VietQR generation library.

This library will help you to generate the VietQR Data String which align with VietQR Specification announced on 05/10/2022

VietQR Library specification:

  • The detail "VietQR fields" :
    • is_dynamic_qr:
      • 'False' for static QR
      • 'True' for dynamic QR
    • merchant_category: defined by ISO 18245 and assigned by Payment Instituation.
    • postal_code: Postal code, Ex: postcode = 70000 for Vietnam
    • currency: defined by ISO 4217, for Vietnam: currency = 704
    • country_code: defined by ISO ISO 3166-1 alpha 2, for Vietnam: country_code = VN
    • amount: Total amount (including TIP) of bill
    • acq: Acquirer bank code defined by Vietname State Bank.
    • service_code: VietQR service code as following
      • QRPUSH: Payment service code by QR
      • QRIBFTTC: Inter-Bank Fund Transfer 24/7 to Card service code by QR
      • QRIBFTTA: Inter-Bank Fund Transfer 24/7 to Account service code by QR
    • merchant_id: as following
      • for QRPUSH: Merchant ID will be provided by Acquirer bank.
      • for QRIBFTTC: Merchant ID will be your ATM card number which started with '9704...'.
      • for QRIBFTTA: Merchant ID will be your bank account.
    • purpose_txn: payment/transfer purpose
    • Other extended and optional variable
      • bill_number: Your bill number
      • terminal_label: Your terminal ID
      • store_label: Your store name
      • mobile_number: Your customer mobile phonenumber
      • loyalty_number: Your customer loyalty numbeer
      • customer_label: Your customer ID
      • ref_label: Your reference info

To use this library, do as following

  • Import the VietQR and QRcode libraries:

    const { VIETQR, CURRENCY, SERVICE_CODE} = require('vietqr-js');

    const QRCODE = require('vietqr-js/qrcode');

  • Generate the VietQR data string:

    • Example for "Money transfer" VietQR:

    let vietQRdata = new VIETQR()

    vietQRdata.fields.is_dynamic_qr = true;

    vietQRdata.fields.merchant_category = "9999"

    vietQRdata.fields.amount = "10000";

    vietQRdata.fields.acq = "970441";

    vietQRdata.fields.merchant_id = "660704060000129";

    vietQRdata.fields.service_code = SERVICE_CODE.TO_ACCOUNT;

    vietQRdata.fields.purpose_txn = "Thanh toán bill 12/12 cho Jean";

    vietQRData = vietQRdata.builder()

    • The result: 00020101021238590010A0000007270129000697044101156607040600001290208QRIBFTTA5204999953037045405100005802VN62390835THANH TOAN BILL 12-12 CHO JEAN6304F6B3
    • Then you can use QRcode library to generate the VietQR :

    let qrcode = new QRCODE(0,"M")

    qrcode.addData(vietQRData,"Byte")

    qrcode.make()

    console.log(qrcode.createImgTag())

    • Then the result for create VietQR Image Tag as following:

    <img src="data:image/gif;base64,R0lGODdhegB6AIAAAAAAAP///ywAAAAAegB6AAAC/4yPqcvtD6OctNqLs968+w+G4kiW5omm6sq27qsC8kzTiozYh84DRu3bBX9B3W12BAIpSuUxhxTiAj2ikTrEWrPQabcZlXgX4+/3WhZCGdOqNJteT+Jqchi7rD/1iXZ0jMbVJ+jg5wZWdEe0ZZjIeNe4t4j3R9jQ6PfYk4aZmEk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