- Christophe Jossart
Most content from this article might still be relevant but some sections can be outdated.
Mollie provides a facade for several payment methods (credit card, debit card, Paypal, Sepa, Bitcoin, ...) with various languages and frameworks support.
In some cases, you could decide to use the Payment module instead of the full Commerce distribution.
This tutorial describes how to create a product as a node and process payment with Mollie, only via configuration. A possible use case can be an existing Drupal 8 site that just needs to enable a few products (like membership, ...).
Mollie Payment moduleGet the
composer require drupal/mollie_payment
Composer will install the Mollie API client library for you into the vendor directory, so no need to download it into the libraries directory.
Enable the module, it will also enable the Plugin, Currency and Payment modules.
drush en mollie_payment
Enable the Payment Form module (that is shipped with the Payment module).
drush en payment_form
At the time of writing, you will need to use the Payment dev release.
composer require drupal/payment:2.x-dev
Then patch the line items ajax issue.
curl -O https://www.drupal.org/files/issues/fix_ajax-1.patch
patch -p1 < fix_ajax-1.patch
For deploying in other environments, make sure that your main composer.json file contains the patch into the extra section.
"Ajax broken in payment_form submodule": "https://www.drupal.org/files/issues/fix_ajax-1.patch"
If this error is triggered while viewing a line item:
Call to undefined function Drupal\payment\Entity\bcadd() in Drupal\payment\Entity\Payment->getAmount()
or this one while importing a currency:
Error: Call to undefined function Commercie\Currency\bcdiv() in Commercie\Currency\Currency->getRoundingStep()
Composer should warn you about the missing ext-bcmath, but in some situations it can happen that the modules are being required properly but the error occurs at runtime (e.g. your command line php version is 7.0 and your Apache vhost version is 7.1, with a bcmath enabled for 7.0 but not for 7.1).
It can be easily fixed, here we are using php 7.1 on our vhost
sudo apt-get install php7.1-bcmath
# restart your server, here we assume Apache
sudo service apache2 restart
Create a Mollie account
Define the site URL under Contact information. Then define the desired Payment methods.
Configure the Mollie Payment module
Head to /admin/config/services/payment/mollie (or click on Configuration > Web Services > Payment > Mollie Payment).
Create a Mollie profile
Test then the connection under /admin/config/services/payment/mollie/connection-test
Configure the Payment module
Add the Mollie payment method under /admin/config/services/payment/method
Configure the Currency module
Add or import a currency, preferably import it. Here we will use EUR.
If you want to add manually a currency, refer to the following documentation to get the ISO 4217:2015 reference:
Create a product content type
Then add a Payment Form field and configure it.
just set the currency if desired
Create a product
And voilà, here is the result