This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.
This package is abandoned and no longer maintained. No replacement package was suggested.

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment But

dev-master 2019-02-17 22:39 UTC

This package is auto-updated.

Last update: 2020-01-02 18:06:13 UTC


This is an unofficial PHP 5.3.29+ port of the Mollie PHP library.

It has been made compatible with PHP 5.3.29+ and is kept up to date with the official library.
Guzzle has been swapped out for PHP Curl Class for the HTTP client.


Mollie API client for PHP


Accepting iDEAL, Bancontact, SOFORT Banking, Creditcard, SEPA Bank transfer, SEPA Direct debit, PayPal, Belfius Direct Net, KBC/CBC, paysafecard, ING Home'Pay, Giftcards, Giropay and EPS online payments without fixed monthly costs or any punishing registration procedures. Just use the Mollie API to receive payments directly on your website or easily refund transactions to your customers.

Build Status Latest Stable Version Total Downloads


To use the Mollie API client, the following things are required:

  • Get yourself a free Mollie account. No sign up costs.
  • Now you're ready to use the Mollie API client in test mode.
  • Follow a few steps to enable payment methods in live mode, and let us handle the rest.
  • PHP >= 5.3.3
  • Up-to-date OpenSSL (or other SSL/TLS toolkit)

For leveraging Mollie Connect (advanced use cases only), we recommend also installing our OAuth2 client.

Composer Installation

By far the easiest way to install the Mollie API client is to require it with Composer.

$ composer require mollie/mollie-api-php:^2.0

    "require": {
        "mollie/mollie-api-php": "^2.0"

The version of the API client corresponds to the version of the API it implements. Check the notes on migration to see what changes you need to make if you want to start using a newer API version.

Manual Installation

If you're not familiar with using composer we've added a ZIP file to the releases containing the API client and all the packages normally installed by composer. Download the from the releases page.

Include the vendor/autoload.php as shown in Initialize example.

How to receive payments

To successfully receive a payment, these steps should be implemented:

  1. Use the Mollie API client to create a payment with the requested amount, currency, description and optionally, a payment method. It is important to specify a unique redirect URL where the customer is supposed to return to after the payment is completed.

  2. Immediately after the payment is completed, our platform will send an asynchronous request to the configured webhook to allow the payment details to be retrieved, so you know when exactly to start processing the customer's order.

  3. The customer returns, and should be satisfied to see that the order was paid and is now being processed.

Find our full documentation online on

Getting started

Initializing the Mollie API client, and setting your API key.

$mollie = new \Mollie\Api\MollieApiClient();

Creating a new payment.

$payment = $mollie->payments->create(array(
    "amount" => array(
        "currency" => "EUR",
        "value" => "10.00"
    "description" => "My first API payment",
    "redirectUrl" => "",
    "webhookUrl"  => "",

After creation, the payment id is available in the $payment->id property. You should store this id with your order.

After storing the payment id you can send the customer to the checkout using the $payment->getCheckoutUrl().

header("Location: " . $payment->getCheckoutUrl(), true, 303);

This header location should always be a GET, thus we enforce 303 http response code

For a payment create example, see Example 1 - New Payment.

Retrieving payments

We can use the $payment->id to retrieve a payment and check if the payment isPaid.

$payment = $mollie->payments->get($payment->id);

if ($payment->isPaid())
    echo "Payment received.";

Or retrieve a collection of payments.

$payments = $mollie->payments->page(); 

For an extensive example of listing payments with the details and status, see Example 5 - Payments History.

Payment webhook

When the status of a payment changes the webhookUrl we specified in the creation of the payment will be called.
There we can use the id from our POST parameters to check te status and act upon that, see Example 2 - Webhook verification.


Since 2.0 it is now possible to create non-EUR payments for your customers. A full list of available currencies can be found in our documentation.

$payment = $mollie->payments->create(array(
    "amount" => array(
        "currency" => "USD",
        "value" => "10.00"
    "description" => "Order #12345",
    "redirectUrl" => "",
    "webhookUrl"  => "",

After creation, the settlementAmount will contain the EUR amount that will be settled on your account.

Fully integrated iDEAL payments

If you want to fully integrate iDEAL payments in your web site, some additional steps are required. First, you need to retrieve the list of issuers (banks) that support iDEAL and have your customer pick the issuer he/she wants to use for the payment.

Retrieve the iDEAL method and include the issuers

$method = $mollie->methods->get(\Mollie\Api\Types\PaymentMethod::IDEAL, array("include" => "issuers"));

$method->issuers will be a list of objects. Use the property $id of this object in the API call, and the property $name for displaying the issuer to your customer. For a more in-depth example, see Example 4 - iDEAL payment.

Create a payment with the selected issuer:

$payment = $mollie->payments->create(array(
    "amount" => array(
        "currency" => "EUR",
        "value" => "10.00"
    "description" => "My first API payment",
    "redirectUrl" => "",
    "webhookUrl"  => "",
    "method"      => \Mollie\Api\Types\PaymentMethod::IDEAL,
    "issuer"      => $selectedIssuerId, // e.g. "ideal_INGBNL2A"

The _links property of the $payment object will contain an object checkout with a href property, which is a URL that points directly to the online banking environment of the selected issuer. A short way of retrieving this URL can be achieved by using the $payment->getCheckoutUrl().

Refunding payments

The API also supports refunding payments. Note that there is no confirmation and that all refunds are immediate and definitive. Refunds are only supported for iDEAL, credit card, Bancontact, SOFORT Banking, PayPal, Belfius Direct Net, KBC/CBC, ING Home'Pay and bank transfer payments. Other types of payments cannot be refunded through our API at the moment.

$payment = $mollie->payments->get($payment->id);

// Refund € 2 of this payment
$refund = $payment->refund(array(
    "amount" => array(
        "currency" => "EUR",
        "value" => "2.00"

For a working example, see Example 7 - Refund payment.

API documentation

If you wish to learn more about our API, please visit the Mollie Developer Portal. API Documentation is available in English.

Want to help us make our API client even better?

Want to help us make our API client even better? We take pull requests, sure. But how would you like to contribute to a technology oriented organization? Mollie is hiring developers and system engineers. Check out our vacancies or get in touch.


BSD (Berkeley Software Distribution) License. Copyright (c) 2013-2018, Mollie B.V.


Contact: — +31 20 820 20 70