back to blog

Behind the Scenes Ft: UPI-QR Package

August 31, 2025 · 3 min read

TypeScriptProject OverviewNPM Package

When it comes to integrating UPI payments into applications, the struggle is real. Developers often hit a wall when dealing with payment gateways like Razorpay, PayU, etc. While they are powerful, the reality is not always smooth — especially for indie developers or small products.

Let’s break it down.


The Problems ⚠️

  1. Tedious Registration Process
    To integrate UPI payments officially, you need to sign up with gateways like Razorpay or PayU. Their onboarding is hectic and approvals for small digital products are often rejected.

  2. Transaction Fees
    Even if you manage to get approval, be ready to lose money. They typically charge ~2% per transaction. For example, if someone pays you ₹20,000, you lose ₹400 straight away!

  3. Account Suspension Issues
    These APIs expect continuous usage. If your account isn’t active, it gets suspended — and then you’re back to the same lengthy approval process again.


My Solution 💡

Instead of depending on payment gateways, I decided to build my own package for generating UPI QR codes.

✅ Available on both NPM and PyPI:


How It Works ⚙️

All you need are two arguments:

  • UPI_ID → your UPI handle (example: omkar@upi)
  • AMOUNT → payment amount in ₹

The package generates a dynamic QR code and returns it as a Base64 image string, which you can render easily in your frontend.

👉 Best part? No UPI ID is sent or stored anywhere. Everything happens locally, safe and secure.


Example Usage 📦

JavaScript (Node.js / Frontend):

import upiqr from "@omkarbhosale/upiqr";
const qr = await upiqr("omkar@upi", 200);  
console.log(qr); // Base64 image string

Python (Backend):

from omkarbhosale_upi_qr import generate_qr
qr = generate_qr("omkar@upi", 200)
print(qr)  //# Base64 image string

Render this Base64 string as an <img> in your frontend, and you’re good to go!


Example Diagram

But Wait… Manual Verification 🔍

Since this doesn’t rely on gateways, you won’t automatically know if a payment is successful. Here’s what you can do:

  • Ask users to enter the Transaction ID after payment
  • Optionally, allow them to upload a screenshot for better handling

Sure, it’s an extra step, but think about the savings! For a payment of ₹20,000, you save ₹400 (2%) by skipping gateways. That’s real money.


Why This Matters 🌟

  • Perfect for small indie projects or one-time product payments
  • No dependency on costly payment gateways
  • Developer-friendly with ready-to-use packages

Here is the simple live working example!

*It is an example, Please do not transfer any real money! You can scan with the real UPI Application just to checkout the Merchant Name and Price Amount Checkout

Learn More 📖

👉 Check out the package on:

Share it on!