Przelewy24 payments medusa
Плагин платёжной интеграции Przelewy24 (P24) для Medusa с поддержкой BLIK, карт и общего протокола P24. Форк @gmisoftware/przelewy24-payments-medusa с исправлениями расчётов по платежам, канала BLIK и provider-id. Подробнее в FORK.md.
A comprehensive Przelewy24 payment provider plugin for Medusa.js 2.0 — BLIK, cards, Visa Mobile, and general P24 redirect flows.
Features • Installation • Configuration • Usage • Payment Flows • Webhooks
Features
- ✅ Multiple Payment Methods — BLIK (regular and one-click), credit/debit cards, Visa Mobile, bank transfers, and general P24 redirect
- ✅ White-Label Integration — Card 2.0 iframe and BLIK charge flows without leaving your storefront
- ✅ Webhook Support — Real-time payment status updates with signature verification
- ✅ Modular Architecture — Multiple services in a single module provider for easy management
- ✅ TypeScript — Full TypeScript implementation with proper types
- ✅ Sandbox Mode — Built-in sandbox support for testing
Предупреждение
This plugin has not been tested on a live store. Please conduct thorough testing before using it in a production environment. GMI Software is not responsible for any missed or failed payments resulting from the use of this plugin. If you encounter any issues, please report them on the GitHub issues tracker.
Prerequisites
- Medusa server v2.4.0 or later
- Node.js v20 or later
- A Przelewy24 merchant account with API credentials
Примечание
You can get your API credentials from your Przelewy24 merchant panel.
Installation
Configuration
Add the provider to the module in your file:
Configuration Options
| Option | Description | Required | Default |
|---|---|---|---|
| P24 Merchant ID | Yes | - | |
| P24 POS ID | Yes | - | |
| P24 API Key | Yes | - | |
| P24 CRC Key for signature verification | Yes | - | |
| Enable sandbox mode (/ or /) | No | ||
| P24 channel for card-only registration | No | ||
| P24 method id for Visa Mobile | No | ||
| Frontend URL for customer redirects | Yes | - | |
| Backend URL for webhook notifications | Yes | - |
Environment Variables
Create or update your file with the following variables:
Usage
Once installed and configured, the Przelewy24 payment methods will be available in your Medusa admin. To enable them, log in to your Medusa Admin, browse to Settings > Regions, add or edit a region and select the desired P24 providers from the dropdown.
Make sure that the selected payment methods are enabled in your Przelewy24 merchant panel as well.
Client-Side Integration
To integrate with your storefront, implement the payment flow according to Przelewy24's and Medusa's documentation. Here are basic examples:
BLIK Payment
BLIK payments use a two-phase flow:
Phase 1: Create Payment Session
Phase 2: Process BLIK Code
Legacy route remains as a deprecated wrapper.
Card Payment 2.0 (white-label iframe)
Per P24 Card Payment 2.0 docs:
Visa Mobile (redirect with pre-selected method)
Transaction status (poll timeout fallback)
General P24 Payment
Supported Payment Methods
| Payment Method | Provider ID | Notes |
|---|---|---|
| BLIK | White-label, channel 64 | |
| Cards | White-label iframe, channel 4096 | |
| Visa Mobile | Redirect with method | |
| General P24 | Redirect to P24 method picker |
Payment Flows
1. BLIK (white-label)
- Create payment session () → ,
- Customer enters 6-digit BLIK code
- → P24
- Customer approves in banking app
- Storefront polls until order is created
- P24 sends webhook to → verify + capture →
BLIK does not use redirect URLs.
2. Cards (P24 Card 2.0 white-label)
- Create payment session → tokenization fields only (, , , ) — no yet
- Load , render iframe; regulation checkbox is inside the P24 widget
- On Pay: → via postMessage
- with → + returns
- Browser runs (3DS in merchant UI)
- Storefront polls until order is created
- P24 webhook → verify + capture
See P24 Card 2.0 docs.
3. Visa Mobile (redirect with pre-selected method)
- Create payment session → (P24 includes )
- Customer pays on P24 hosted Visa Mobile page
- Return to /
- Webhook confirms payment
4. General P24 (redirect)
- Create payment session →
- Customer pays on P24 hosted page
- Return to /
- Webhook confirms payment
Completion model (all white-label methods)
| Step | Mechanism |
|---|---|
| Order creation | Storefront polls ; Medusa queries P24 API; or (Medusa, every 2 min) when payment is already captured |
| Capture + | P24 webhook to , or job (every 5 min) |
Do not add a separate store “confirm” route to replace webhooks. Production capture is webhook-driven.
Webhook Configuration
Webhook URLs (auto-registered)
On each , the plugin sets:
urlStatus: {backend_url}/hooks/payment/{service-identifier}_{payment-module-id}With config (recommended):
| Method | Webhook URL |
|---|---|
| Cards | |
| BLIK | |
| Visa Mobile | |
| General |
Medusa route: → → .
- must be the Medusa server URL (public HTTPS in production), not the storefront.
- Webhooks are registered per transaction; you do not paste these into the P24 panel for white-label flows.
- Return URL for redirects: (and cart-specific in session data).
Production checklist
- reachable from the internet (P24 cannot call )
- matches merchant panel (signature verification)
- P24 webhook source IPs allowed (see ; sandbox allows localhost)
- Region enables correct providers
Local development
Without a tunnel, webhooks will not arrive. Orders may still be created via poll , but can remain until the reconcile job runs (~5 min). Use ngrok + public for full webhook testing.
Extending the Plugin
To add support for additional Przelewy24 payment methods, create a new service in that extends the class:
Make sure to replace with the actual Przelewy24 payment method ID.
Export your new service from . Then add your new service to the list of services in .
Local Development
To customize and test the plugin locally, refer to the Medusa Plugin docs.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
License
MIT © GMI Software
Made with ❤️ by gmi.software

