Overview

Mollie API: simple & powerful

Use the Mollie API to integrate online payments by Mollie directly into your website or app. Mollie and your website will communicate by sending HTTP requests back and forth.

This page provides an overview of the Mollie API. The topics in the chapter deal with a number of specific aspects of the API. We recommend to read these topics entirely.

If possible it would be wise to leave communication at this level to our ready-made Clients. This allows you to still be in control without reinventing the wheel.

Clients, modules and plugins

Well begun is half done. Save time and build on solid foundations. Mollie API clients are available for PHP, Ruby, Node.js and Python. Of course we also provide modules and plugins for about every webshop software out there.

Payment methods

Mollie is always adding new payment methods. The Mollie API currently supports these payments methods:

All of the payment methods you have enabled are – where relevant – shown to the consumer. You can enable payment methods using the Dashboard.

How does the Mollie API work?

Payment flow Mollie API

  1. A consumer on your website decides to checkout.
  2. Your website creates a payment on the Mollie platform by calling the Mollie API with the amount, a payment description and a URL we should redirect the consumer to after the payment is made.
    The API responds with the unique id and the paymentUrl for the newly created payment. Your website stores the id, links it to the customers order and redirects the consument to the paymentUrl from the Mollie API response. This is the URL to the payment screen for this specific payment.
  3. The consumer reaches the Mollie payment screen, chooses a payment method and makes the payment. This process is entirely taken care of by Mollie. You don't need to do anything here.
  4. When the payment is made Mollie will call your Webhook informing your website about the payments status change. You should define one when creating the payment.
    In response to you webhook being called your website just needs to issue a 200 OK status. From that response Mollie can tell that your processing the new status was successful – for any other response we keep trying.
  5. Processing the webhook request your website fetches the payment status using the Mollie API. This fetched status serves to mark the order as paid, trigger fulfilment and send out an email confirmation to the customer.
  6. At this point Mollie returns the visitor to your website. Your website knows the payment was successful and thanks the consumer.

Connecting orders and payments

In the example above we suppose you'll store the id that's unique to the payment in your order table. This way your website is able to look-up the order for this payment when the Webhook is triggered. Your website is keeping track of the payment, effectively bringing about the connection between order and payment. This approach is easiest to grasp, which is why we use it in our example.

Alternatively you could ask Mollie to remember the unique identifier of your order by instructing the Mollie API to store it in the payment's metadata. You would provide it while creating the payment. In our example order_id would be a good candidate. Mollie stores the metadata for you. When you fetch the payment during processing the webhook the metadata is included in the response. This is another way to connect orders and payments. We advise to use the metadata approach. This is the most popular approach and it's easiest to implement.

Benefits of payments via the Mollie API

  • The payment screens are suitable for web, smartphones and tablets.
  • All payment methods you have enabled are – when relevant – shown to your customers. A newly activated payment method is available immediately for all of your visitors.
  • If the consumer's first choice of payment method is not successful, it's very easy for the consumer to select and try another one. If a consumer appears to not have sufficient credit on a checking account a retry by credit card could easily be attempted. We handle this for you without asking you to implement any extra API's.
  • Mollie optimizes the order of payment methods. For Dutch consumers we know to list iDEAL at the top while for Belgians we start off with the payment method Bancontact. A lot of effort goes into this and we optimize this using A/B-testing. This way we improve your conversion without your effort.