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

@minotaurg/medusa-payment-razorpay

v1.0.0

Published

Razorpay payment provider for Medusa v2 — UPI, cards, net banking, wallets for Indian e-commerce

Readme

medusa-payment-razorpay

Razorpay payment provider for Medusa v2 — accept UPI, debit/credit cards, net banking, and wallets for Indian e-commerce stores.

Features

  • UPI (Google Pay, PhonePe, Paytm)
  • Debit & Credit Cards (Visa, Mastercard, RuPay)
  • Net Banking (50+ banks)
  • Wallets (Paytm, PhonePe, Amazon Pay)
  • HMAC-SHA256 signature verification on authorize + webhooks
  • Auto-capture for UPI payments
  • Refund support
  • Webhook handler for async payment events

Installation

npm install medusa-payment-razorpay razorpay

Configuration

Add to your medusa-config.ts:

module.exports = defineConfig({
  // ...
  modules: [
    {
      resolve: "@medusajs/payment",
      options: {
        providers: [
          {
            resolve: "medusa-payment-razorpay",
            id: "razorpay",
            options: {
              key_id: process.env.RAZORPAY_KEY_ID,
              key_secret: process.env.RAZORPAY_KEY_SECRET,
              webhook_secret: process.env.RAZORPAY_WEBHOOK_SECRET,
            },
          },
        ],
      },
    },
  ],
})

Environment Variables

RAZORPAY_KEY_ID=rzp_test_xxxxx        # From Razorpay Dashboard → Settings → API Keys
RAZORPAY_KEY_SECRET=xxxxx              # Secret key (never expose publicly)
RAZORPAY_WEBHOOK_SECRET=xxxxx          # From Dashboard → Webhooks → Secret

Storefront Integration

After the customer selects Razorpay at checkout:

  1. Call initiatePaymentSession — creates a Razorpay order
  2. Open Razorpay Checkout.js modal with the order_id from session data
  3. On success, push razorpay_payment_id + razorpay_signature back to the session
  4. Call cart.complete() — the provider verifies the HMAC signature
// Frontend: open Razorpay modal
const options = {
  key: process.env.NEXT_PUBLIC_RAZORPAY_KEY_ID,
  order_id: session.data.razorpay_order_id,
  handler: async (response) => {
    // Send payment_id + signature to backend to update session
    await updatePaymentSession(session.id, {
      razorpay_payment_id: response.razorpay_payment_id,
      razorpay_signature: response.razorpay_signature,
    })
    // Then complete the cart
    await completeCart(cartId)
  },
}
const rzp = new Razorpay(options)
rzp.open()

Webhook Setup

In your Razorpay Dashboard → Webhooks:

  • URL: https://your-domain.com/hooks/payment/razorpay_razorpay
  • Events: payment.captured, payment.failed
  • Secret: Set the same value as RAZORPAY_WEBHOOK_SECRET

How It Works

| Method | Action | |--------|--------| | initiatePayment | Creates Razorpay order, returns order_id | | authorizePayment | Verifies HMAC-SHA256 signature | | capturePayment | Captures authorized payment (auto for UPI) | | refundPayment | Initiates refund via Razorpay API | | cancelPayment | No-op (Razorpay orders auto-expire) | | getWebhookActionAndData | Handles async events from Razorpay webhooks |

Notes

  • All amounts are in paise (₹1 = 100 paise) — same as Razorpay's API
  • In development mode, missing keys are allowed (skips validation)
  • In production, all three env vars are required

License

MIT