Webhook on create orders called twice.

Valentina5
New Member
12 0 0

Hi, 

I have webhook on create orders. 

{
"id":146780353,
"address":"https:\/\/supperbellapp.info\/api\/events_after_created_order",
"topic":"orders\/create",
"created_at":"2016-01-26T05:52:25-07:00",
"updated_at":"2016-01-26T05:52:25-07:00",
"format":"json",
"fields":[
],
"metafield_namespaces":[
]
},

We added inventory check in our project (in this webhook) and then I noticed, that we sometimes get twice webhook on create orders.

I added check in our code, but can you help me understand reason for error?

Part of my logs in app and my comments herehttps://drive.google.com/open?id=0B703S72xAJ5qdENwWVpQX1JLM0U

 

0 Likes
Josh
Shopify Staff
Shopify Staff
1131 82 191

Hello Valentina, 

It looks like we're occasionally not receiving a response within 5 seconds when sending webhooks to your service. It then times out and assumes that the webhook was not received as per our webhook response guidelines here

More often than not, prioritizing responding to the webhook before actually doing any processing of it helps cut down on occurrences like this pretty drastically. 

0 Likes
Valentina5
New Member
12 0 0

Thank you!

0 Likes
Remie_Malik
Shopify Partner
8 1 0

Dear Josh,

 

How can i send a 200 response back to Shopify?

 

I am using the php as the language to communicate with Shopify.

 

Much appreciated,

 

Kind regards,

 

Remie

0 Likes
ZXDragon360
Tourist
7 0 1

Remie,

 

I believed to response back to Shopify is simply use a header()

A good example is

$data = file_get_contents("php://input");
header
('HTTP/1.1 200 OK');
...
http_response_code(200):

source (https://community.shopify.com/c/Shopify-APIs-SDKs/How-to-send-success-respond-to-webhook-using-PHP/t...)

0 Likes