4
Does anyone know how to identify payment status in the automatic return of pay notifications? For example, if the user made the payment then, my.php notification file receives a post from pagseguro, but in this post you can not identify the status : PAGO for example,( so I can send a confirmation email to him saying that the purchase was paid!)
Php code:
<?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);
}