I have a webhook for order creation. It fires multiple time. I have already use
header('HTTP/1.1 200 OK');
imidiate after file_get_contents function and
at end of my code.
Is thee any solution which i can use and Shopify only send one time webhook once order created.
I have a solution that is i can store order ID in a table and when webhook fires that time i checked if this order ID already esist in my table or not. if not then proceess else do nothing. But this is only for order creation can not use for update webhook.
So if possible that fire webhook only once this would be great.
When subscribing to 3rd party events such as webhooks (or dealing with anything 3rd party) always develop defensively i.e. assume it ain't so as 3rd party claims it is.
Especially webhooks which are fire and forget and don't have any absolute assurance of being executed, being delivered, being delivered in order or as you noticed are being delivered multiple times.
With that in mind, it is up to you to handle malfunction gracefully. In this particular case a queue would work well as you can easilly dedupe webhook notifications should they occur multiple times.