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-provider-adapter

v1.3.4

Published

A universal adapter to make Medusa 2.8.x payment provider plugins compatible with Medusa 2.10.3+

Readme

medusa-payment-provider-adapter

A universal adapter to make Medusa 2.8.x payment provider plugins compatible with Medusa 2.10.3+

npm version License: MIT

🚀 Why This Plugin?

Medusa v2.5.0 introduced a major refactoring of the payment interface. Payment provider plugins designed for Medusa 2.8.x are not compatible with Medusa 2.10.3+, causing:

  • "moduleProviderServices is not iterable" errors
  • ❌ Payment providers not auto-registering in the database
  • ❌ Providers not appearing in the Medusa Admin

This adapter fixes all these issues using an AOP (Aspect-Oriented Programming) approach.

📦 Installation

npm install medusa-payment-provider-adapter
# or
yarn add medusa-payment-provider-adapter
# or
pnpm add medusa-payment-provider-adapter

🎯 Quick Start

1. Create an Adapter Module

Create a file src/modules/your-provider-adapter/index.ts:

import { createPaymentProviderAdapter } from "medusa-payment-provider-adapter"

// Replace with your legacy payment provider package path
export default createPaymentProviderAdapter("@vendor/medusa-payment-plugin/providers/provider-name")

2. Configure in medusa-config.ts

import { defineConfig, Modules } from "@medusajs/framework/utils"

export default defineConfig({
  modules: [
    {
      resolve: "@medusajs/medusa/payment",
      options: {
        providers: [
          {
            resolve: "./src/modules/your-provider-adapter",  // ← Use your adapter
            id: "your-provider-id",
            options: {
              apiKey: process.env.YOUR_API_KEY,
              // ... other provider options
            },
          },
        ],
      },
    },
  ],
})

3. Start Your Medusa App

npm run dev

Your payment provider is now auto-registered!

📚 Real-World Examples

Example 1: PayPal (@alphabite/medusa-paypal)

// src/modules/paypal-adapter/index.ts
import { createPaymentProviderAdapter } from "medusa-payment-provider-adapter"

export default createPaymentProviderAdapter("@alphabite/medusa-paypal/providers/paypal")
// medusa-config.ts
export default defineConfig({
  modules: [
    {
      resolve: "@medusajs/medusa/payment",
      options: {
        providers: [
          {
            resolve: "./src/modules/paypal-adapter",
            id: "paypal",
            options: {
              clientId: process.env.PAYPAL_CLIENT_ID,
              clientSecret: process.env.PAYPAL_CLIENT_SECRET,
              isSandbox: process.env.PAYPAL_IS_SANDBOX === "true",
            },
          },
        ],
      },
    },
  ],
})

Example 2: Custom Payment Provider

// src/modules/custom-pay-adapter/index.ts
import { createPaymentProviderAdapter } from "medusa-payment-provider-adapter"

export default createPaymentProviderAdapter("@your-company/medusa-custom-pay/providers/custom")

🔍 How It Works

The adapter uses an AOP (Aspect-Oriented Programming) approach:

┌─────────────────────────────────────────────────────────────┐
│ Legacy Plugin (Medusa 2.8.x)                                │
│                                                              │
│ export default ModuleProvider(Modules.PAYMENT, {            │
│   services: [YourPaymentService]                            │
│ })                                                           │
└─────────────────────────────────────────────────────────────┘
                            ↓
                   [Adapter Intercepts]
                            ↓
                  Unwraps __definition
                            ↓
              Extracts services[0] = YourPaymentService
                            ↓
┌─────────────────────────────────────────────────────────────┐
│ Adapted Export (Medusa 2.10.3+ Compatible)                  │
│                                                              │
│ export default YourPaymentService  ← Direct class export    │
└─────────────────────────────────────────────────────────────┘
                            ↓
              ✅ Auto-registers in database
              ✅ Works in Medusa Admin
              ✅ Full payment functionality

🛠️ API Reference

createPaymentProviderAdapter(packagePath: string): PaymentProviderService

Creates an adapter for a legacy payment provider plugin.

Parameters:

  • packagePath (string): The provider export path from the legacy plugin package

Returns:

  • The unwrapped payment provider service class

Throws:

  • Error if the package cannot be loaded or doesn't have a valid provider export

Example:

const PayPalService = createPaymentProviderAdapter("@alphabite/medusa-paypal/providers/paypal")

❓ When Do You Need This Adapter?

Use this adapter if you encounter any of these issues:

  1. Error Message: "moduleProviderServices is not iterable"
  2. Auto-Registration Failure: Provider doesn't appear in the payment_provider database table
  3. Version Mismatch: Plugin requires Medusa 2.8.x, but you're using 2.10.x
  4. Admin Panel: Payment provider not showing up in region configuration

✅ Compatibility

  • Medusa Version: 2.10.0+
  • Node.js: 20+
  • Legacy Plugins: Any payment provider plugin designed for Medusa 2.8.x

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

MIT © [Your Name]

🙏 Acknowledgments

  • Inspired by the need to maintain compatibility during Medusa's payment interface refactoring
  • Thanks to the Medusa.js team for building an amazing e-commerce platform
  • Special thanks to the community for identifying and reporting compatibility issues

📞 Support

🔗 Related Links


Made with ❤️ for the Medusa community