Não e estou conseguindo gerar a criação de empresa com a minha conta tenho algum bloqueio nela ou seria problema do meu codigo?
function criarEmpresa($accessToken, $empresa){
$ch = curl_init(“https://api.nuvemfiscal.com.br/empresas”);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($empresa));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
“Authorization: Bearer $accessToken”,
“Content-Type: application/json”,
“Accept: application/json”
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if(curl_errno($ch)){
return ['http'=>0,'resposta'=>"Erro CURL: ".curl_error($ch)];
}
$result = json_decode($response,true);
return ['http'=>$httpCode,'resposta'=>$result];
}
Resultado
Array
(
[http] => 403
[resposta] => Array
(
[error] => Array
(
[code] => InsufficientPermissions
[message] => You do not have enough permissions to perform this action
)
)
)