sylius/mollie-plugin

Mollie payment plugin for Sylius applications.

Fund package maintenance!
sylius

Installs: 1 029

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 10

Forks: 8

Open Issues: 4

Type:sylius-plugin


README

Sylius Logo.

Mollie Payments Plugin

This plugin provides seamless Mollie integration for Sylius stores.

Accept payments through over 20 different methods with Mollie – trusted by over 70,000 businesses in Europe.

Table of Contents

Overview

Screenshot showing payment methods show in shop Screenshot showing payment methods show in admin Screenshot showing payment method config in admin

Mollie is one of the most advanced and developer-friendly payment gateways in Europe. This plugin integrates Mollie into Sylius and is officially certified by Mollie.

Our mission is to create a greater playing field for everyone. By offering convenient, safe world-wide payment solutions we remove barriers so you could focus on growing your business.

Mollie provides a powerful API allowing webshop and app developers to implement over 20 payment methods with ease. Their services are fast, reliable, and constantly innovating the European payments landscape.

Installation

Beware!

This installation instruction assumes that you're using Symfony Flex and Rector. If you don't, take a look at the legacy installation instruction. However, we strongly encourage you to use them, it's much quicker!

1. Require Mollie plugin with composer:

composer require sylius/mollie-plugin:^3.0 --no-scripts -W

2. Add the Mollie rector set:

   # <project_root>/rector.php

   ...
   + use Sylius\SyliusRector\Set\SyliusMollie;

   return static function (RectorConfig $rectorConfig): void {
       ...
   +   $rectorConfig->sets([SyliusMollie::MOLLIE_PLUGIN_30]);
   };

and run it:

vendor/bin/rector

3. Update your database

bin/console doctrine:migrations:migrate

4. Install frontend assets:

bin/console assets:install

Install additional dependencies:

yarn add bazinga-translator intl-messageformat lodash.get shepherd.js@11.0

Build assets:

yarn encore dev # for development
yarn encore production # for production

5. Clear cache:

php bin/console cache:clear

Optional and troubleshooting

  1. [Optional] To allow refunding orders add the RefundPlugin:

    composer require sylius/refund-plugin:^2.0.2 --no-scripts -W

    And follow its installation instructions.

  2. [Optional] Load fixtures:

    bin/console sylius:fixtures:load
  3. [Optional] Add the payment link cronjob:

    * * * * * /usr/bin/php /path/to/bin/console mollie:send-payment-link
  4. [Optional] If you want to use ApplePay, you need to add the domain validation file file to your server at:

    public/.well-known/apple-developer-merchantid-domain-association
    

⚠️ SyliusRefundPlugin Troubleshooting

If you encounter an error related to duplicate transitions in the sylius_refund_refund_payment state machine (e.g. multiple "complete" transitions from "new" state),
you should remove the following file from your project:

config/packages/sylius_refund.yaml

You should remove it if your project does not use Symfony Workflow

Sylius API

In order to create Mollie payment with Sylius API, the following steps must be followed:

  • send the following request to the Sylius API in order to retrieve Mollie payment method configuration: /api/v2/shop/orders/{tokenValue}/payments/{paymentId}/configuration
  • tokenValue represents order token which is saved in the sylius_order DB table
  • response from this endpoint should be in the following format:
{
  "method": "ideal",
  "issuer": "ideal_ABNANL2A",
  "cardToken": null,
  "amount": {"value":"18.75","currency":"EUR"},
  "customerId": null,
  "description": "000000157",
  "redirectUrl": "{redirect_url}",
  "webhookUrl": "{webhook_url}",
  "metadata": {"order_id":170,"customer_id":22,"molliePaymentMethods":"ideal","cartToken":null,"saveCardInfo":null,"useSavedCards":null,"selected_issuer":"ideal_ABNANL2A","methodType":"Payments API","refund_token":"{token}"},
  "locale": "en_US"
}
  • create the payment on Mollie, using Mollie API. Response from the above-mentioned step should be put in the request body. Request should be sent to the POST: https://api.mollie.com/v2/payments. Bearer token should be sent in the request authorization header. Token can be copied from the Mollie admin configuration page.

  • after payment has been created, API response will contain checkout field. User should enter this url in the browser.

{
  "checkout": 
    {
    "href": "https://www.mollie.com/checkout/test-mode?method=ideal&token=6.voklib",
    "type": "text/html"
}}
  • open checkout url in the browser and complete the payment

Usage

During configuration, first save the keys to the database and then click "Load methods".

Security issues

If you think that you have found a security issue, please do not use the issue tracker and do not post it publicly. Instead, all security issues must be sent to security@sylius.com

Community

For online communication, we invite you to chat with us & other users on Sylius Slack.