我正在使用 squareup API .. 我将通知 URL 正确设置到我的应用程序并将其设置为PAYMENT_UPDATED
// setup notifications
$data = array("PAYMENT_UPDATED");
$data_json = json_encode($data);
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, "https://connect.squareup.com/v1/me/webhooks");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_json),
'Authorization: Bearer XXXXXXXXXXXXXXXXXX')
);
curl_setopt($curl, CURLOPT_POSTFIELDS,$data_json);
echo $response = curl_exec($curl);
curl_close($curl);
echo "<pre>";
print_r(json_decode($response,true));
echo "</pre>";
然后我从移动设备付款,然后我收到了一个重复的单次付款请求,其中包含相同的数据:
{"entity_id":"xxxxxxxxxxxx","event_type":"PAYMENT_UPDATED","merchant_id":"xxxxxxxxxxxx","subunit_id":"xxxxxxxx"}
有什么帮助吗?!