我使用以下代码在BigCommerce中创建了一个webhook:
use Bigcommerce\Api\Connection;
$connection = new Connection();
$connection->setCipher('RC4-SHA');
$connection->verifyPeer(false);
$connection->addHeader('X-Auth-Client', $clientId);
$connection->addHeader('X-Auth-Token', $token);
$response = $connection->post('https://api.bigcommerce.com/stores/' . $hash . '/v2/hooks', json_encode(array(
'scope'=>'store/order/created',
'destination'=>'https://bigcommerce.example.com/order'
)));
Run Code Online (Sandbox Code Playgroud)
我得到的答复如下:
stdClass Object
(
[id] => 568
[client_id] => lms4gxejy2xw2bia7w30v3bal1sz5yz
[store_hash] => xxxxxx
[scope] => store/order/created
[destination] => https://bigcommerce.example.com/order
[headers] =>
[is_active] => 1
[created_at] => 1403762563
[updated_at] => 1403762563
)
Run Code Online (Sandbox Code Playgroud)
但是,无论何时下订单,我都没有收到来自BigCommerce的https://bigcommerce.example.com/order的任何回调.该网站拥有有效的SSL.有任何想法吗?