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

Przelewy24 payments medusa

Плагин платёжной интеграции Przelewy24 (P24) для Medusa с поддержкой BLIK, карт и общего протокола P24.

npm install @loadreverb/przelewy24-payments-medusa
Категория
Создано
Регионы
Сервис
Версия
0.0.5
Последнее обновление
9 месяцев назад
Ежемесячные загрузки
Загрузка данных

Przelewy24 Payments for Medusa

A comprehensive payment provider plugin that enables Przelewy24 payments on Medusa V2 projects.

Website LinkedIn

Table of Contents

Features

  • Multiple Payment Methods: Supports a wide range of Przelewy24 payment methods including:

    • BLIK (Regular and One-Click)
    • Credit/Debit Cards
    • Bank Transfers
    • White Label Integration
  • Modular Architecture: Multiple services in a single module provider for easy management.

  • Webhook Support: Full support for Przelewy24 webhooks for real-time payment status updates.

  • TypeScript Support: 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 here.

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 modeNo
Frontend URL for customer redirectsNo
Backend URL for webhook notificationsNo

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, you'll need to implement the payment flow according to Przelewy24's and Medusa's documentation. Here's a basic example:

BLIK Payment

BLIK payments use a two-phase flow:

Phase 1: Create Payment Session

Phase 2: Process BLIK Code

Card Payment

General P24 Payment

Supported Payment Methods

The plugin currently supports the following Przelewy24 payment methods:

Payment MethodProvider ID
BLIK
Cards
General P24

Payment Flows

1. BLIK Payment Flow

  1. Phase 1: Frontend creates payment session via
  2. Phase 2: Frontend collects BLIK code (6 digits) from customer
  3. Phase 3: Frontend calls internal API with BLIK code
  4. Phase 4: Backend calls P24 BLIK API to charge the payment
  5. Phase 5: Customer confirms payment on mobile device
  6. Phase 6: P24 sends webhook notification confirming payment
  7. Phase 7: Order is completed

Note: BLIK payments don't use redirect URLs. The entire flow happens through API calls.

2. Card Payment Flow

  1. Customer is redirected to P24 card payment page
  2. Customer enters card details
  3. Payment is processed
  4. Customer is redirected back to store
  5. Webhook notification confirms payment

3. General P24 Flow

  1. Customer is redirected to P24 payment selection
  2. Customer chooses payment method (bank transfer, etc.)
  3. Payment is processed through chosen method
  4. Customer is redirected back to store
  5. Webhook notification confirms payment

Webhook Configuration

Webhook URLs

The plugin provides webhook endpoints for each provider:

  • BLIK:
  • Cards:
  • General:

Return URL

  • Return URL:

Configure these URLs in your P24 merchant panel.

Note: The webhook URLs follow Medusa's pattern: where:

  • is the service's static identifier (e.g., , , )
  • is the package name ()

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 and customization

In case you want to customize and test the plugin locally, refer to the Medusa Plugin docs.

License

MIT License

Contributing

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