A comprehensive collection of payment plugins and services for Medusa.js, the open-source headless commerce engine. This repository provides ready-to-use payment integrations for e-commerce stores, including Indian payment gateway (Razorpay) and cryptocurrency (Bitcoin) payment solutions.
- Multiple Payment Methods: Support for various payment providers
- TypeScript Support: Fully typed for better development experience
- Easy Integration: Simple setup process for each payment provider
- Production Ready: Tested and optimized for production use
- Active Maintenance: Regular updates and security patches
A payment plugin for integrating Razorpay V2 into your Medusa.js store. This plugin is specifically designed for merchants operating in India, providing seamless integration with Razorpay's payment gateway which supports various Indian payment methods including UPI, NetBanking, Wallets, and Cards.
Key Features:
- UPI Integration
- NetBanking Support
- Digital Wallets
- Credit/Debit Cards
- EMI Options
- Indian Rupee (INR) Support
A cryptocurrency payment plugin that integrates BTCPay Server with Medusa.js. This plugin enables your store to accept Bitcoin payments through a self-hosted BTCPay Server instance, providing a secure and decentralized payment solution for cryptocurrency transactions.
Key Features:
- Bitcoin Payment Processing
- Self-hosted Solution
- Decentralized Payments
- Enhanced Security
- Real-time Payment Status
- Test Server: A development server for testing payment integrations View Documentation
- Storefront: A reference storefront implementation View Documentation
- Clone the repository:
git clone https://github.com/SGFGOV/payment-services.git
cd payment-services
- Install dependencies:
yarn install
- Start the development environment:
yarn dev
We welcome contributions to expand the collection of payment plugins! If you've developed a payment plugin for Medusa.js, we'd love to include it in this repository. Here's how you can contribute:
- Fork the repository
- Create a new branch for your plugin
- Add your plugin to the
packages
directory - Include comprehensive documentation
- Submit a pull request
- Follow the existing plugin structure
- Include TypeScript types
- Provide clear documentation
- Include tests
- Follow Medusa.js plugin conventions
This repository uses:
- Yarn workspaces for package management
- Turborepo for build system
- TypeScript for type safety
- ESLint and Prettier for code formatting
This repository includes comprehensive end-to-end (e2e) tests using Cypress to ensure the payment integration flows work correctly.
Before running the e2e tests, make sure you have:
- Docker and Docker Compose installed and running
- Node.js (version 18 or higher)
- Yarn package manager
-
Start the development environment:
# Install dependencies yarn install # Start all services (Medusa backend, database, Redis, etc.) yarn dev
-
Seed the database with test data:
# Navigate to the test-server package cd packages/test-server # Run database migrations and seed with test data npx medusa db:migrate npx medusa exec ./src/scripts/seed.ts
This will create:
- Sample products (T-Shirt, Sweatshirt, Sweatpants, Shorts)
- Product categories and variants
- Shipping options and regions
- Payment providers configuration
- Inventory levels
- API keys and sales channels
-
Verify services are running:
- Medusa backend should be running on
http://localhost:9000
- Storefront should be running on
http://localhost:8000
- Database and Redis should be running via Docker
- Medusa backend should be running on
The e2e tests are located in packages/storefront/cypress/e2e/
and test the complete checkout flow including payment processing.
# Navigate to the storefront package
cd packages/storefront
# Run tests in headless mode
yarn cypress:run
# Navigate to the storefront package
cd packages/storefront
# Open Cypress test runner
yarn cypress:open
This will open the Cypress Test Runner where you can:
- See all available test files
- Run tests individually or all at once
- Watch tests execute in real-time
- Debug and interact with the application during test execution
The Cypress configuration is located at packages/storefront/cypress.config.ts
with the following settings:
- Base URL:
http://localhost:8000
(storefront) - Viewport: 1280x720
- Video Recording: Disabled
- Screenshots: Enabled on failure
- Default Timeout: 10 seconds
- Chrome Web Security: Disabled (for iframe testing)
checkout.cy.ts
- Tests the complete checkout flow with Razorpay payment integration- Product selection and cart management
- Address and shipping information
- Payment method selection
- Razorpay payment processing
- Order confirmation
The tests use the following test data:
- Product: Sweatpants (first product in the store)
- Size: L
- Shipping Address: Mumbai, Maharashtra, India
- Payment Method: Razorpay UPI
- Test UPI ID:
gov@okaxis
-
Tests fail with "element not found" errors:
- Ensure the storefront is running on port 8000
- Check that the Medusa backend is running on port 9000
- Verify that test data is properly seeded
-
No products appear in the store:
- Make sure you've run the database seeding script:
npx medusa exec ./src/scripts/seed.ts
- Check that the database migrations have been applied:
npx medusa db:migrate
- Verify the Medusa backend is running and connected to the database
- Make sure you've run the database seeding script:
-
Razorpay iframe issues:
- The tests include specific handling for Razorpay iframes
- Chrome Web Security is disabled to allow iframe interactions
- Tests include appropriate wait times for iframe loading
-
Payment processing timeouts:
- The tests include extended wait times for payment processing
- If tests consistently timeout, consider increasing wait times in the test file
-
Database connection issues:
- Ensure Docker containers are running:
docker-compose ps
- Restart services if needed:
yarn dev
- Check database logs:
docker-compose logs postgres
- Ensure Docker containers are running:
To run tests with additional logging:
cd packages/storefront
ELECTRON_ENABLE_LOGGING=1 yarn cypress:run
The e2e tests are designed to run in CI/CD environments. The headless mode (cypress:run
) is optimized for automated testing pipelines.
If you need help with any of the payment plugins or have questions about contributing, please contact us:
- Email: sgf@sourcegoodfood.com
- Discord: govdiw006
If you find these payment plugins helpful, please consider sponsoring the project. Your support helps maintain and improve the plugins for the community.
This project is licensed under the MIT License - see the LICENSE file for details.
- Medusa.js for the amazing e-commerce framework
- All contributors who have helped build and maintain these payment plugins
Medusa.js, Payment Plugins, E-commerce, Razorpay, BTCPay, Bitcoin Payments, Indian Payment Gateway, UPI Integration, Cryptocurrency Payments, Headless Commerce, TypeScript, Open Source, Payment Integration, E-commerce Solutions