Sandbox Does Not Send Notifications

Asked

Viewed 376 times

1

The secure pay sandbox is not sending notifications to my page, the url is configured in the Integration Profiles -> seller tab, and also the notifitionURL in the transaction request.

Successful image on localhost

inserir a descrição da imagem aqui

The code of my page re receives the notifications is this:

<?php

header("access-control-allow-origin: https://sandbox.pagseguro.uol.com.br");

$notificationCode = $_POST["notificationCode"];

$data['token'] ='TOKEN';
$data['email'] = '[email protected]';

$data = http_build_query($data);

$url = 'https://ws.sandbox.pagseguro.uol.com.br/v3/transactions/notifications/'.$notificationCode. '?' .$data;

$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, $url);
$xml = curl_exec($curl);
curl_close($curl);

// $my_file = 'file.xml';
// $handle = fopen($my_file, 'w') or die('Cannot open file:  '.$my_file);

// fwrite($handle, $xml);


$xml = simplexml_load_string($xml);

$status = $xml->status;

if($status){
    $my_file = 'file.xml';
    $handle = fopen($my_file, 'w') or die('Cannot open file:  '.$my_file);
    fwrite($handle, $status);
}
?>

  • Hello Renan, out of curiosity which url is configured? Shows some error in your error_log?

  • The $email and $token variables must be filled in with the email from your pagseguro developer account and the token that the sandbox environment generates for testing

  • As I said, in localhost works perfectly, only on the server that does not, the variables are configured correctly, and does not present any error in the log

  • Unfortunately Pagseguro does not have access to your localhost, so you do not receive notifications. At least he gives some details about the request, the code that is passed on. This request can be reproduced in your local environment, using software like Insomnia or any other similar.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.