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

upiqrcode

v1.5.9

Published

Generate UPI compatible QR codes as SVG -- compiled into WebAssembly

Readme


✨ Features

  • 🚀 WebAssembly Powered: Built in Rust and compiled via wasm-pack for peak performance.
  • 🎨 Pure SVG Output: No canvas or DOM dependencies—renders crystal-clear at any resolution.
  • 📱 Universal Compatibility: Works seamlessly across Node.js, browsers, Edge runtimes, and Cloudflare Workers.
  • 🔗 Dual Output: Returns both the visual SVG QR code and the raw UPI deep-link intent (upi://pay?...).
  • 🛡️ Spec Compliant: Adheres strictly to the NPCI Unified Payments Interface specifications.

📦 Installation

Install with your preferred package manager:

# npm
npm install upiqrcode

# pnpm
pnpm add upiqrcode

# yarn
yarn add upiqrcode

# bun
bun add upiqrcode

🚀 Quick Start

1. Node.js / TypeScript / ESM

import { upiqrcode } from "upiqrcode";

async function generateInvoice() {
  const result = await upiqrcode({
    payeeVPA: "merchant@bank",
    payeeName: "Acme Corporation",
    amount: "499.00",
    currency: "INR",
    transactionNote: "Invoice #INV-2026-001",
    transactionId: "TXN1234567890",
  });

  console.log("UPI Intent Link:", result.intent);
  // Output: upi://pay?pa=merchant@bank&pn=Acme%20Corporation&am=499.00&cu=INR&tn=Invoice%20%23INV-2026-001&tr=TXN1234567890

  console.log("Raw SVG Code:\n", result.qr);
}

generateInvoice();

2. React / Next.js

"use client";

import { useEffect, useState } from "react";
import { upiqrcode } from "upiqrcode";

export default function PaymentQRCode() {
  const [svg, setSvg] = useState<string>("");
  const [intent, setIntent] = useState<string>("");

  useEffect(() => {
    async function fetchQR() {
      const data = await upiqrcode({
        payeeVPA: "business@upi",
        payeeName: "My Online Store",
        amount: "1500.00",
        transactionNote: "Order #8821",
      });
      setSvg(data.qr);
      setIntent(data.intent);
    }

    fetchQR();
  }, []);

  return (
    <div style={{ textAlign: "center", padding: "1.5rem" }}>
      <h3>Scan to Pay</h3>
      {svg ? (
        <div
          style={{ width: 250, margin: "0 auto" }}
          dangerouslySetInnerHTML={{ __html: svg }}
        />
      ) : (
        <p>Loading QR Code...</p>
      )}
      {intent && (
        <p>
          <a href={intent}>Click here to pay directly on mobile</a>
        </p>
      )}
    </div>
  );
}

3. Vanilla JavaScript (Browser / CDN)

Link the CDN script and use the upiqrcode function directly.

https://esm.sh/upiqrcode ..

https://cdn.jsdelivr.net/npm/upiqrcode/+esm

https://unpkg.com/[email protected]/upiqrcode.js

<div id="qrcode-container"></div>

<script type="module">
  import { upiqrcode } from "https://cdn.jsdelivr.net/npm/upiqrcode/+esm";

  const { qr } = await upiqrcode({
    payeeVPA: "username@okhdfcbank",
    payeeName: "Rahul Sharma",
    amount: "250.00",
  });

  document.getElementById("qrcode-container").innerHTML = qr;
</script>

📖 API Reference

upiqrcode(params)

function upiqrcode(params: UpiqrcodeParams): Promise<UpiqrcodeResult>

Parameters (UpiqrcodeParams)

| Parameter | Type | Required | Default | Description | | :--- | :--- | :---: | :---: | :--- | | payeeVPA | string | Yes | — | Payee Virtual Payment Address (e.g., user@upi). | | payeeName | string | Yes | — | Name of the recipient or merchant. | | amount | string | No | — | Transaction amount (e.g., "100.00"). | | minimumAmount | string | No | — | Minimum transaction amount allowed. | | currency | string | No | "INR" | 3-letter currency code (Standard: INR). | | transactionId | string | No | — | Unique bank transaction reference ID (tr). | | transactionRef | string | No | — | Merchant reference / order ID. | | transactionNote | string | No | — | Short description or remark (tn). | | payeeMerchantCode| string | No | — | 4-digit Merchant Category Code (MCC). | | transactionRefUrl| string | No | — | Order URL / digital invoice URL (url). |

Return Value (UpiqrcodeResult)

| Property | Type | Description | | :--- | :--- | :--- | | qr | string | Complete <svg>...</svg> string ready to insert into DOM or file. | | intent | string | Fully-encoded UPI intent link (upi://pay?...). |


🛠️ Building from Source

This package compiles Rust code to WebAssembly using wasm-pack.

Prerequisites

Steps

# 1. Clone the repository
git clone https://github.com/Pratyay360/upiqrcode.git
cd upiqrcode

# 2. Build WebAssembly target
wasm-pack build --target bundler

# 3. Install JS dependencies
npm install

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to open an issue or pull request on GitHub.


📄 License

Distributed under the Apache-2.0 License. See LICENSE_APACHE for more information.