我使用以下代码在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'
)));
我得到的答复如下:
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
)
但是,无论何时发出订单,我都没有从BigCommerce获得https://bigcommerce.example.com/order的任何回调。该网站拥有有效的SSL。有什么想法吗?
答案 0 :(得分:1)
ClientID& ClientSecret?
我假设您使用标准(现在是旧的)身份验证而不使用OAuth进行集成? webhooks需要OAuth(参见文档)。
我知道您拥有HTTPS,但您还需要来自受信任CA的有效证书。 (仅提及,因为它通常是一个问题)