How to set up multi-channel merchants notifications for Mollie
In this guide, you'll learn how to intercept all payment status updates and send notifications over multiple channels so you track all the payments made on your platform
You'll learn how to create a flow that sends WhatsApp and SMS notifications for all payment updates that move to the paid status. We’ll be using Flow Builder’s inbound webhook capabilities coupled with Mollie’s payment webhook functionality.
Requirements
Note: In this guide we have been listening to the payments webhook; however, we can easily replace that with the Orders API, in which case we would need to adapt the flow to the order states (authorized or paid).
Defining the webhook on the FlowBuilder side
The Mollie payments API provides you with the possibility of defining a webhook URL whenever a payment is created — a webhook will be invoked every time the payment’s status changes.
To guarantee security, the webhook will only receive the payment ID as a parameter. We will do a lookup on the actual payment information to determine what the payment status is.
Go to Flow Builder and create a new flow.
Select Webhook as the trigger of your flow.
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-7432909e93e5b2c3242b56077b7451dac39f4226%252Fimage13.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=2c86694&sv=1)
The webhook will only have id as a parameter.
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-caba4772183d8c49cc68bf083de5e72f69ee85f1%252Fimage2.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=bcc98356&sv=1)
Add an End flow step so that we can get the webhook URL.
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-176403b10b26fe6487d0cea2552f2e6dfbdd041a%252Fimage14.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=c953750a&sv=1)
Save and Publish your flow in the top right corner of your screen. Once you do, you will receive the webhook address.
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-4f983116e89039d5957a8d0ab68d0b85f35755e5%252Fimage9.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=b16e237c&sv=1)
In the CURL example above, the id will be the only recognized parameter from the payload sent to the URL. If you send it additional parameters, they will be discarded.
Connecting the webhook to the payment
To create a payment with Mollie, pass this URL as the webhook parameter, so that you get the payment notification inside the flow you just created:
In the CURL example above, the webhookUrl points to the webhook you just configured with MessageBird.
In this payment example code, we are passing the Mollie test API key from the account you want to connect to. Once this flow is fully validated, we should pass the Live account API key from Mollie's Dashboard:
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-b571e7468eb588de547732a5431628c23cef983e%252Fimage8.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=af96960a&sv=1)
Looking up payment information on Mollie
When the webhook URL is called we need to retrieve the payment information from Mollie, and extract the necessary data from the payload. To make this happen:
Add a Fetch Variables step to your flow that points to the /get-payment endpoint of your Mollie installation.
Configure this step as follows:
URL:
Where the {id} is the parameter received by the webhook
Method: GET
Add the authentication header to the request, passing again your Mollie test API key
Key: Authorization
Value: Bearer test_VkW7f9CVGqzGrGk6WFy1ARgFjGT292
Variables: We will extract from the response returned by the /get-payments URL the information for the notifications. Since we are dealing with JSON data, we will refer to the key by its name and when dealing with hierarchies of data will use . (dot) to move to the next level:
status
description
amount.value
amount.currency
The final setup should look like this:
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-cd3d44c2901abddd3b2b907c79b0ce18278b886e%252Fimage7.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=4ccbe23&sv=1)
And the variables should look like the following:
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-22b031d8174f28de3ea8e21220bf6d72bbad844b%252Fimage12.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=4a97a428&sv=1)
Done? Awesome! Now it's time to send the extracted information to the interested parties.
Setting up channels for communication
To send notifications, we will define the communication channels - for this example, we will use the SMS channel and WhatsApp Sandbox channel.
To active the SMS channel, go to your Channels in the MessageBird Dashboard.
To enable the WhatsApp sandbox, go to this dedicated page
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-ab5ac8651b274234f1a6696692b2f0665f611f21%252Fimage1.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=5448668&sv=1)
You can add Facebook Messenger, Line, WeChat, email, Telegram and Instagram as additional channels!
Channel limitations
Every channel has platform-specific rules and might require a separate authorization procedure as well as its own messaging policy. For WhatsApp, you need to define and get a Template Message approved to send unsolicited messages.
For this demo, we assume that you can freely send a message on the channel, without having to resort to templates. Make sure to read the documentation to understand what you can do for each particular channel.
Sending conversation messages based on payment statuses
Now that the channels are defined, it is time to add a couple of Send conversations message steps to the flow. We will add two notifications:
We will always send all the order information over a WhatsApp message, such as “{status} {amount.value} {amount.currency} {description}” which would translate at run time to “created 10 EUR bookshelf 10A”.
We will send a message over SMS only if the status of the payment switched to paid.
For both notifications, the Send conversations message step will be configured with type Text and the recipient will be the telephone number/WhatsApp number you would like to send the notification to.
The final flow looks like this:
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-82c67f40126c67d28a932b0338ae5594a6f4a6bd%252Fimage6.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=892a8d8c&sv=1)
The first Send conversation message configuration:
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-f93ec204bec4eac7cd34c4037f70b3e292d20729%252Fimage11.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=86a7243c&sv=1)
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-3440871537959d7359efd5f627c674baf8dd8ad8%252Fimage10.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=8c622a2c&sv=1)
The second Send conversation message configuration:
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-aef06f2317affa7d05abd90e2310645864c83aa8%252Fimage19.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=dd8e475c&sv=1)
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-b589de9af9a7ca7a97fb33728c8c1459f378c89c%252Fimage16.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=6b979781&sv=1)
Connecting notifications to your existing checkout flow
You might already have an existing webhook attached to the payments or orders API. In that case, you might like to maintain that functionality:
At the end of the flow you can add an HTTP request step, which will make one last call to your existing webhook, passing the payment id as a parameter (the same payload you would have received from Mollie callback).
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-28ed03a34babd8560cc3fdd669c9460f99ecd95c%252Fimage20.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=9d489884&sv=1)
The content of the HTTP Request step is a POST towards your existing webhook, with a JSON payload that contains the request ID.
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-c2b0f7791652847f8820d51b98475f432905022e%252Fimage18.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=ad9e314&sv=1)
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-01ef1e4e76c7f033972e18ebdc1451311ddaf3e1%252Fimage3.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=5df1835e&sv=1)
Testing and debugging
If you want to validate and test the logic of the flow, you can use the Test flow functionality, which will start up the Emulator and allow you to define custom payloads for each call and response.
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-7151ec71443b73b4ea7138a7d90ff9c7700ed044%252Fimage4.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=979af89&sv=1)
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-3ce987d56b6361b994769406e1963187022cb54f%252Fimage5.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=ac3da618&sv=1)
Going live
Once the flow is up and running, every time a payment changes status, you will receive notifications via WhatsApp and when a payment goes to status paid, you will also get an SMS.
![](https://docs.bird.com/~gitbook/image?url=https%3A%2F%2F675349995-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FUJNEE9TMK4fU91VKstBr%252Fuploads%252Fgit-blob-528a828329c0517f4a3b068d2003afd2c28f3c1b%252Fimage17.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=ec92c879&sv=1)
Last updated