Открыта бета 1С:ПредприятияОставить заявку
Przelewy24 payments medusa logo

Przelewy24 payments medusa

Плагин платёжной интеграции Przelewy24 (P24) для Medusa с поддержкой BLIK, карт и общего протокола P24. Форк @gmisoftware/przelewy24-payments-medusa с исправлениями расчётов по платежам, канала BLIK и provider-id. Подробнее в FORK.md.

npm install @sawka-tech/przelewy24-payments-medusa
Категория
Создано
Регионы
Сервис
Версия
0.1.3-sawka.7
Последнее обновление
1 месяц назад
Ежемесячные загрузки
Загрузка данных
Przelewy24 Medusa

A comprehensive Przelewy24 payment provider plugin for Medusa.js 2.0 — BLIK, cards, Visa Mobile, and general P24 redirect flows.

npm version License: MIT TypeScript Medusa v2

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

OptionDescriptionRequiredDefault
P24 Merchant IDYes-
P24 POS IDYes-
P24 API KeyYes-
P24 CRC Key for signature verificationYes-
Enable sandbox mode (/ or /)No
P24 channel for card-only registrationNo
P24 method id for Visa MobileNo
Frontend URL for customer redirectsYes-
Backend URL for webhook notificationsYes-

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 MethodProvider IDNotes
BLIKWhite-label, channel 64
CardsWhite-label iframe, channel 4096
Visa MobileRedirect with method
General P24Redirect to P24 method picker

Payment Flows

1. BLIK (white-label)

  1. Create payment session () → ,
  2. Customer enters 6-digit BLIK code
  3. → P24
  4. Customer approves in banking app
  5. Storefront polls until order is created
  6. P24 sends webhook to → verify + capture →

BLIK does not use redirect URLs.

2. Cards (P24 Card 2.0 white-label)

  1. Create payment session → tokenization fields only (, , , ) — no yet
  2. Load , render iframe; regulation checkbox is inside the P24 widget
  3. On Pay: → via postMessage
  4. with → + returns
  5. Browser runs (3DS in merchant UI)
  6. Storefront polls until order is created
  7. P24 webhook → verify + capture

See P24 Card 2.0 docs.

3. Visa Mobile (redirect with pre-selected method)

  1. Create payment session → (P24 includes )
  2. Customer pays on P24 hosted Visa Mobile page
  3. Return to /
  4. Webhook confirms payment

4. General P24 (redirect)

  1. Create payment session →
  2. Customer pays on P24 hosted page
  3. Return to /
  4. Webhook confirms payment

Completion model (all white-label methods)

StepMechanism
Order creationStorefront 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):

MethodWebhook 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

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

License

MIT © GMI Software


Made with ❤️ by gmi.software