Comunidade
estou tentando usar a API de Transferencia PIX "estou recebedo vazio como retorno"
12 months ago by Fagner
Ola tudo na paz, alguem saberia me ajudar com esse problema.
estou usando a linguagem PHP.
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://secure.api.pagseguro.com/transfers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => [
'value' => 100,
'currency' => 'BRL'
],
'instrument' => [
'type' => 'PIX',
'pix' => [
'key' => 'chavePix'
]
],
'description' => 'Teste transferencia pix',
'reference_id' => 'teste5624364',
'notification_urls' => [
'https://webhookUrl/41cf900f-110d-4033-9cce-f32164071c5a'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . $this->accessToken,
"Content-type: application/json",
"accept: application/json"
],
CURLOPT_SSLCERT => Storage::path($this->pathPem),
CURLOPT_SSLKEY => Storage::path($this->pathKey)
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}