Problem between Pagseguro and number of installments

Asked

Viewed 2,872 times

8

I made the implementation of a virtual store customized in PHP language and as checkout I am using Paying.

In the implementation, the transparent checkout was used and was working correctly, but the client requested that the option of parceling the order be added. When trying to carry out parcel requisition using the API Javascript, the answer is always the same:

{"errors":{"INVALID SESSION: d4d905b585ec4d4d8056e380df70e4a5.":" 10005"},"error":true}

To make this request I am using the following Javascript method:

PagSeguroDirectPayment.getInstallments

I would like a help to solve, because as I said earlier the checkout was working correctly and the only change made was the addition of the installments.


Methods used

Return of the getSessionId

{"result":true,"date":"b099c6f4beff41e0a08a4912f7ce9554"}

Search card flag

PagSeguroDirectPayment.getBrand({
    cardBin: $scope.pagamento.cartao,
    success: function(response) {
        if (response && response.brand && response.brand.name) {
            $scope.bandeira = response.brand.name;
            $scope.getParcelasCartao();
        }
    },
    error: function(response) {
        console.log(response);
    }
});

Search for means of payment

PagSeguroDirectPayment.getInstallments({
    amount: valor,
    maxInstallmentNoInterest: 2,
    brand: $scope.bandeira,
    success: function(response) {
        console.log(response);
        if (response.error == false) {
            $scope.parcelamento = response.installments[$scope.bandeira];
        }
    },
    error: function(response) {
        console.log(response);
        $scope.parcelamento = new Array();
    },
    complete: function(response) {

    }
});

Parameters that are sent in the request to fetch the installment

sessionId: b099c6f4beff41e0a08a4912f7ce9554

amount: 49.90

creditCardBrand: visa

maxInstallmentNoInterest: 2

Return of the search:

{"errors":{"Invalid session: b099c6f4beff41e0a08a4912f7ce9554.":" 10005"},"error":true}

  • If you can, post part of your code to help us help you :)

  • Hello @Guilhermenagatomo, thanks for the suggestion. I already added the information and parameters sent in each request remembering that I am using the Javascript API of Pagseguro

1 answer

8


I recently made an integration with the transparent Pagseguro, and I came across this and other difficulties.

Suppose q vc is using their official PHP library (https://github.com/pagseguro/php), follows below the problems found and how they were solved, starting with what I believe to be the cause of your problem (of course to be sure there is a need to see the PHP code):

maxInstallmentNoInterest

A common error is sending a field to the PS by JS and not doing the same by PHP. The problem is that in the specific case of this field, the library does not have an attribute of its own to send it, being necessary to make use of addParameter, thus: $psRequest->addParameter('noInterestInstallmentQuantity', 2);

Bank name

For payments via Online Debit (EFT), there is a need to inform the name of the bank, something that is not clear in the manual. For this, use the method setOnlineDebit, thus: $psRequest->setOnlineDebit(array("bankName" => 'nome do banco');

EFT vs ONLINE_DEBIT

The JS method getPaymentMethods returns a JSON whose nomenclature for online payments is ONLINE_DEBIT. However, in the PHP library this nomenclature changes to EFT. The PHP class where this is found is Pagsegurodirectpaymentmethods, and one of the ways to fix this conflict is by adding the following line in the attribute statement $methodsList: "ONLINE_DEBIT" => "eft",

I hope these suggestions can help you to finalize your project.

  • 1

    Thanks for the @Szag-Ot reply, the problem in this case was Javascript. Since it was using the sandbox API, the javascript should come from the sandbox as well. I find this method a little flawed because it can occur a lot of errors by forgetting. Problem that in the documentation does not say anything about this rsrs. But thanks for the help

  • I haven’t even left Pagsegurodirectpayment.getBrand yet, I’m already in error with Object {error : true}, I’m going through '411111' (the first 6 digits of the Sandbox credit card). Can you help me?

  • @Jhonatanpereira did not understand your doubt.... could post the error you are giving or part of the code? Perhaps it would be better to create a new question for this

  • It’s such a short problem... As you already know the code, I’ve made it very short: https://jsfiddle.net/jpdesignerrio/drhdomng/2/

  • If you can not know why the error, and because it does not return the reason for the error, I open a new question

  • @Jhonatanpereira the code snippet posted is correct... but you know that getBrand should be a continuation of another method, right? getPaymentMethods. Here is a link to an excerpt of the code I use on our system, I hope it helps: http://codepen.io/szagot/pen/RdXVY?editors=0010

  • Thank you @Szag-Ot

  • Dude, I’m getting error 59001 : "Unknown web Session id" and I can’t find a solution for it! I already opened new topic here in Stack 3 days ago, but so far no one answered... Can you tell me the reason for the error?

  • http://answall.com/questions/148507/pagseguro-getpaymentmethods-erro/148773#148773

  • checking, @Jhonatanpereira

  • The problem was the browser, it worked. I just don’t know what else to do after the function that picks up the Card Token

Show 6 more comments

Browser other questions tagged

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