Hello, I see a forum on this topic from many years ago - not sure if it was resolved. I am sending a test notification for an "Order creation" webhook and always receive TWO from Shopify. They are almost at the same second even though I return a "200 OK" immediately. Approx. 1 minute later ANOTHER one arrives ( all 3 are identical ). Has this been resolved? Should the response from me be just "200 OK" ( 6 characters ) or "200 OK" + Cr + Lf ( 8 characters ). I've tried both, seems to make no difference. I'm not sure if a real order does this, so far only sending a test. Thanks!
To respond back to Shopify webhooks to stop from sending more than once, you need to inform them with using a basic http/https method. In PHP, use a header function to respond back.
Here is an example for PHP at the very top of the code:
$body = file_get_contents("php://input"); header("HTTP/1.1 200 OK"); ... http_response_code(200);
"php://input" is one of the 2 methods which is listening for any data sending to this code and store it. (The second one is php://output, not revelent to this topic) This is what we will expect an incoming webhook from Shopify. And next, when we got it successfully, we want to send back with code 200 to inform we got it. I use a simple header like above. Or, you could do with HTTP/2.0 200. The 1.1 is the old basic HTTP while the 2.0 is secure but tougher to send and receive without pass security or authentication somethings.
Since your situation describes respond back with "200 OK" not work, I assume perhaps there are some steps missing as such http_response_code?