Getting started with Mollie Connect
With Mollie Connect, you can connect multiple Mollie accounts together. See the overview for more information.
Most of the functionality of Mollie Connect leverages the open standard OAuth. This guide will explain how you can register your OAuth app and how to connect your users to it.
Understanding the OAuth authorization flow
To support OAuth with your app, you must implement the common OAuth authorization flow. The flow starts with a Connect with Mollie button, and if all goes well, at the end of it you will have received an access token. With this token, your app will be able to communicate with the Mollie API on behalf of the user.
The authorization flow looks roughly as follows.
Building an OAuth-compatible app
Next, you will have to build an app that supports the authorization flow detailed above. For many programming languages there are open source packages available with detailed instructions to help you implement the flow.
Some examples:
- Simple OAuth2 for Node.js
- The PHP League’s OAuth 2.0 Client for PHP
- Authlib for Python, with support for common web frameworks like Flask and Django
If your application is built with PHP, you can integrate it using the official mollie/oauth2-mollie-php package. The official Python client even supports OAuth out of the box.
Once you have an OAuth compatible app running, let’s register your app at Mollie next.
Registering your app
Use the details below to configure your app to work with our platform.
- Client ID: received upon app registration
- Client Secret: received upon app registration
- Redirect URL: a URL within your app that processes authorizations
- Authorization URL:
https://my.mollie.com/oauth2/authorize
, see the Authorize endpoint - Access token URL:
https://api.mollie.com/oauth2/tokens
, see the Tokens endpoint - Resource owner URL:
https://api.mollie.com/v2/organizations/me
, see Get organization
Getting a merchant’s consent
After having implemented OAuth and having registered your app at Mollie, you can send your user to Mollie through the default authorization URL as configured in your app. Good practice is to show a Connect with Mollie button, which redirects the merchant to the authorization screen (i.e., the Authorize endpoint).
Connect button
To integrate a Mollie Connect button into your website, you can either design the button in your own style or use the pre-generated code snippet provided below.
<!-- Mollie Connect Button -->
<style>
.mollie-button {
display: inline-flex;
align-items: center;
padding: 8px 16px;
background-color: #fff;
color: #000;
border: 1px solid #e0e0e0;
border-radius: 6px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
font-size: 16px;
font-weight: 500;
text-decoration: none;
cursor: pointer;
transition: border-color 0.3s ease;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.mollie-button:hover {
border-color: #b0b0b0;
}
.mollie-logo {
height: 14px;
margin-left: 8px;
}
</style>
<a href="YOUR_MOLLIE_AUTHORIZE_ENDPOINT" class="mollie-button">
Connect with
<svg class="mollie-logo" viewBox="0 0 320 94" fill="#000000" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M289.3,44.3c6.9,0,13.2,4.5,15.4,11h-30.7C276.1,48.9,282.3,44.3,289.3,44.3z M320,60.9c0-8-3.1-15.6-8.8-21.4 c-5.7-5.8-13.3-9-21.3-9h-0.4c-8.3,0.1-16.2,3.4-22.1,9.3c-5.9,5.9-9.2,13.7-9.3,22c-0.1,8.5,3.2,16.5,9.2,22.6 c6.1,6.1,14.1,9.5,22.6,9.5h0c11.2,0,21.7-6,27.4-15.6l0.7-1.2l-12.6-6.2l-0.6,1c-3.1,5.2-8.6,8.2-14.7,8.2 c-7.7,0-14.4-5.1-16.5-12.5H320V60.9z M241.2,19.8c-5.5,0-9.9-4.4-9.9-9.9c0-5.5,4.4-9.9,9.9-9.9s9.9,4.4,9.9,9.9 C251.2,15.3,246.7,19.8,241.2,19.8z M233.6,92.7h15.2V31.8h-15.2V92.7z M204.5,1.3h15.2v91.5h-15.2V1.3z M175.4,92.7h15.2V1.3h-15.2 V92.7z M135.3,79c-9.2,0-16.8-7.5-16.8-16.7c0-9.2,7.5-16.7,16.8-16.7s16.8,7.5,16.8,16.7C152.1,71.5,144.6,79,135.3,79z M135.3,30.5c-17.6,0-31.8,14.2-31.8,31.7S117.8,94,135.3,94c17.5,0,31.8-14.2,31.8-31.7S152.9,30.5,135.3,30.5z M70.4,30.6 c-0.8-0.1-1.6-0.1-2.4-0.1c-7.7,0-15,3.1-20.2,8.7c-5.2-5.5-12.5-8.7-20.1-8.7C12.4,30.5,0,42.9,0,58v34.7h14.9V58.5 c0-6.3,5.2-12.1,11.3-12.7c0.4,0,0.9-0.1,1.3-0.1c6.9,0,12.5,5.6,12.5,12.5v34.6h15.2V58.4c0-6.3,5.2-12.1,11.3-12.7 c0.4,0,0.9-0.1,1.3-0.1c6.9,0,12.5,5.6,12.6,12.4v34.7h15.2V58.5c0-7-2.6-13.6-7.2-18.8C83.7,34.4,77.3,31.2,70.4,30.6z"/>
</svg>
</a>
When you send a merchant to the authorization screen, Mollie will tell the merchant what data your app has requested access to and request the merchant to confirm the authorization. An example authorization is shown below.
See OAuth: Permissions for a complete list of available permissions you can request from your user.
Working with access tokens
The merchant will be redirected back to your app, along with an auth code. With the auth code, you can retrieve an access token using default OAuth library functionality.
Note access tokens are time-limited — you need to refresh them periodically using the refresh token. The time limits are listed below.
Tokens | Limit |
---|---|
Auth code | 30 seconds |
Access token | 1 hour |
Refresh token | Does not expire automatically |
Once you have the access token, use the Get current organization to see which organization is authenticated to your app. This endpoint also allows you to retrieve the merchant’s preferred locale. It is recommended to switch your app’s locale to the merchant’s locale after the OAuth flow.
Using the access token on the Mollie API, your app may now access the merchant’s account data, allowing the merchant to start using your app.
Updated about 2 months ago