The% of PagSeguro is used to return the number of parcels and the value of each parcel, when informing a card and the value of the sale.
The feedback I get is this:
Inthisreturneachitemrepresentsanumberofparcelsanditsvalue,whatIamnotgettingistousegetInstallments
insomewayinthisreturnandfillaforeach
.
IwouldliketofilltheSelectoptions
withtheamountofparcelandthevalue.
ToreturnthevaluesI'musing:
PagSeguroDirectPayment.getInstallments({amount:<?phpecho$total_compra?>,brand:$("#bandeira").val(),
maxInstallmentNoInterest: 2,
success: function(response) {
//console.log(response);
bandeira = $("#bandeira").val();
$("#parcelas_div").show(200);
var options = "";
var retorno_bandeira = response.installments.visa;
for (var i = 0; i < retorno_bandeira.length; i++) {
var quantidade = retorno_bandeira[i].quantity;
var parcela = retorno_bandeira[i].installmentAmount;
var valorTotal = retorno_bandeira[i].totalAmount;
options += '<option value="' + quantidade + '" data-valor="' + parcela + '">' + quantidade + 'x de ' + parcela + ' = R$ ' + valorTotal + '</option>';
}
$("#parcelas").html(options);
},
error: function(response) {
console.log(response);
},
complete: function(response) {
console.log(response);
}
});
The problem that is occurring is as follows:
If I put in the line select
return of all data comes var retorno_bandeira = response.installments+"."+bandeira;
, but if I add the name of the flag directly on the line so Undefined
comes everything normal, I believe the problem is in the form of concatenating the name from the flag to the return.