GPIX
GPIX is a library that facilitates the generation of dynamic and static br-codes for the central bank of Brazil PIX arrangement.
How to use
First install the library:
npm i gpix
Then start with PIX.static()
or PIX.dinamic()
and follow the examples below:
const { PIX } = require('gpix/dist');
let pix = PIX.static();
pix.setReceiverName('Hiago Silva Souza')
pix.setReceiverCity('Rio Preto')
pix.setReceiverZipCode('15082131')
pix.setKey('fcba8826-cbff-46e2-8c40-1b39896402a8')
pix.setIdentificator('123')
pix.setDescription('Donation with defined amount - GPIX')
pix.isUniqueTransaction(true)
pix.setAmount(5.0)
console.log('\nDonation with defined amount - GPIX >>>>\n', pix.getBRCode())
pix = PIX.static();
pix.setReceiverName('Hiago Silva Souza')
pix.setReceiverCity('Rio Preto')
pix.setKey('nubank@hiago.me')
pix.setDescription('Donation without defined amount - GPIX')
console.log('Donation without defined amount - GPIX >>>>\n', pix.getBRCode())
let dpix = PIX.dinamic();
dpix.setReceiverName('Minha Empresa LTDA')
dpix.setReceiverCity('Rio Preto')
dpix.setLocation('url-location-psp')
dpix.setAmount(10.4)
console.log('\nBRCODE dinamic - GPIX >>>>\n', dpix.getBRCode());
(async () => {
})();
(async () => {
pix.setDescription('Free Donation / QRCODE - GPIX')
if(await pix.saveQRCodeFile('./qrcode.png')) {
console.log('success in saving static QR-code')
} else {
console.log('error saving QR-code')
}
})();
Did this lib help you?
If this lib helped you feel free to make a donation =), it can be R$ 0.50 hahahaha. To do so, just read the qrcode below, it was generated with the lib sample file.
![QRCode Doação](https://github.com/hiagodotme/gpix/blob/main/qrcode.png?raw=true)
Author
Hiago Silva Souza <hiasilva@gmail.com> | https://hiago.me/