Shopify Webhook的订单履行多次触发回拨URL

时间:2017-03-24 13:22:00

标签: javascript php arrays shopify

我已在订单履行webhook中设置了回拨网址。

现在我已将以下代码放在PHP应用程序中:

$webhookContent = "";
$webhook = fopen('php://input', 'rb');
while (!feof($webhook)) {
    $webhookContent. = fread($webhook, 4096);
}
fclose($webhook);

现在当我生成任何订单和履行时,那么订单履行的Webhook会多次触发回拨网址,那么如何一次点火?

1 个答案:

答案 0 :(得分:1)

当Webhook调用没有从回调URL获得成功响应时会多次触发。您可以在执行所需功能后尝试退出。这将是这样的: -

$webhookContent = "";
$webhook = fopen('php://input', 'rb');
while (!feof($webhook)) {
    $webhookContent. = fread($webhook, 4096);
}
fclose($webhook);
exit;