When receiving notification from Paypal with payment status, it gives error 500 when pushing on my API

Asked

Viewed 719 times

1

The code below is the PUSH created for Pagseguro to send me the notification of the status of my payment. But the error returned is 500, and in their forum no answers so far. Someone who has been through this problem can help me?

@PostMapping(value="/pagseguro-notificacao")
    public @ResponseBody
    String resgistrarNotificacao(
            @RequestParam(value = "notificationCode") String nCode,
            @RequestParam(value = "notificationType") String nType) {
        try {
            final PagSeguro pagSeguro = PagSeguro.instance(Credential.sellerCredential(sellerEmail,
                      sellerToken), PagSeguroEnv.PRODUCTION);

            TransactionDetail transaction = pagSeguro.transactions().search().byNotificationCode(nCode);

            if (transaction != null) {                
                atualizarStatusDoAnuncio(transaction);
            }

        } catch (Exception e) {
            Logger.getLogger(e.getLocalizedMessage());
        }

        return null;

    }

Error returned inserir a descrição da imagem aqui

  • Save a poorly implemented API, error 500 is problem on their side. Googlando Pagseguro API and error 500, we get a rain of links from unstable sandbox environment, which should be your case. At first, nothing you can do, apparently.

  • Could you put the error log on your machine here? This error is on your machine side.

  • @Aristofanyogarcy debugging the server saw that the error happens at that time Transactiondetail transaction = pagseguro.transactions(). search(). byNotificationCode(nCode); I will continue debugging and inform the log, because until now I had not been able to debug in production.

  • If the problem is here TransactionDetail transaction = pagSeguro.transactions().search().byNotificationCode(nCode);. Probably your problem is that it’s not in the nCode’s location. Check if the notification for dev is enabled, if the token data is right, etc... it is usually a simple thing!!

  • @Aristofanyogarcy worked, it was a notation that had to put in this line of credentials: final Pagseguro pagseguro = Pagseguro . instance(new CommonsLoggerFactory(), new JSEHttpClient(),
 Credential.sellerCredential(sellerEmail, sellerToken), PagSeguroEnv.PRODUCTION); estava sem esse new CommonsLoggerFactory e new JSEHttpClient Obrigada pelas dicas de qualquer forma.

No answers

Browser other questions tagged

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