I’m trying to create a Decive Code, But I get this error.
Square\Models\Error Object ( [category:Square\Models\Error:private] => INVALID_REQUEST_ERROR [code:Square\Models\Error:private] => BAD_REQUEST [detail:Square\Models\Error:private] => DeviceCode must contain a product_type [field:Square\Models\Error:private]
$device_code = new \Square\Models\DeviceCode(‘TERMINAL_API’);
$device_code->setName(‘Counter 1’);
$device_code->setLocationId(‘LRRR39D6WSF8X’);
$body = new \Square\Models\CreateDeviceCodeRequest(‘5bffb735-5ea9-45b4-889a-d33200b12ad3’, $device_code);
$api_response = $client->getDevicesApi()->createDeviceCode($body);
if ($api_response->isSuccess()) {
$result = $api_response->getResult();
$printAr = $api_response->getResult();
print_r($printAr);
} else {
$errors = $api_response->getErrors();
$printAr = $api_response->getErrors();
print_r($printAr);
}
