下面是我的代码。
define('SHOPIFY_APP_SECRET', 'xxxxxxxxxx');
function verify_webhook($data, $hmac_header)
{
$calculated_hmac = base64_encode(hash_hmac('sha256', $data, SHOPIFY_APP_SECRET, true));
return hash_equals($hmac_header, $calculated_hmac);
}
$hmac_header = $_SERVER['HTTP_X_SHOPIFY_HMAC_SHA256'];
$data = file_get_contents('php://input');
$verified = verify_webhook($data, $hmac_header);
echo "<pre>";
print_r($data);
exit;
?>
我已经注册了该应用程序/未安装的Webhook。因此,这是我的代码,但未收到任何响应
我知道这是一个迟来的答案。但是可能对将来登陆这里的未来用户有所帮助。您忘记将从response
中获得的uninstall webhook
保存到某个地方。考虑将response
保存到文件。这是要保存的php代码。保存响应后,您可以随后阅读或进行处理。