Generate NPCI's UPI QR code (BASE64) along with UPI intent link, By using it any payment is possible from UPI enabled apps.
This package will work on client and server.
import upiqr from "upiqr";
upiqr({
payeeVPA: "bhar4t@upi",
payeeName: "Bharat Sahu"
})
.then(({ qr, intent }) => {
console.log(qr) // data:image/png;base64,eR0lGODP...
console.log(intent) // upi://pay?pa=bhar4t@upi&pn=Bhar...
})
.catch(console.error)
Fields | Description | Required |
---|---|---|
payeeVPA |
UPI ID of the payee (e.g., example@upi ). |
Yes |
payeeName |
Registered name of the payee (e.g., John Doe ). |
Yes |
payeeMerchantCode |
Merchant Code from UPI payment account | No |
transactionId |
Unique transaction id for merchant's reference | No |
transactionRef |
Unique transaction id for merchant's reference | No |
transactionNote |
Note for the payment (e.g., Electricity Bill ). |
No |
amount |
Amount | No |
minimumAmount |
Amount to be paid (e.g., 100.00 or 499 ). |
No |
currency |
Currency of amount (default: INR ) |
No |
transactionRefUrl |
URL for the order | No |
In table, fields requirement column is based on static QR, For dynamic QR you need to change more fields along with payeeVPA
and payeeName
.
For a complete list of supported fields, refer to the NPCI UPI Linking Specs
Internally using qrcode
for QR Generation. And, it accepts second optional param object for cusomizing the QR code.
upiqr(intentFields, {
color: {
dark: '#000000',
light: '#FFFFFF'
}
})