Return of the paid stopped being received suddenly

Asked

Viewed 949 times

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 $_POSTs 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.

2 answers

1


I found the problem, and a few more recommendations...

  • 1 - Do not just set in the pagseguro the return url, the moment you send to the pagseguro the purchase you must set the return url too

    $pagseguro->setNotificationURL('http://seudominio/arquivoderetorno');

  • 2 - Release ips in your firewall

    186.234.16.8
    186.234.16.9
    186.234.48.8
    186.234.48.9
    200.147.112.136
    200.147.112.137
    
  • 3 - Disable your mod_security

Sources:
Imasters
Blog pag seguro

  • 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

  • 1

    @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...

1

I haven’t analyzed your code, but since you didn’t have any answers I’ll give you two ways that will help you;

1º - check if in pagseguro, in the account you are using to pay, not disabled the return page, if disabled by some mistake, it will not send you anything.

2º - Make a test, this page that receives the return, makes it create a file . txt if it is accessed, make a test purchase, and verify that it created the file. if she does not create the file for some reason she is not running.

  • I already checked the return and it’s active, I’m going to do the second test now

  • tested the second way and the file was not accessed by pagseguro

Browser other questions tagged

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