Custom payments
Custom payments provider for Medusa v2
@juspay-tech/medusa-custom-payments
Custom payments provider plugin for Medusa v2. Enables payment processing through multiple connectors — Stripe, Adyen, PayPal, GlobalPay, Braintree, Cybersource, and Mollie — via a single Prism-powered provider.
Powered by Hyperswitch Prism, an open-source unified connector service (UCS) that abstracts connector-specific APIs behind a single interface.
Compatibility
| Requirement | Version |
|---|---|
| Medusa | |
| Node.js | |
| Framework | Medusa v2 |
Installation
Setup
1. Environment variables
2. Register providers in
3. Assign providers to regions
In the Medusa Admin, assign each provider to the regions where it should be available.
4. Switch to production
Change per provider when going live:
5. Start the backend
npx medusa developPlugin Options
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
| Yes | — | , , , , , , | ||
| Yes | — | Connector-specific credentials (see examples above) | ||
| No | or | |||
| No | Auto-capture on authorization |
Connector Credentials Reference
| Connector | Required fields in |
|---|---|
| , (optional — surfaced to the storefront) | |
| , , (optional Adyen client key — surfaced to the storefront) | |
| , , (optional) | |
| , | |
| , | |
| , , | |
Each credential value is provided as to support secret manager integrations.
Connector Support Matrix
| Connector | Authorize | Capture | Void | Refund | Webhook |
|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ✅ | |
| — | ✅ | ✅ | ✅ | ✅ | |
| ✅ | ✅ | ✅ | ✅ | ○ | |
| — | ✅ | ✅ | ✅ | ○ | |
| ✅ | ✅ | ✅ | ✅ | ○ | |
| ✅ | ✅ | ✅ | ✅ | ○ | |
| ✅ | ✅ | ✅ | ✅ | ○ |
Legend
| Symbol | Meaning |
|---|---|
| ✅ | Supported |
| ○ | Not supported — state driven by synchronous flows |
| — | Not a separate step: connector captures funds immediately at authorize time (); payment goes straight to CAPTURED so only Refund is available afterward |
Authorize result by connector
- , , , , → payment lands as AUTHORIZED (funds reserved; Capture or Void available next)
- , → payment lands as CAPTURED (funds collected immediately; Refund only)
Note: All flows in the matrix above are tested and verified under the sandbox / test environment of each connector. Production behavior should be validated separately before go-live.
Webhooks
All webhook processing goes through the hyperswitch-prism connector service () — this provider contains no connector-specific webhook parsing or signature code.
Webhook URL pattern:
- Medusa:
| Connector | Webhook events | Source verification | value |
|---|---|---|---|
| payment + refund | HMAC-SHA256 | Hex HMAC key from Customer Area → Webhooks → Additional settings (required) | |
| payment + refund + dispute | PayPal API | Webhook ID from the developer dashboard (required) | |
| , , , , | not supported | — | unused |
For unsupported connectors, incoming webhooks are acknowledged and ignored (); payment state is driven by the synchronous flows ( / ).
Verification is mandatory
Webhook events that cannot be source-verified are always rejected — in development and production alike. There is no bypass option:
- Without a configured , adyen/paypal webhooks are rejected before reaching the connector service.
- An event whose signature fails verification (wrong key, tampered payload, forged request) is acknowledged but never mapped to a payment action.
Setup
Adyen — in the Customer Area create a Standard webhook pointing at your webhook URL, generate an HMAC key under Additional settings, and configure it (hex string, exactly as displayed) as . Set in your environment.
PayPal — in the developer dashboard create a webhook for your app pointing at your webhook URL, then configure the generated webhook ID as . Set in your environment.
Configuration example
The webhook URL is derived from the provider you set in . With , a provider registered as is reachable at:
{backend_url}/hooks/payment/hyperswitch-prism_adyen1. Add the secrets to your environment
2. Pass in the provider options ()
3. Register the URL at the connector dashboard
| Connector | Provider | Webhook URL to register |
|---|---|---|
| Adyen | ||
| PayPal |
Local development — connector dashboards must reach your backend over the public internet. Expose your local server with a tunnel (e.g. ) and register the tunnel URL, for example .
The connector is taken from each provider's
Note: Adyen refunds are asynchronous — the REFUND webhook is the settlement confirmation and is logged by the provider (Medusa has no refund webhook action, so it is acknowledged as ).
Test Cards
Stripe
| Card Number | Expiry | CVV |
|---|---|---|
Adyen
| Card Number | Expiry | CVV |
|---|---|---|
GlobalPay
| Card Number | Expiry | CVV |
|---|---|---|
PayPal
| Card Number | Expiry | CVV |
|---|---|---|
Storefront Integration
For React/Next.js storefront integration, see the companion package .
License
Apache-2.0

