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

v1.1.9

Published

Support draw QR code from data bank ( accountName, amount, memo,....) with many templates, create link URL from QR code

Downloads

1,626

Readme

VIETQR

  • Support draw QR code from data bank ( accountName, amount, memo,....) with many templates
  • Support create link URL from QR code

Table of Contents

Features

  • Support draw QR code from data bank ( accountName, amount, memo,....) with many templates
  • Support create link URL from QR code

Choose what you need

| Project | Support | | --- | --- | | VietQR | - Running with DOM on CLIENT-SIDE: Browser(IE6+, Chrome, Firefox, Safari, Opera, Mobile Safari, Android, Windows Mobile, etc.), Electron, NW.js, etc. - Running without DOM on SERVER-SIDE: Save image to file(PNG/JPEG/Base64) or get data url text. NodeJS, Electron, NW.js, etc. - A QRCode generator for React Native: Generate QRCode image or get base64 data url text.|

Try It!

Try It!

Demo preview

Demo preview

Installation

Example

import {VietQR} from 'vietqr';


let vietQR = new VietQR({
    clientID: 'de8a0804-a76d-41e5-8ad6-31503ce7d5f4',
    apiKey: '17c29f09-4ea2-4417-b9c2-7f020d35de42',
});

// list banks are supported create QR code by Vietqr
vietQR.getBanks().then((banks)=>{console.log(banks)})
.catch((err)=>{});

// list templates are supported by Vietqr
vietQR.getTemplate().then((data)=>{console.log(data)})
.catch((err)=>{});


// create QR code from data
vietQR.genQRCodeBase64({
    bank: '970415',
    accountName: 'QUY VAC XIN PHONG CHONG COVID',
    accountNumber: '113366668888',
    amount: '79000',
    memo: 'Ung Ho Quy Vac Xin',
    template: 'compact'
}).then((data)=>{console.log(data)})
.catch((err)=>{});

VietQR API

| Option | Description | | --- | --- | | bank | Get the bin field corresponding to the data returned in the banks API (VietQR.getTemplate() or API Bank) | | accountName | Bank account name | | accountNumber | Bank account number | | amount | Amount of money | | memo | Money transfer content | | template | Type of template returned to the user | | clientID | api_key is provided when registering an account at http://my.vietqr.io/ | apiKey | client_key is provided when registering an account at http://my.vietqr.io/

getTemplate()

vietQR.getTemplate().then((data)=>{console.log(data)})
.catch((err)=>{});

Response successfully

 {
  code: '00',
  desc: 'success',
  data: [
    {
      name: 'QR Only',
      template: 'qr_only',
      demo: 'https://api.vietqr.io/Vietinbank/113366668888/790000/Gop%20Quy/qr_only.jpg?accountName=Quy%20Vacxin%20Covid'
    },
    {
      name: 'Compact',
      template: 'compact',
      demo: 'https://api.vietqr.io/Vietinbank/113366668888/790000/Gop%20Quy/compact.jpg?accountName=Quy%20Vacxin%20Covid'
    },
    {
      name: 'Compact 2',
      template: 'compact2',
      demo: 'https://api.vietqr.io/Vietinbank/113366668888/790000/Gop%20Quy/compact2.jpg?accountName=Quy%20Vacxin%20Covid'
    }
  ]
}

getBanks()

vietQR.getBanks().then((data)=>{console.log(data)})
.catch((err)=>{});

Response successfully

{
  code: '00',
  desc: 'Get Bank list successful! Total 52 banks',
  data: [
    {
      id: 17,
      name: 'Ngân hàng TMCP Công thương Việt Nam',
      code: 'ICB',
      bin: '970415',
      isTransfer: 1,
      short_name: 'VietinBank',
      logo: 'https://api.vietqr.io/img/ICB.3d4d6760.png',
      support: 3
    },
    ....
  ]
}

genQuickLink()

let link = vietQR.genQuickLink({
        bank: '970415',
        accountName: 'QUY VAC XIN PHONG CHONG COVID',
        accountNumber: '113366668888',
        amount: '79000',
        memo: 'Ung Ho Quy Vac Xin',
        template: 'compact', 
        media: '.jpg' 
    });
console.log(link);

genQRCodeBase64()

vietQR.genQRCodeBase64({
    bank: '970415',
    accountName: 'QUY VAC XIN PHONG CHONG COVID',
    accountNumber: '113366668888',
    amount: '79000',
    memo: 'Ung Ho Quy Vac Xin',
    template : 'qr_only'
}).then((data)=>{console.log(data)})
.catch((err)=>{});

Response successfully

{
    "code": "00",
    "desc": "Gen VietQR successful!",
    "data": {
        "acqId": "970415",
        "accountName": "QUY VAC XIN PHONG CHONG COVID",
        "qrDataURL": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOwAAADeCAYAAAA..."
    }
}

License

MIT License