monei/sylius-monei-plugin 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

monei/sylius-monei-plugin

Composer 安装命令:

composer require monei/sylius-monei-plugin

包简介

MONEI payment gateway for Sylius — Cards, Bizum, Apple Pay, Google Pay via hosted page or embedded component.

README 文档

README

MONEI

MONEI Payment Plugin for Sylius

Accept payments with MONEI in your Sylius store — Cards, Bizum, Apple Pay, Google Pay.
MONEI is a licensed Payment Institution (Banco de España #6911).

Build Status Latest Stable Version License Sylius Version PHP Version

Features

  • Two integration modes — Hosted Payment Page (redirect) or Embedded MONEI Component (JS widget), configurable per gateway in the Sylius admin
  • All MONEI payment methods — Cards (Visa, Mastercard, Amex), Bizum, Apple Pay, Google Pay
  • Full lifecycle support — Capture, Refund (full & partial), Cancel, and Status sync
  • Webhook-driven — Asynchronous payment status updates via signed MONEI webhooks
  • PSD2 / SCA ready — 3D Secure handled automatically by MONEI
  • Official SDK — Built on the monei/monei-php-sdk for reliable API communication and signature verification
  • Multi-language — Admin translations in English, Spanish, Catalan, and French

Requirements

Dependency Version
PHP 8.2+
Sylius 2.1+
Symfony 6.4 or 7.x

Installation

1. Install via Composer

composer require monei/sylius-monei-plugin

2. Register the bundle

If your Sylius project doesn't use Symfony Flex, add the bundle manually:

// config/bundles.php
return [
    // ...
    Monei\SyliusPlugin\MoneiSyliusPlugin::class => ['all' => true],
];

3. Import the plugin routes (optional)

# config/routes/monei.yaml
monei_sylius:
    resource: "@MoneiSyliusPlugin/config/routes.xml"
    prefix: /monei

Payum handles the webhook notify route automatically — no additional route config is needed for basic operation.

4. Configure MONEI in the Sylius Admin

  1. Go to Configuration → Payment methods
  2. Click Create and choose MONEI as the gateway
  3. Fill in your API Key and Account ID (find these at dashboard.monei.com)
  4. Select your preferred Integration Type: Redirect or Embedded Component
  5. Toggle Sandbox mode for testing
  6. Assign the payment method to your desired channels

That's it — your store is now accepting payments via MONEI.

Configuration Reference

Field Description
api_key Your MONEI API key (pk_test_... for sandbox, pk_live_... for production)
account_id Your MONEI account identifier
integration_type redirect (hosted page) or component (embedded MONEI.js widget)
sandbox Enable test mode — no real charges are processed

How It Works

Redirect Flow (Hosted Payment Page)

  1. Customer clicks "Pay" → Sylius creates a MONEI payment via the API
  2. Customer is redirected to MONEI's PCI-compliant hosted page
  3. Customer completes payment (card, Bizum, Apple Pay, Google Pay)
  4. MONEI redirects back to your store's completion URL
  5. MONEI sends a webhook to confirm the final status asynchronously

Component Flow (Embedded MONEI.js)

  1. Customer clicks "Pay" → Sylius creates a MONEI payment via the API
  2. An in-page payment form is rendered using MONEI.js with card input, Bizum, Apple Pay, and Google Pay buttons
  3. Customer completes payment without leaving the page
  4. On success, the customer is redirected to the order confirmation page
  5. MONEI sends a webhook to confirm the final status asynchronously

Webhooks

MONEI uses webhooks to notify your store of payment status changes. The plugin automatically:

  1. Verifies the MONEI-Signature header using the official SDK's signature verification (timestamp-based HMAC-SHA256)
  2. Re-fetches the payment from MONEI's API to prevent spoofing
  3. Updates the Sylius payment status accordingly

Ensure your server is accessible from the internet so MONEI can reach the callback URL.

Testing

# Run all tests
make test

# Run only unit tests
make test-unit

# Static analysis
make analyse

# Code style check
make check

# Auto-fix code style
make fix

Use MONEI sandbox credentials (pk_test_...) and MONEI test cards to test the full flow without real charges.

Architecture

SyliusMoneiPlugin/
├── config/
│   ├── routes.xml                     # Plugin routes
│   └── services.xml                   # Service definitions
├── src/
│   ├── Action/
│   │   ├── CaptureAction.php          # Creates payment, redirect or component
│   │   ├── ConvertPaymentAction.php   # Maps Sylius Payment → MONEI params
│   │   ├── NotifyAction.php           # Processes MONEI webhooks
│   │   ├── RefundAction.php           # Triggers refunds via MONEI API
│   │   └── StatusAction.php           # Maps MONEI status → Sylius status
│   ├── Client/
│   │   └── MoneiApiClient.php         # Thin wrapper around monei-php-sdk
│   ├── DependencyInjection/           # Symfony DI wiring
│   ├── Factory/
│   │   └── MoneiGatewayFactory.php    # Payum gateway factory registration
│   ├── Form/Type/
│   │   └── MoneiGatewayConfigurationType.php  # Admin config form
│   ├── Resolver/
│   │   └── PaymentStatusResolver.php  # Clean MONEI → Sylius status mapping
│   └── Resources/
│       └── translations/              # en, es, ca, fr
└── tests/
    ├── Unit/                          # PHPUnit unit tests
    └── Integration/                   # PHPUnit integration tests

Contributing

Please see CONTRIBUTING.md for details.

License

This plugin is open-sourced software licensed under the MIT license.

Links

monei/sylius-monei-plugin 适用场景与选型建议

monei/sylius-monei-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「payment」 「sylius」 「spain」 「sylius-plugin」 「apple-pay」 「psd2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 monei/sylius-monei-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 monei/sylius-monei-plugin 我们能提供哪些服务?
定制开发 / 二次开发

基于 monei/sylius-monei-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 46
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-12