简体   繁体   中英

Square API Search user by Email - endpoint is not supported in legacy Sandbox

Going over this documentation I'm having trouble figuring out how to get the search feature to work and I'm getting an error:

$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);

I get the following:

[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.

I'd like to be able to search by an email address. I tried using the JSON on the page though I still got the same error message. Ideas please?

不幸的是,目前无法通过电子邮件地址查询客户搜索。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM