I'm using Pagseguro to manage payments, I use the lightbox
method, where I can do everything, including payment (all in sandbox).
But at the time of receiving notifications, the file is not being called. Even though you have set up the url within PagSeguro.
See the image:
Myfilepag_retorno.phpisthis:
<?php$name='arquivo.txt';$text="chegou".date("Y-m-d H:i:s");
$file = fopen($name, 'a');
fwrite($file, $text);
fwrite($file, $status);
fclose($file);
if(isset($_POST['notificationType']) && $_POST['notificationType'] == 'transaction'){
$name = 'arquivo.txt';
$text = "chegou";
$file = fopen($name, 'a');
fwrite($file, $text);
fwrite($file, $status);
fclose($file);
$email = '[email protected]'; //ja esta configurado
$token = 'meutoken'; //ja esta configurado
$url = 'https://ws.sandbox.pagseguro.uol.com.br/v2/transactions/notifications/' . $_POST['notificationCode'] . '?email=' . $email . '&token=' . $token;
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$transaction= curl_exec($curl);
curl_close($curl);
if($transaction == 'Unauthorized'){
print_r("nao autorizado");
exit;
}
$transaction = simplexml_load_string($transaction);
$status = $transaction -> status;
$name = 'arquivo.txt';
$text = var_export($_POST, true);
$file = fopen($name, 'a');
fwrite($file, $text);
fwrite($file, $status);
fclose($file);
print_r($status);
}
?>
As you can see, I even put up a date and notice alert to see if the file was called at least, which is not happening. Would anyone know how to fix this?
Edited:
The same URL setting was also made within the SandBox environment.