Socket
Book a DemoInstallSign in
Socket

smart-upiqr

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smart-upiqr

Easily generate branded UPI QR codes and payment links with customizable options for JavaScript and Node.js.

1.0.4
latest
Source
npmnpm
Version published
Weekly downloads
32
-91.21%
Maintainers
1
Weekly downloads
 
Created
Source

smart-upiqr

Easily generate branded UPI QR codes and payment links with customizable options for JavaScript and Node.js.

npm Node npm downloads license

home

Installation

npm install smart-upiqr
yarn add smart-upiqr
pnpm add smart-upiqr

Using SmartUpiQr from a CDN

Currently CDN of this package is not available and workable to use. In future it can be available to use in Vanilla website via CDN.

So now you can use it after installation via NPM or Yarn or PNPM

Usage After Installation

Importing

// ES Module
import { UPILink, UPIQR } from "smart-upiqr";

// CommonJS
const { UPILink, UPIQR } = require("smart-upiqr");

Basic Example

// Example usage after installing your package from npm

// Generate UPI link (can be used in <a href={upiLink} target="_blank">Pay Now</a>)
generateUPILink();

function generateUPILink() {
  const upiLink = UPILink({
    PayeeUPI: "test@upi",
    PayeeName: "Smart Demo",
    Amount: 499,  // Must be > 0
    TransactionNote: 'ID|lSDFG23llsd|Note',
    QrExpireDays: 5 // The QR payment link won't work after 5 days, For more info, read below
  });

  console.log("Payment Link:", upiLink);

  // Save in state if using React, or just return/use directly
  setUpiLink(upiLink);
}

// Generate UPI QR (can be used in <img src={upiQR} alt="UPI QR" />)
generateUPIQR();

async function generateUPIQR() {
  try {
    const upiQR = await UPIQR({
      PayeeUPI: "test@upi",
      PayeeName: "Smart Demo",
      Amount: 275, // Must be > 0
      QrExpireDays: 10, // The QRcode scan won't work after 10 days, For more info, read below
      logo: "https://example.com/logo.png", // remote or local path like "/logo.png" or "/src/assets/logo.png"
      logoSize: 80,
      color: {
        dark: "#f50baf", // QR code itself color
        light: "#FFFFFF" // QR code background color
      }
    });

    console.log("Payment QR:", upiQR);

    // Save in state if using React, or return directly
    setUpiQrSrc(upiQR);
  } catch (err) {
    console.error("Error while generating UPIQR:", err);
  }
}

API

SmartUpiQr(options)

Generates a UPIQr / UPILink with flexible options.

OptionTypeRequiredDescription
PayeeUPIstringYesPayment Receiver (Payee) Person/Business/Merchant UPI ID
PayeeNamestringYesPayment Receiver (Payee) Person/Business/Merchant Name
AmountnumberYesTotal amount to receive
TransactionNotestringNoTransaction Note (max 50 chracter and can use same TransactionId)
MerchantCodestringNoMerchant Category Code (max 4 digit)
TransactionRefstringNoTransaction Reference (max 35 character and Can use same TransactionId)
TransactionIdstringNoTransaction ID (max 35 character and Transaction id of payment or any unique id for reference)
invoiceNostringNoInvoice number
invoiceDatebooleanNoWhether to include invoice date (If passed true then automatic add current DateTime)
QrExpireDaysnumberNoQR Code expiry in days (Pass number values greater than 0 to make QR expirable after that day from now)
QrTimestampbooleanNoWhether to add timestamp in QR (If passed true then will automatic add current DateTime)
GSTnostringNoGST Number of business
logo (QR Only)string (URL/local path)NoLogo image URL like 'https://domain.com/brandlogo.png' or '/person.png' or 'src/assets/logo.png'
logoSize (QR Only)numberNoLogo size value greater than 5-10 for better view
color (QR Only){ dark?: string, light?: string}NoQR code hex colors (dark for QR itself: Default #000000 and light for background: Default #FFFFFF)

Note:

  • Fields marked (QR Only) apply only when generating QR images so do not pass these marked option if generating UPI payment link
  • Pass only correct values/details, Passing invalid/wrong values or extra spaces/symbols might cause not working UPI link / QR
  • Required fields: PayeeUPI, PayeeName, Amount. for UPI payment Link and UPI QR code
  • QrExpireDays and TransactionNote and GST doesn't support in all UPI Apps so it might not show/work after scan so do not worry

License

MIT

Keywords

upi

FAQs

Package last updated on 19 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.