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

medusa-payment-cod

v1.0.0

Published

Cash on Delivery payment provider for Medusa v2 — essential for Indian e-commerce

Readme

medusa-payment-cod

Cash on Delivery (COD) payment provider for Medusa v2 — essential for Indian e-commerce where 60%+ orders are COD.

Features

  • Instantly authorizes orders (no external API calls)
  • Configurable COD fee (default: ₹50)
  • Capture triggered on delivery confirmation (via fulfillment webhook)
  • Graceful cancellation (no money moved)
  • Works with any fulfillment provider (Shiprocket, Delhivery, manual)

Installation

npm install medusa-payment-cod

Configuration

Add to your medusa-config.ts:

module.exports = defineConfig({
  // ...
  modules: [
    {
      resolve: "@medusajs/payment",
      options: {
        providers: [
          {
            resolve: "medusa-payment-cod",
            id: "cod",
            options: {},
          },
        ],
      },
    },
  ],
})

No environment variables required.

How It Works

| Method | Action | |--------|--------| | initiatePayment | Returns authorized status immediately | | authorizePayment | Auto-authorized (customer commits to pay on delivery) | | capturePayment | Called when delivery is confirmed | | refundPayment | Records refund (processed offline via bank transfer) | | cancelPayment | No-op (no money was collected) |

Storefront Integration

Show COD as a payment option at checkout. When selected, the order is placed immediately — no payment modal or redirect needed.

// No special integration required
// Just call cart.complete() after selecting COD
await sdk.store.cart.complete(cartId)

COD Fee

The provider stores a cod_fee_paise field in session data (default: 5000 = ₹50). Display this in your checkout summary UI. The fee is informational — add it to your cart total display logic in the storefront.

Triggering Capture on Delivery

When your fulfillment provider confirms delivery (e.g., Shiprocket "delivered" webhook), call capturePayment on the order's payment to mark it as collected:

// In your shipment-delivered subscriber:
const paymentService = container.resolve(Modules.PAYMENT)
await paymentService.capturePayment({ payment_session_id: session.id })

License

MIT