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?
Unfortunately, the ability to query a customer search by email address isn't currently available.