HyperSwitch payment processor plugin for Medusa v2 — unified checkout, webhooks, refunds, and admin configuration.
Medusa v2 payment plugin for HyperSwitch — unified checkout, webhooks, refunds, proxy support, and an admin configuration UI.
Follow these steps in your Medusa store project (the app where you run ), not in this plugin repository.
1npx create-medusa-app@latest my-medusa-store2cd my-medusa-storeFrom your Medusa application root directory, install the plugin:
npm install medusa-payment-hyperswitchOr with another package manager:
1yarn add medusa-payment-hyperswitch2# or3pnpm add medusa-payment-hyperswitchThis installs the plugin and its runtime dependencies (, , , and admin UI packages). Your Medusa app must already satisfy the plugin's peer dependencies.
Local development: To test unpublished changes from this repo, use after running in the plugin repo. See Local plugin development.
Generate a 32-byte key for encrypting secrets stored by the plugin:
openssl rand -base64 32Add it to your :
HYPERSWITCH_HASH_KEY=your-generated-base64-key-hereUpdate :
1import { loadEnv, defineConfig } from "@medusajs/framework/utils"2
3loadEnv(process.env.NODE_ENV || "development", process.cwd())4
5module.exports = defineConfig({6 projectConfig: {7 databaseUrl: process.env.DATABASE_URL,8 http: {9 storeCors: process.env.STORE_CORS!,10 adminCors: process.env.ADMIN_CORS!,11 authCors: process.env.AUTH_CORS!,12 jwtSecret: process.env.JWT_SECRET || "supersecret",13 cookieSecret: process.env.COOKIE_SECRET || "supersecret",14 },15 },16 modules: [17 {18 resolve: "@medusajs/medusa/payment",19 options: {20 providers: [21 {22 id: "hyperswitch",23 resolve: "medusa-payment-hyperswitch/providers/hyperswitch",24 },25 ],26 },27 },28 ],29 plugins: [30 {31 resolve: "medusa-payment-hyperswitch",32 options: {33 key: process.env.HYPERSWITCH_HASH_KEY,34 },35 },36 ],37})1npx medusa db:migrate2npm run devUse this plugin with the storefront repo:
https://github.com/Ayyanaruto/hyperswitch-medusa-storefront
In your storefront project's , set:
1NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=pk_2MEDUSA_BACKEND_URL=http://localhost:90003NEXT_PUBLIC_BASE_URL=http://localhost:80004NEXT_PUBLIC_HYPERSWITCH_KEY=pk_snd_Enable HyperSwitch in the target region
In Medusa Admin:
For reliable payment state updates, configure HyperSwitch webhooks to point to your Medusa backend webhook endpoint and verify events are received in backend logs.
To work on the plugin itself and test it in a Medusa store:
1git clone https://github.com/Ayyanaruto/hyperswitch-medusajs-plugin.git2cd hyperswitch-medusajs-plugin3pnpm install4pnpm build5npx medusa plugin:publishIn your Medusa store:
npx medusa plugin:add medusa-payment-hyperswitchKeep running in the plugin repo during development so changes are republished automatically.
From the plugin repository:
1pnpm build2npm publishThe script runs the build automatically before publish.
MIT