我使用以下代码在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.有任何想法吗?
客户端 ID 和客户端秘密?
我假设您正在使用标准(现在是旧的)身份验证,而不是使用 OAuth 进行集成?Webhooks 需要 OAuth(请参阅文档)。
我知道您有 HTTPS,但您还需要来自受信任 CA 的有效证书。(仅提及,因为这是一个常见问题)
| 归档时间: |
|
| 查看次数: |
850 次 |
| 最近记录: |