v3.0.0 is released! Automatic Transaction Splitting, Zod 4 & Precision Math.
What's New
Core APINew in v3.0.0NPCI Optimized

splitTransactionQR(params)

Splits large transactions exceeding a threshold (default ₹2,000) into ₹1,999 intervals and generates concurrent QR codes for each chunk.

Why Split at ₹1,999?

Under National Payments Corporation of India (NPCI) regulations:

  • Transactions less than or equal to ₹2,000 on Prepaid Payment Instruments (PPI wallets like Paytm wallet, PhonePe wallet) bypass merchant interchange fees (typically up to 1.1%).
  • Sub-₹2,000 transactions experience significantly fewer bank OTP delays, faster client verification, and higher completion rates.
  • By splitting higher amounts into ₹1,999 chunks, each individual payment remains safely under the ₹2,000 threshold while completing the full invoice balance.

Function Signature

typescript
function splitTransactionQR(params: SplitQRParams): Promise<SplitQRItem[]>;

Parameters (SplitQRParams)

ParameterTypeRequiredDefaultDescription
UPI_IDstringRequiredValid UPI handle (e.g. store@okhdfcbank).
AMOUNTnumberRequiredTotal amount to receive (positive number up to ₹10,00,000).
splitIntervalnumberOptional1999Maximum amount per split chunk.
thresholdnumberOptional2000Amount above which splitting is triggered. If AMOUNT <= threshold, 1 QR is generated.
namestringOptionalPayee name (encoded as pn).
notestringOptionalTransaction note. Automatically appends (Part X/Y) to each chunk.
currencystringOptional"INR"Currency code.

Return Value (SplitQRItem[])

Returns a Promise resolving to an array of objects:

PropertyTypeDescription
idstringUnique UUID (v4) identifying this specific split chunk.
amountnumberThe numerical amount for this individual chunk (e.g. 1999).
imagestringBase64 Data URL of the generated QR code (data:image/png;base64,...).

Example Output (for ₹5,000)

json
[
  {
    "id": "4a236fad-ebc5-471f-86ab-86a4f9e621e7",
    "amount": 1999,
    "image": "data:image/png;base64,iVBORw0KGgo..."
  },
  {
    "id": "c19ba6ae-664a-47d7-9948-bf3558fefb6d",
    "amount": 1999,
    "image": "data:image/png;base64,iVBORw0KGgo..."
  },
  {
    "id": "3c44b4ad-44e7-414f-86c4-60ae9f228ec6",
    "amount": 1002,
    "image": "data:image/png;base64,iVBORw0KGgo..."
  }
]

Live Interactive Split Calculator

Experiment with amounts, split intervals, and thresholds to see the generated QR codes in real-time:

Interactive UPI QR StudioLive v3.0.0

Simulate live QR generation & transaction splitting directly in your browser

Split Interval SettingsNPCI Optimized

Any amount > ₹2000 triggers splitting into max ₹1999 chunks to bypass PPI interchange fees.

Ready to Generate

Adjust parameters on the left and click Generate to see the base64 QR Data URL and split chunks live.

Step-by-Step Implementation Guide

1

Invoke splitTransactionQR

Pass your UPI ID and the total order amount. The library automatically checks whether splitting is necessary.

checkout.ts
import { splitTransactionQR } from "@omkarbhosale/upiqr";

async function processHighValuePayment() {
  try {
    const qrs = await splitTransactionQR({
      UPI_ID: "merchant@okhdfcbank",
      AMOUNT: 5000,
      name: "Omkar Store",
      note: "Order #8491",
    });

    console.log(qrs);
  } catch (error) {
    console.error("Split generation failed:", error.message);
  }
}

processHighValuePayment();
2

Render Stepper or Tab Carousel

If multiple items are returned in the array, render a multi-step checkout UI with tabs (e.g. "Part 1 of 3: ₹1,999", "Part 2 of 3: ₹1,999", "Part 3 of 3: ₹1,002").

3

Track Payment Completion

Each chunk includes a unique UUID in item.id. You can store these IDs in your database to track which parts the customer has confirmed.

Custom Split Intervals & Thresholds

You can customize the threshold and chunk interval to match custom business requirements:

typescript
import { splitTransactionQR } from "@omkarbhosale/upiqr";

// Split transactions above ₹500 into ₹400 intervals
const qrs = await splitTransactionQR({
  UPI_ID: "merchant@upi",
  AMOUNT: 1000,
  threshold: 500,     // Split anything > ₹500
  splitInterval: 400, // Chunk size: ₹400
  name: "Omkar Store",
  note: "Custom Split"
});

// Returns 3 QRs: ₹400 + ₹400 + ₹200

Amounts Within Threshold (≤ ₹2,000)

If the amount is less than or equal to the threshold, no splitting occurs. The returned array simply contains a single QR item:

typescript
// Transactions <= threshold are NOT split
const qrs = await splitTransactionQR({
  UPI_ID: "merchant@upi",
  AMOUNT: 1500,
});

// Returns 1 item in the array:
// [ { id: "...", amount: 1500, image: "data:image/png;base64,..." } ]