Hi Square Team,
When I receive Square Loyalty Event webhooks, if the event includes an order_id, I use this order_id to retrieve the order details from Square.
However, I have noticed that sometimes this retrieval throws an “Order Not Found” exception immediately after receiving the webhook. If I retry the same request after some time, I am then able to retrieve the order details successfully.
Could you please help me understand:
- Why does this intermittent “Order Not Found” issue occur after receiving a Loyalty Event webhook?
- Is there a recommended delay or best practice for retrieving the order details after receiving the webhook to avoid this issue?
Thank you in advance for your help.
Best regards,
Murphy
I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:
Additional Documentation
Retrieve Orders
Refunds API Webhooks
Use Customer Webhooks
If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.
Hey @murphyzhang! Webhooks get sent out as part of a number of asynchronous server events, which sometimes results in the webhook being dispatched before all objects within its payload are ready to be retrieved. We recommend implementing a retry system to attempt to re-retrieve objects that have not been found after a few seconds delay.