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

expo-upi-payment

v0.1.0

Published

UPI Payment library for React Native Expo (Android only)

Downloads

12

Readme

Expo UPI Payment

A React Native Expo library for integrating UPI payments in Android apps.

Features

  • Open UPI payment apps using deep linking
  • Show all available UPI apps installed on the device
  • Track payment status (success/failure/cancelled)
  • Works entirely on the client side (no backend required)
  • Android only (UPI is not available on iOS)

Installation

npm install expo-upi-payment
# or
yarn add expo-upi-payment

Expo Configuration

This library requires custom native code, so you'll need to use either:

  • Expo Development Builds
  • EAS Build
  • Expo prebuild workflow

Add the config plugin to your app.json/app.config.js:

{
  "expo": {
    "plugins": [
      "expo-upi-payment"
    ]
  }
}

Then rebuild your app:

npx expo prebuild --clean
# or
eas build

Usage

1. Get installed UPI apps

import UPIPayment from 'expo-upi-payment';

// Get list of UPI apps installed on the device
const getUPIApps = async () => {
  try {
    const apps = await UPIPayment.getInstalledUPIApps();
    console.log('Installed UPI apps:', apps);
    /*
    [
      { packageName: 'net.one97.paytm', appName: 'Paytm' },
      { packageName: 'com.phonepe.app', appName: 'PhonePe' },
      ...
    ]
    */
  } catch (error) {
    console.error('Error getting UPI apps:', error);
  }
};

2. Initiate payment (showing all UPI apps)

const makePayment = async () => {
  try {
    const paymentParams = {
      vpa: 'merchant@upi',          // Payee UPI ID
      name: 'Merchant Name',        // Payee name
      amount: '100.00',             // Amount as string
      transactionRef: 'TXN123456',  // Unique reference ID
      transactionNote: 'Payment for order #123', // Optional
      currency: 'INR'               // Optional (default: INR)
    };
    
    const result = await UPIPayment.initiatePayment(paymentParams);
    console.log('Payment result:', result);
    /*
    {
      status: 'SUCCESS', // or 'FAILURE', 'CANCELLED', 'SUBMITTED', 'UNKNOWN'
      transactionRef: 'TXN123456',
      transactionId: '...', // if available
      responseCode: '...',  // if available
      approvalRefNo: '...', // if available
      rawResponse: '...'    // raw response string
    }
    */
  } catch (error) {
    console.error('Payment error:', error);
  }
};

3. Initiate payment with a specific UPI app

const makePaymentWithApp = async (appPackage) => {
  try {
    const paymentParams = {
      vpa: 'merchant@upi',
      name: 'Merchant Name',
      amount: '100.00',
      transactionRef: 'TXN123456',
      transactionNote: 'Payment for order #123',
    };
    
    // Example: Pay with Google Pay
    const result = await UPIPayment.initiatePaymentWithApp(
      paymentParams,
      'com.google.android.apps.nbu.paisa.user'
    );
    console.log('Payment result:', result);
  } catch (error) {
    console.error('Payment error:', error);
  }
};

How it works

  1. The library uses Android's Intent system to open UPI payment URLs
  2. When a payment is initiated, the user is taken to the UPI app
  3. After completing or cancelling the payment, the user returns to your app
  4. The library captures the result using Android's onActivityResult mechanism
  5. The promise resolves with the payment status and details

Payment Status Values

  • SUCCESS: Payment was successful
  • FAILURE: Payment failed
  • CANCELLED: User cancelled the payment
  • SUBMITTED: Payment request was submitted, but final status is unknown
  • UNKNOWN: Unable to determine payment status

Notes

  • This library works only on Android devices with UPI apps installed
  • No backend communication is needed for basic payment flow
  • For production use, it's recommended to verify payments with your backend
  • The UPI schemes may vary across different UPI apps, this library handles common patterns

License

MIT