Does anyone know how to identify the payment statuses in the automatic return of the pagseguro notifications? For example, if the user made the payment then my notification.php file receives a post from the pagseguro, but in this post can not identify the status: PAYMENT for example, (so I can send a confirmation email to him saying that the purchase was paid!)
Code php:
<?php
if(isset($_POST['notificationType']) && $_POST['notificationType'] == 'transaction'){
//Todo resto do código iremos inserir aqui.
$email = 'loja@...';
$token = '418C6...';
$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'){
//Insira seu código avisando que o sistema está com problemas, sugiro enviar um e-mail avisando para alguém fazer a manutenção
exit;//Mantenha essa linha
}
$transaction = simplexml_load_string($transaction);
}