npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sk-py/upi-qr

v1.0.4

Published

Generate NPCI-compliant UPI QR codes for Indian digital payments. Supports payee VPA, amount, transaction note, and more.

Readme

@sk-py/upi-qr

Generate NPCI-compliant UPI QR codes for Indian digital payments
Works in Node.js and React – returns both a Base64 QR image and a UPI intent string.


Table of Contents

  1. Installation
  2. Features
  3. Usage
  4. API Reference: generateUPIQR()
  5. Component Props: UPIQRComponent
  6. Production Tips
  7. Author & License
  8. Publishing Scope
  9. Contributing

Installation

# Using npm
npm install @sk-py/upi-qr

# Or with yarn
yarn add @sk-py/upi-qr

Peer Dependency:
React ≥ 18.0.0 (for the React component)


Features

  • 🎯 Generate UPI payment URLs compliant with NPCI
  • 🖼️ Produce Base64-encoded QR code images
  • ⚙️ Support all standard UPI fields:
    • Payee VPA & Name (required)
    • Amount, Currency, Transaction Note, Transaction Reference, URL (optional)
  • 🔗 Return both:
    1. qr – Base64 data-URI (PNG)
    2. intentupi://pay?... URL for deep-linking
  • 🎨 Ready-to-use React component for quick integration

Usage

Node.js Example

import { generateUPIQR } from '@sk-py/upi-qr';

async function createUPIPayment() {
  try {
    const { qr, intent } = await generateUPIQR({
      payeeVPA:    'merchant@bank',
      payeeName:   'Acme Corp',
      amount:      '150.00',
      transactionNote: 'Invoice #1234',
      transactionRef:  'INV1234',
      url:         'https://acme.example.com/order/1234',
      currency:    'INR'   // defaults to INR
    });

    console.log('UPI Intent URL:', intent);
    // For example, save `qr` (data URI) to a file or send to frontend
  } catch (err) {
    console.error('Error generating UPI QR:', err);
  }
}

createUPIPayment();

React Example

import React from 'react';
import { generateUPIQR } from '@sk-py/upi-qr';
import UPIQRComponent from '@sk-py/upi-qr/react';

function App() {
  const [qrData, setQrData] = React.useState({ qr: '', intent: '' });

  React.useEffect(() => {
    generateUPIQR({
      payeeVPA:  'merchant@bank',
      payeeName: 'Acme Corp',
      amount:    '250.00',
      transactionNote: 'Order #5678'
    }).then(setQrData);
  }, []);

  return (
    <div>
      {qrData.qr
        ? <UPIQRComponent
            qr={qrData.qr}
            intent={qrData.intent}
            size="180px"
            alt="Pay Acme via UPI"
          />
        : <p>Loading QR code…</p>
      }
    </div>
  );
}

export default App;

API Reference: generateUPIQR()

| Method | Description | Parameters | Returns | | ----------------------- | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | | generateUPIQR(options)| Generate UPI QR & intent string asynchronously | options (object)payeeVPA (string) – Payee’s Virtual Payment Address (required)payeeName (string) – Display name (required)amount (string) – UPI amounttransactionNote (string) – Note/memotransactionRef (string) – Reference IDurl (string) – Callback URLcurrency (string) – Currency code (default: "INR") | Promise<{ qr: string; intent: string }> |


Component Props: UPIQRComponent

| Prop | Type | Required | Default | Description | | -------- | -------- | -------- | ---------- | ------------------------------------------------- | | qr | string | ✓ | – | Base64-encoded data URI of the QR code image | | intent | string | ✓ | – | UPI deep-link URL (e.g., upi://pay?…) | | alt | string | ✗ | "UPI QR Code" | Alt text for the <img> | | size | string | ✗ | "200px" | Width & height of the QR code (e.g., "150px") |

<UPIQRComponent
  qr={qrData.qr}
  intent={qrData.intent}
  alt="Pay Acme"
  size="250px"
/>

Production Tips

  • Caching: Generate the QR once per invoice/order and cache the result to avoid repeated CPU work.
  • CDN Delivery: You can serve the Base64 string as an <img> src or convert it to a binary PNG and host on a CDN.
  • Security: Never expose your merchant secrets in the client—only pass public UPI data.
  • Deep Linking: On mobile devices, clicking the intent link should open the UPI app automatically.

Sample UPI QR Code
(Replace above with your generated QR code in production.)


Author & License

Author: sk-py
License: ISC


Publishing Scope

This package is published under the @sk-py scope on npm:

npm install @sk-py/upi-qr

Contributing

  1. Fork the repository: https://github.com/sk-py/upi-qr
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Commit your changes & tests: git commit -m "Add my feature"
  4. Push to your branch: git push origin feature/my-feature
  5. Open a Pull Request

Feel free to file issues and suggest improvements!
Happy coding! 🚀