Accepting iDEAL, Apple Pay, Bancontact, SOFORT Banking, Creditcard, SEPA Bank transfer, SEPA Direct debit, PayPal, Belfius Direct Net, KBC/CBC, paysafecard, ING Home'Pay, Giropay, EPS, Przelewy24, Postepay, In3, Klarna (Pay now, Pay later, Slice it, Pay in 3), Giftcard and Voucher 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.
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 >= 7.4
- cUrl >= 7.19.4
- Up-to-date OpenSSL (or other SSL/TLS toolkit)
For leveraging Mollie Connect (advanced use cases only), we recommend also installing our OAuth2 client.
The easiest way to install the Mollie API client is by using Composer. You can require it with the following command:
composer require mollie/mollie-api-php
Initializing the Mollie API client, and setting your API key.
$mollie = new \Mollie\Api\MollieApiClient();
$mollie->setApiKey("test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM");
Find our full documentation online on docs.mollie.com.
use Mollie\Api\Http\Data\Money;
use Mollie\Api\Http\Requests\CreatePaymentRequest;
/** @var Mollie\Api\Http\Response $response */
$response = $mollie->send(new CreatePaymentRequest(
description: 'My first API payment',
amount: new Money('EUR', '10.00'),
redirectUrl: 'https://webshop.example.org/order/12345/',
webhookUrl: 'https://webshop.example.org/mollie-webhook/'
));
/** @var Mollie\Api\Resources\Payment $payment */
$payment = $response->toResource();
For an in-depth understanding of our API, please explore the Mollie Developer Portal. Our API documentation is available in English.
For detailed documentation about using this PHP client, see the following guides:
- Endpoint Collections - Learn how to interact with all available API endpoints.
- HTTP Adapters - Information on customizing HTTP communication.
- Idempotency - Best practices and setup for idempotent requests.
- Payments - Comprehensive guide on handling payments.
- Requests - Overview and usage of request objects in the API client.
- Responses - Handling and understanding responses from the API.
- Testing - Guidelines for testing with the Mollie API client.
- Debugging - How to debug API requests and responses safely.
These guides provide in-depth explanations and examples for advanced usage of the client.
The Mollie API client comes with a variety of recipes to help you understand how to implement various API features. These recipes are a great resource for learning how to integrate Mollie payments into your application.
Here are some of the key recipes included:
-
Payments: Demonstrates how to handle various payment scenarios.
-
Customers: Shows how to manage customers and their payments.
-
Subscriptions and Recurring Payments:
For a full list of recipes, please refer to the recipes directory.
These recipes are designed to help you integrate Mollie into your application. Make sure to use your test API keys when testing the integration.
Please see UPGRADING for details.
Would you like to contribute to improving our API client? We welcome pull requests. But, if you're interested in contributing to a technology-focused organization, Mollie is actively recruiting developers and system engineers. Discover our current job openings or reach out.
BSD (Berkeley Software Distribution) License. Copyright (c) 2013-2018, Mollie B.V.
Contact: www.mollie.com — [email protected] — +31 20 820 20 70