mollie

Mollie: Is it possible to update status of the order in a SPA (frontend) after user receives payment link by e-mail?


When the user wants to pay I want to send them an e-mail with the payment link because the e-mail will contain extra information and some documents. However after clicking on pay and receiving the e-mail it might take some time for the user to finally finish the payment.

When the user has finally paid I want to change the status of the order and disable the option to pay again in my frontend. After payment Mollie will call my backend webhook changing the status in the database, but is it possible for my frontend to get a trigger to change update the status?


Solution

  • You have 2 main options:

    1. Use WebSockets to get have your backend notify the front-end about the status change, and replace HTML of the button/reload the page on such trigger.
    2. Allow the user to press the "pay" button, pull the most recent status from Mollie on the backend, and if the user already paid, show the error message.

    It's a UX decision really. Unless you're already using WebSockets in your app, I would stick to showing a simple error message that the bill is already settled to keep things simple.