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

baseupi

v1.1.0

Published

Official Node.js SDK for BaseUPI

Readme

baseupi

The official SDK for the BaseUPI payment platform. Integrate UPI payments into your SaaS frictionlessly without writing raw HTTP requests or complex cryptographic signature validation.

Installation

npm install baseupi
# or
yarn add baseupi
# or
pnpm add baseupi

Setup

import BaseUPI from 'baseupi';

const baseupi = new BaseUPI('your_baseupi_api_key', {
    baseURL: 'https://your-baseupi-domain.com' // Optional. Defaults to https://baseupi.app
});

Creating an Order

Generate a dynamic payment URL for your customer.

const order = await baseupi.orders.create({
    merchant_order_id: 'sub_xyz_123',
    customer_email: '[email protected]',
    redirect_url: 'https://your-saas.com/success',
    line_items: [
        {
            name: 'Pro Subscription',
            amount_paise: 99900, // ₹999.00
            quantity: 1
        }
    ],
    metadata: {
        userId: 'us_89234'
    }
});

console.log(order.checkout_url); // Redirect user to this URL

Verifying Webhooks securely (Fulfillment)

BaseUPI relies on webhooks to tell you when a user has completed payment via their UPI app. Because webhooks hit your public server, you must cryptographically verify that the request actually came from BaseUPI.

The SDK does this automatically in one line:

import express from 'express';
import BaseUPI from 'baseupi';

const app = express();
const baseupi = new BaseUPI('your_baseupi_api_key');

// Crucial: we need the raw body as a string/buffer to verify the signature!
app.post('/api/webhooks/baseupi', express.text({ type: '*/*' }), (req, res) => {
    const signature = req.headers['x-baseupi-signature'];
    const webhookSecret = process.env.BASEUPI_WEBHOOK_SECRET;

    let event;

    try {
        event = baseupi.webhooks.constructEvent(req.body, signature, webhookSecret);
    } catch (err) {
        console.error('Webhook payload was compromised or invalid');
        return res.status(400).send(`Webhook Error: ${err.message}`);
    }

    // Handle the event
    if (event.event === 'payment.completed') {
        const merchantOrderId = event.merchant_order_id;
        console.log(`Order ${merchantOrderId} paid successfully!`);
        // Fulfill the order (e.g. upgrade subscription)
    }

    res.json({ received: true });
});

Retrieving an Order

You can manually poll an order status using its ID.

const order = await baseupi.orders.retrieve('saas_sub_987654');
// or retrieve by BaseUPI ID:
// const order = await baseupi.orders.retrieve('ord_K9EFTDQV');

if (order.status === 'COMPLETED') {
    // Payment confirmed
}

Types

The SDK is fully typed with TypeScript, providing rich autocomplete in VS Code for payloads and responses.

License

MIT