猿问

Square API Search user by Email - 旧版 Sandbox 不支持端点

浏览此文档时,我无法弄清楚如何使搜索功能正常工作,并且出现错误:


$json = '{}';

$url = 'https://connect.squareup.com/v2/customers/search';

$curl_handle = curl_init($url);

$request_headers = array();

$request_headers[] = 'Accept: application/json';

$request_headers[] = 'Authorization: Bearer '.$token;

$request_headers[] = 'Content-Length: '.strlen($json);

$request_headers[] = 'Content-Type: application/json';

curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, 'POST');

curl_setopt($curl_handle, CURLOPT_HTTPHEADER, $request_headers);

curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $json);

curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);

if (substr($_SERVER['HTTP_HOST'],0,4) !== 'www.') {curl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);}

$result = curl_exec($curl_handle);

$json_response = json_decode($result,1);

curl_close($curl_handle);

我得到以下信息:


[category] => INVALID_REQUEST_ERROR

[code] => SANDBOX_NOT_SUPPORTED

[detail] => This endpoint is not supported in legacy Sandbox.

Learn more about the new Sandbox at https://developer.squareup.com/docs/testing/sandbox.

我希望能够通过电子邮件地址进行搜索。我尝试在页面上使用 JSON,但仍然收到相同的错误消息。请问有什么想法吗?


拉风的咖菲猫
浏览 79回答 1
1回答

小唯快跑啊

不幸的是,目前无法通过电子邮件地址查询客户搜索。
随时随地看视频慕课网APP
我要回答