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

@rajeev02/payments

v0.2.1

Published

Payments Abstraction SDK — UPI, wallets, cards, subscriptions, split payments (India-focused)

Downloads

250

Readme

@rajeev02/payments

npm version license

India-focused payments SDK with UPI deep links, card validation (Luhn), wallet integration, and subscription management.

Part of Rajeev SDK — cross-platform infrastructure libraries for building apps that work everywhere.

Why use this?

  • UPI-first — Generate UPI intent URIs for Google Pay, PhonePe, Paytm, BHIM. VPA validation, PSP detection.
  • Card support — Visa/Mastercard/Amex/RuPay detection, Luhn validation, formatted display
  • Wallet integration — Paytm, PhonePe, Amazon Pay — unified checkout flow
  • Subscriptions — Create, upgrade, downgrade, cancel — with proration and GST
  • Refunds — Full/partial refund flow with reason tracking
  • Indian-optimized — INR formatting, GST calculation, UPI 2.0 collect, merchant category codes
  • Pure TypeScript — No payment gateway SDK dependency. Bring your own backend.

⚠️ Important: Payment Gateway Required

This library provides client-side payment utilities — it does NOT process payments, charge cards, or communicate with payment gateways directly.

| What the library does (client-side) | What YOU must build (backend) | | ------------------------------------------ | ---------------------------------------------------- | | Generate UPI intent URIs (upi://pay?...) | Merchant VPA registration with your bank | | Validate card numbers (Luhn algorithm) | Card tokenization via Razorpay/Stripe/Juspay | | Detect card network (Visa/MC/RuPay/Amex) | PCI-compliant card processing | | Generate wallet checkout payloads | Paytm/PhonePe merchant integration + callback server | | Manage subscription state | Recurring billing via payment gateway | | Calculate GST and format INR amounts | Tax reporting and invoicing |

UPI: The generated upi://pay?... URI only works when a UPI app (GPay, PhonePe, Paytm, BHIM) is installed on the user's device. On web, UPI intent links are not supported.

Recommended payment gateways for India: Razorpay, Cashfree, Juspay, PayU, Stripe India

Platform Support

| Platform | Engine | Status | | ---------- | ---------- | ------ | | iOS 16+ | TypeScript | ✅ | | Android 7+ | TypeScript | ✅ | | Web | TypeScript | ✅ | | watchOS 9+ | TypeScript | ✅ |

Installation

npm install @rajeev02/payments

Peer Dependencies

  • react >= 18.3.0
  • react-native >= 0.84.0 (optional)

Quick Start

UPI Payments

import { generateUpiUri, validateVpa, getPspName } from "@rajeev02/payments";

// Generate UPI intent link
const uri = generateUpiUri(
  { merchantVpa: "store@paytm", merchantName: "My Store" },
  { amount: 499, note: "Order #1234", orderId: "ORD_1234" },
);
// → "upi://pay?pa=store%40paytm&pn=My+Store&am=499.00&cu=INR&..."

// Open with Linking.openURL(uri) on React Native
// or window.location.href = uri on Web

// Validate VPA
validateVpa("rajeev@paytm"); // → true
validateVpa("invalid"); // → false
getPspName("rajeev@paytm"); // → "Paytm"
getPspName("rajeev@okicici"); // → "iMobile Pay"

Card Payments

import {
  detectCardNetwork,
  formatCardNumber,
  validateCardNumber,
} from "@rajeev02/payments";

detectCardNetwork("4111111111111111"); // → "visa"
detectCardNetwork("5500000000000004"); // → "mastercard"
detectCardNetwork("6521000000000000"); // → "rupay"

formatCardNumber("4111111111111111"); // → "4111 1111 1111 1111"
validateCardNumber("4111111111111111"); // → true (Luhn check)

Wallet Checkout

import { WalletManager } from "@rajeev02/payments";

const wallets = new WalletManager();

wallets.register({
  provider: "paytm",
  merchantId: "MID_123",
  environment: "production",
  callbackUrl: "https://myapp.com/callback",
});

const checkout = wallets.generateCheckout("paytm", {
  orderId: "ORD_1234",
  amount: 499,
  customerId: "cust_abc",
});

Subscriptions

import { SubscriptionManager } from "@rajeev02/payments";

const subs = new SubscriptionManager();

const sub = subs.create({
  planId: "pro_monthly",
  customerEmail: "[email protected]",
  amount: 999,
  currency: "INR",
  interval: "month",
  trialDays: 14,
});

API Reference

| Export | Type | Description | | ---------------------- | ---------- | ------------------------------------------ | | generateUpiUri() | function | Generate UPI deep link URI | | validateVpa() | function | Validate UPI Virtual Payment Address | | getPspName() | function | Get PSP name from VPA handle | | detectCardNetwork() | function | Detect Visa/MC/Amex/RuPay from card number | | formatCardNumber() | function | Format card with spaces | | validateCardNumber() | function | Luhn algorithm validation | | WalletManager | class | Register and manage wallet providers | | SubscriptionManager | class | Subscription lifecycle management | | RefundManager | class | Full/partial refund processing |

Full Documentation

📖 Complete API docs with all payment flows

License

MIT © 2026 Rajeev Kumar Joshi