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.
If you have any questions about integrating our API, please contact us. We’re happy to help!
Clients, modules and plugins¶
Of course we also provide modules and plugins for about every web shop software out there.
Mollie is always adding new payment methods. The Mollie API currently supports these payments methods:
- Bank transfer
- Belfius Pay Button
- Credit card (VISA, MasterCard, Maestro and American Express)
- SEPA Direct Debit
- Gift cards (Webshop Giftcard, Podium Cadeaukaart, VVV Cadeaukaart, YourGift etc.)
- ING Home’Pay
- KBC/CBC Payment Button
- SOFORT Banking
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?¶
A customer on your website decides to checkout.
Your website creates a payment on the Mollie platform by calling the Mollie API with the amount, a payment description, a webhook URL, and a URL we should redirect the customer to after the payment is made.
The API responds with the unique id and the
_links.checkoutURL for the newly created payment. Your website stores the
id, links it to the customer’s order and redirects the customer to the URL in the
_links.checkoutproperty from the Mollie API response. This is the URL to the hosted payment page for this specific payment.
The customer reaches the checkout, 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.
In response to your webhook being called your application just needs to issue a
200 OKstatus. From that response Mollie can tell that your processing of the new status was successful – for any other response we keep trying.
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.
At this point Mollie returns the visitor to your website using the
redirectUrlspecified when the payment was created. Your website already knows the payment was successful and thanks the customer.
Connecting orders and payments¶
In the example above we suppose you will 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 by Mollie. 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
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.