Introduction
This NPM package is used to generate dynamic UPI QR codes by passing UPI_ID and AMOUNT in the arguments. It is a simple method to accept payments on the websites without using any payment gateways.
Documentation
Install the package into your any Javascript or Typescript based project using the following command
npm i @omkarbhosale/upiqr
Once the package is installed into your project, you can import the library into the code where you want to generate UPI QR codes.
import generateQR from "@omkarbhosale/upiqr";
Now, you can use the generateQR
function to generate a dynamic UPI QR code. The function takes two arguments: UPI_ID
and AMOUNT
.
Async funtion is required to generate the QR and retrun the promise as Base64 URL
let data = await generateQR({ UPI_ID: "omkar@upi", AMOUNT: 1234 });
The above code will return a promise that resolves to a base64 url of the QR code. You can use this URL to display the QR code on your website or save it as an image file.
Note
The generateQR
function is asynchronous and returns a promise that resolves to a base64 URL of the QR code. You need to handle the promise using either async/await
or then/catch
.
There is no external server involved in this process, all the data is generated on the client side. This package only generates the QR code and does not send any data to a server and it is safe to use for accepting payments without using any payment gateways.
Contributing
If you have any suggestions or improvements for this package, feel free to open an issue or submit a pull request.