@giridharans/qr-code
v1.0.0
Published
Simple UPI QR generator for GPay, PhonePe, Paytm and more
Maintainers
Readme
qr-code
Simple UPI QR generator for GPay, PhonePe, Paytm and all UPI apps in India.
Created by Giridharan S (Developer).
📦 Installation
npm install qr-code🚀 Usage
Generate UPI QR as Data URL (PNG)
const { generateUPIQR } = require("qr-code")
async function main() {
const image = await generateUPIQR({
upiId: "giri@upi",
name: "Giridharan S",
amount: 99,
note: "Payment from Giridharan",
format: "data-url"
})
console.log(image)
}
main()🎨 Output Formats
| Format | Description |
| ------------ | ----------------- |
| data-url | Base64 PNG string |
| svg | SVG XML string |
| png-buffer | PNG file buffer |
⚙️ Options
| Field | Type | Required | Description | | -------- | ------------- | -------- | --------------------------- | | upiId | string | yes | UPI VPA | | name | string | no | Payee name | | amount | number/string | no | Transaction amount | | note | string | no | UPI note | | currency | string | no | Default: INR | | format | string | no | data-url / svg / png-buffer |
📝 Example Saving as PNG
const fs = require("fs")
const { generateUPIQR } = require("qr-code")
async function save() {
const buf = await generateUPIQR({
upiId:"giri@upi",
name:"Giri",
format:"png-buffer"
})
fs.writeFileSync("upi-qr.png", buf)
}
save()📄 License
MIT
