Payment.update hook sometimes creating duplicate entries

Hello,

I have a question regarding the use of the payment.update hook and if there are any recommendations for our use case. We currently use the payment.update hook to capture any payments made via the POS Mobile API and Terminal API. This works perfectly fine 99% of the time and really we just need the payment id and the fact that the payment has completed. We have though had instances where we get a double payment on our end because of the rapid succession of pings to the hook on a single payment. Through logging on our end we have determine sometimes we receive hits on the hook that happen in the span of less than a second. Now we had a small amount of random delay to help offset this and we have validation on our end to ensure no overpayment, but we are still seeing once in awhile (once every few weeks) that 2 pings manage to get through and due to the speed it results in a double entry into our system.

Through looking at the webhook logs it seems that all the payment.update events (I’ve seen) always have a lack of processing fees on the first update that confirm the payment is complete and then payment fee is added on the next one and subsequent updates. Our proposal to solve this niche problem we are having it to just ignore completed payment updates that have the processing fee field on them. Will this always be the case that the first update does not contain this field?

Thanks

Often time is the fee isn’t calculated on the first event and it won’t be included. If that fits your use case you can definitely ignore the first event if needed. :slightly_smiling_face:

Thank you for your reply, that helps.