3
I have a problem on a site that I made a little while ago, in the first days, when a customer made a payment on Pagseguro I received the return normally with the updates of the purchase status, however, about two weeks ago I stopped receiving this return suddenly. I reviewed my code several times after a possible error, searched in various ways on Google, even disabled the mod_security
on the server as some websites suggested and nothing...
Code of the return file
header('Access-Control-Allow-Origin: *');
require('../../PagSeguroLibrary/PagSeguroLibrary.php');
/* Tipo de notificação recebida */
$type = $_REQUEST['notificationType'];
LogPagSeguro::info("Uma Notificação do tipo '{$type}' chegou!");
/*
* Código da notificação recebida
* https://pagseguro.uol.com.br/v2/guia-de-integracao/api-de-notificacoes.html
*/
$code = $_REQUEST['notificationCode'];
/* Verificando tipo de notificação recebida */
if ($type == 'transaction') {
LogPagSeguro::info('Nova notificação retornada do PagSeguro');
$credencial = PagSeguroConfig::getAccountCredentials();
/* Obtendo o objeto PagSeguroTransaction a partir do código de notificação */
$transaction = PagSeguroNotificationService::checkTransaction(
$credencial,
$code
);
/* código do status da transação */
$status = (int) $transaction->getStatus()->getValue();
$requestId = (int) $transaction->getReference();
$statusNome = $transaction->getStatus()->getTypeFromValue();
if($status && $requestId){
/*atualiza o status da compra
Código adicional
grava no log do pagseguro
*/
if($qrUpdateInfo->affected_rows == 1) LogPagSeguro::info('Pedido "'.$requestId.'" atualizado com sucesso!');
else LogPagSeguro::warning("Ocorreu um erro na atualização do status do pedido '{$requestId}'! mysqli_errno({$qrUpdateInfo->errno})");
}
}else{
LogPagSeguro::warning("Uma Notificação do tipo '{$type}' foi recusada!");
}
I’m using $_REQUEST
because strangely he did not receive the $_POST
s of Pagseguro.
So far no mystery, I believe.
But the moment I make the purchase, it sends me the return of that purchase and writes in the log file normally, but the updates of the purchase status are not coming more...
Log:
{2014/05/19 13:41:32} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
'Reference' => 79,
'SenderEmail' => 'null',
)) - begin
{2014/05/19 13:41:33} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
'Reference' => 79,
'SenderEmail' => 'null',
)) - end {1}13DC46D97171BB4444F60F81E8A4A98C
{2014/05/19 13:56:36} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
'Reference' => 80,
'SenderEmail' => 'null',
)) - begin
{2014/05/19 13:56:38} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
'Reference' => 80,
'SenderEmail' => 'null',
)) - end {1}E0E95A81EAEA5B2AA4C66F9C8806485E
{2014/05/19 14:28:02} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
'Reference' => 84,
'SenderEmail' => 'null',
)) - begin
{2014/05/19 14:28:04} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
'Reference' => 84,
'SenderEmail' => 'null',
)) - end {1}A864EE379C9C8FFCC4A48FBACABECBC3
{2014/05/19 14:30:57} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
'Reference' => 85,
'SenderEmail' => 'null',
)) - begin
{2014/05/19 14:30:59} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
'Reference' => 85,
'SenderEmail' => 'null',
)) - end {1}53AD3EF23F3F89A884559FBFBD464A36
{2014/05/19 14:56:27} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
'Reference' => 86,
'SenderEmail' => 'null',
)) - begin
{2014/05/19 14:56:28} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
'Reference' => 86,
'SenderEmail' => 'null',
)) - end {1}ABC65A77767683A774117FA5386D3C90
{2014/05/19 14:59:10} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
'Reference' => 87,
'SenderEmail' => 'null',
)) - begin
{2014/05/19 14:59:11} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
'Reference' => 87,
'SenderEmail' => 'null',
)) - end {1}27E7C9EE7F7F95E334BFDF9131FBDA3E
{2014/05/19 15:16:17} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
'Reference' => 88,
'SenderEmail' => 'null',
)) - begin
{2014/05/19 15:16:19} [Info] PagSeguroPaymentService.Register(PagSeguroPaymentRequest: array (
'Reference' => 88,
'SenderEmail' => 'null',
)) - end {1}D4E7C61FADAD6FF99403AFB16E1D0930
Another question, the server firewall could be blocking the return of Pagseguro?
I honestly already lost hope with Pagseguro, but since I can’t migrate this client to Moip I have to find a way to solve.
But from what I understood, his code was working and suddenly stopped. if u didn’t set the return then it never worked...the most important thing is to have fixed it. hugs
– Dorathoto
@Dorathoto but that’s what happened, I received the return even without having set the return together with the shipment, until I had no idea that this was necessary, so it was so difficult to arrange this time...
– RodrigoBorth