I made the implementation of a custom virtual store in the PHP language and as a checkout I am using PagSeguro .
In the implementation, the transparent checkout was used and was functioning correctly, but the client requested that the option of installment of the order be added. When trying to perform the request of parcels using Javascript API , 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, as I said before the checkout was working correctly and the only change was the addition of the installment.
Methods used
Return from getSessionId
{"result": true, "data": "b099c6f4beff41e0a08a4912f7ce9554"}
Search for the banner of the card
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 seek the installment
sessionId: b099c6f4beff41e0a08a4912f7ce9554
amount: 49.90
creditCardBrand: visa
maxInstallmentNoInterest: 2
Return search:
{"errors": {"Invalid SESSION: b099c6f4beff41e0a08a4912f7ce9554.": "10005"}, "error": true}