如何在沙箱中检查Webhook for Squareup付款网关

时间:2018-11-12 12:03:43

标签: api curl webhooks square-connect

当用户使用PHP CURL付款时,我正在尝试实现Webhook侦听器。 这是我的代码

$ch = curl_init();
$data = array(
"[\"PAYMENT_UPDATED\"]",
);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer sandbox-12346789899", "Content-type: application/json\r\n"));
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_URL, "https://connect.squareup.com/v1/my_sandbox-location_id/webhooks");
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);

但是我收到 Connect V1 API端点不支持沙盒错误。请帮助我如何使用我的沙盒帐户测试付款通知网络挂钩。

1 个答案:

答案 0 :(得分:0)

Webhooks在V1端点的域之内,因此您目前无法在沙箱中对其进行测试。但是,您可以使用生产凭证以伪造现金付款测试它们。