Is it secure to pass a variable Amount to a Smart PayPal Button script?
If we assume that we have basic amount 100 and checkbox option, if user selects it, it will increase the total amount by 20 to become 120
var totalAmount = 100;
$('form').change(function(){
totalAmount =+ $(this).find("input").val();
})
paypal.Buttons({
createOrder: function(data, actions) {
// Set up the transaction
return actions.order.create({
purchase_units: [{
amount: {
value: totalAmount
}
}]
});
}
}).render('#paypal-button-container');
It works fine and PayPal takes it as 120 and all okay, but is it secure enough ? or is there a better practice?
Many Thanks