我正在尝试在安装我的 shopify 应用程序时创建一个 webhook(订单/创建),但我无法使其工作。尝试创建 webhook 时,我收到错误“无法处理的实体”。以下是我目前正在使用的代码。你能帮我解决这个错误吗?
if (isset($_GET['code'])) {
$shopifyClient = new ShopifyClient($_GET['shop'], "", API_KEY, SECRET);
session_unset();
$_SESSION['token'] = $shopifyClient->getAccessToken($_GET['code']);
if ($_SESSION['token'] != '')
$_SESSION['shop'] = $_GET['shop'];
$shopifyClient = new ShopifyClient($_GET['shop'], $_SESSION['token'], API_KEY, SECRET);
$charge = array("webhook"=>array("topic"=>"orders/create","address"=>"http://localhost/xxxxx/test.php","format"=>"json"));
try
{
$webhooks = $shopifyClient->call('POST','/admin/webhooks.json',$charge);
} catch(Exception $e){
//do something with the Exception
echo $e->getMessage();
exit;
}
header("Location: http://localhost/xxxxx/index.php");
exit;
}