Hi, Square!
I am using the payment.updated
webhook to tell my app when a successful payment is completed. However, I noticed that it sends 2 responses: one includes processing fee; the other doesn’t. Otherwise, they are identical except for version
number and event_id
. This is causing my app to duplicate data.
Is there a way to tell Square to send only one response or perhaps do I need to somehow instruct my app to only accept one (which I will need to figure out how)?
Thank you.
This is the expected behavior since the payment was updated with the fees. There isn’t a way to just send one event unless you instead listen for payment.created
. There will alway be one event created with this webhook.
But payment.created doesn’t tell me when a payment is successfully completed, does it?
That is true. You can have a function that validates and then ignores all subsequent events with that matching ID unless it’s a change you want to listen too.
@Bryan-Square, wouldn’t you ask @Cinji18 if there is time enough between those 2 notifications for his/her system to save the 1st one and then compare the 2nd one? and ignore one or the other? if the answer is that those 2 notifications are sent simultaneously, well, it’s the same issue affecting everybody else? no system will be able to do what you suggest without having to implement some kind of webhook queueing system, load balancing or throttling system, that I’m pretty sure no small business have resources to acquire/setup, to be able to log and analyze multiple webhook notifications that arrive at the same time for basically the same events? this issue seems to be affecting many Square developers but nobody seems to be noticing? and trying to find solutions?