1.0.2 • Published 12 months ago

node-vietqr v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

#Features Support draw QR code from data bank ( accountName, amount, memo,....) with many templates

Installation

Npm install:

npm install node-vietqr

Use

import { generateQRCode } from 'node-vietqr'
import path from 'path'
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);

const __dirname = path.dirname(__filename);

generateQRCode(
  {
    bankCode: '970418',
    bankAccountNumber: '12345678999',
    amount: 1000000,
    description: 'Thanh toan hoa don',
  },
  {
    width: 400,
    height: 400,
    padding: 16,
    bgColor: '#111729',
    qrColor: '#ffffff',
    output: path.join(__dirname, './qrcode.png'),
  }
)

PaymentInfoConfig

PropertyTypeDefault ValueDescriptionExample
bankCodestringBank Identification Numbers. List bank codeSacombank - 970403
bankAccountNumberstringBank account number
amountnumber|undefinedundefinedTransaction amount
descriptionstring|undefinedundefinedTransaction content
qrMethod'static'|'dynamic''static'static: Static QR – apply when allows a QR code to process more than one transaction. dynamic: Dynamic QR – apply when allow a QR code to process only one transaction.

Option

PropertyTypeDefault ValueDescriptionExample
widthnumber400Width of QRCode image
heightnumber400Height of QRCode image
paddingnumber16Padding of QRCode image
bgColorstring#111729Background color
qrColorstring#ffffffQRcode color
textColorstring|undefinedText color
textPositionnumber|undefinedText position in QRcode image
textSizenumber|undefinedText size
textValuestring|undefinedText value
fontFamilystring|undefinedFont family
logoPathstring|undefinedLogo file path will show in the center of QRcode
logoWidthnumber|undefinedLogo width
outputstring|undefinedQRcode file path output
1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago