Medusa
Accept payments through MONEI in your Medusa v2 store using the official medusa-payment-monei plugin. All MONEI payment methods are available automatically — Cards, Bizum, PayPal, Google Pay, Apple Pay, , MB Way, Multibanco, and SEPA Direct Debit.
Features
- Full payment lifecycle — Initiate, , , refund (full and partial), and cancel
- Auth + Capture flow — when ready (default), or auto-capture on authorization
- Webhook support — Real-time payment status updates with signature verification
- Multi-payment methods — All MONEI payment methods available automatically
- Two integration modes — Hosted Payment Page (redirect) or embedded MONEI.js components
Requirements
| Dependency | Version |
|---|---|
| Node.js | 18+ |
| Medusa | v2 |
Before you begin
To test your integration:
- Use your test mode API Key. You can find it in MONEI Dashboard → Settings → API Access.
- You can check the status of a test payment in your MONEI Dashboard → Payments (in test mode).
- See MONEI test cards for test card numbers and Bizum phone numbers.
Install
npm install medusa-payment-monei
# or
yarn add medusa-payment-monei
Configure
Step 1: Add to medusa-config.ts
import {defineConfig} from '@medusajs/framework/utils';
export default defineConfig({
// ...
modules: [
{
resolve: '@medusajs/medusa/payment',
options: {
providers: [
{
resolve: 'medusa-payment-monei',
id: 'monei',
options: {
apiKey: process.env.MONEI_API_KEY,
// Optional: auto-capture payments (default: false)
// When false, payments use AUTH + manual capture flow
// When true, payments use SALE flow (captured immediately)
capture: false
}
}
]
}
}
]
});
Step 2: Set environment variables
# .env
MONEI_API_KEY=pk_test_xxxxxxxxxxxxxxxxxxxxx
Step 3: Enable in Medusa Admin
Go to Settings → Regions and enable MONEI for your region(s).
MONEI registers as pp_monei_monei.
Configuration options
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | Your MONEI API key |
capture | boolean | false | Auto-capture payments on authorization |
webhookSecret | string | — | Optional webhook signing secret |
Payment flows
Default: Auth + Capture (recommended)
- Customer selects MONEI → payment is created with
transactionType: AUTH - Customer completes payment on MONEI hosted page or via MONEI.js component
- MONEI sends a webhook with
AUTHORIZEDstatus → order is created - Admin captures the payment from the Medusa dashboard
Card payments must be captured within 7 days, Bizum within 30 days.
Auto-capture (set capture: true)
- Customer selects MONEI → payment is created with
transactionType: SALE - Customer completes payment → funds are captured immediately
- Webhook receives
SUCCEEDEDstatus → order is created
Webhooks
MONEI sends asynchronous webhook notifications to your Medusa server at:
{your_server_url}/hooks/payment/monei_monei
The plugin verifies the MONEI-Signature header using HMAC-SHA256 signature verification.
Configure the in MONEI Dashboard → Settings, or it will be set dynamically during payment creation.
Storefront integration
Option A: Hosted Payment Page (simplest)
After initiating the payment session, the session data contains a redirect_url. Redirect the customer:
const paymentSession = cart.payment_collection?.payment_sessions?.[0];
if (paymentSession?.data?.redirect_url) {
window.location.href = paymentSession.data.redirect_url;
}
Option B: Embedded MONEI.js Components
Use the MONEI JS SDK to embed payment components directly in your checkout:
import monei from '@monei-js/components';
const paymentId = paymentSession.data.id;
// Render card input
const cardInput = monei.CardInput({
paymentId,
onChange: (event) => {
// Handle validation
}
});
cardInput.render('#card-input');
// Tokenize the card, then confirm the payment
const {token, error} = await cardInput.submit();
if (error) {
// Show the error to the customer
return;
}
const result = await monei.confirmPayment({
paymentId,
paymentToken: token
});
Payment methods
All payment methods enabled in your MONEI Dashboard are automatically available:
| Method | Description |
|---|---|
| Cards | Visa, Mastercard, Amex via 3D Secure |
| Bizum | Spain's #1 mobile payment (direct acquiring) |
| PayPal | Global digital wallet |
| Google Pay | Android/Chrome payments |
| Apple Pay | iOS/Safari payments |
| Visa/Mastercard secure remote commerce | |
| BNPL | Buy now, pay later |
| MB Way | Portuguese mobile payments |
| Multibanco | Portuguese bank transfers |
| SEPA DD | Euro direct debit |
Before you go live
- Make sure that you are using live (production) mode API Key.
- Make sure that you have at least one active payment method.