I have an ASP.Net code that processes cart order information and has the billed amount there to be processed. I need to pass the billed amount to a javascript function in order to pass that to MasterCard integration. It works well with a fixed amount, but I need the dynamic amount to be passed now.
Here is the code of the billed amount section:
if(data['ErrorCode'] == '000'){
$('#divMsg').html('Voucher Code Applied Successfully..!');
$('#divMsg').show('slide').fadeOut(8000);
$('#<%= divDisplayDiscount.ClientID %>').show();
$('#<%= divDiscount.ClientID %>').text(data['Discount']);
$('#<%= divDisplaySubAmount.ClientID %>').show();
$('#<%= divSubAmount.ClientID %>').text(addCommas(data['SubAmount']));
$('#<%= divBillAmount.ClientID %>').text(addCommas(data['BillAmount']));
$('#<%= divCartAmounts.ClientID %>').text(addCommas(data['BillAmount']));
$('#<%= txtCouponCode.ClientID %>').text(data['CouponCode']);
$('#<%= divDiscountPerc.ClientID %>').text(addCommas(data['DiscountPercentage']));
$('#<%= txtCouponCode.ClientID %>').attr('disabled','disabled');
$('#<%= btnChangeCode.ClientID %>').show();
$('#<%= btnApplyCode.ClientID %>').hide();
and here is the javascript part to pass the value, I set it to 70 to test it initially:
Checkout.configure({
merchant: 'xxxxxx',
order: {
amount: function() {
//Dynamic calculation of amount
return 70;
},