Mollie webhook being called twice after successful payment + Proposal to stop confusing webhook calls after v2 update.
Related to https://github.com/mollie/api-documentation/issues/300, after v2, I am receiving duplicate calls when a payment is made. The new statuses for payments are super confusing. When we receive a payment webhook call with a tr_xxxxxxx identifier, it's hard to understand if:
- the payment was done
- there was a refund
- there was a chargeback
- the payment was settled/paid/some intermediate paid status
I would like to explain some confusing real life scenarios and propose a change that will remove the ambiguity in Mollie webhook calls.
Some confusing situations:
Scenario 1
Two refunds for the same payment (i.e: 20 and 30 euros from a 100 euros payment). If you issue two refunds for the same payment, for two different amounts, the same day, you will receive two calls and if you ask for the status, it will be paid. So you will have to look for refunds, chargebacks, etc... But you only get the current refund status, not an activity record.
I know I can check for the amountRefunded variable, but it's too complex to keep track of the amounts that were refunded in our backends and store them in our database, and we should not keep track of that information our side. We should be able to know 'what happened', not 'what is the current status'.
Scenario 2
I execute a recurring automatic payment and I get two calls to the webhook. Both of them are "paid" status, and I cannot understand what is the difference between them. No chargebacks or refunds. That forces us to introduce a LOT of complexity in the backend to avoid generating duplicate invoices for the same payment to our customers.
So a proposal
add a "event" webhook. This way, we can get a more detailed and accurate information on why the webhook is called. Not data but activity.
I.E: ev_xxxxxxxx and then after a call to /payments/xxxxx/events/yyyyyy we can get something like:
refund:
{ activity: "refund", amount: {value: -20, currency: "EUR"} }
chargeback:
{ activity: "chargeback", amount: {value: -20, currency: "EUR"} }
status change:
{ activity: "status_change", old: "open", new: "paid" }
settlement (when it's paid to a point where no more paid webhook calls are going to be made and we can deliver the invoice):
{ activity: "payment_settled", amount: { value: 100, currency: "EUR" } }
Happy to discuss about this idea.