1

Currently i have been working on payment gateway that does not support US Dollars so i have to use my country currency as base currency then apply the conversion to the subtotal price. but on the checkout page i would like to show the US Dollars as main currency my question is how do i multiply the price before submit the data value to gateway

Example: in checkout page show 20 US Dollars but the hidden data will submit 20*30 which variable i have to edit in the code?

Thanks

1 Answers1

0

We might need a hidden input and write a tiny javascript to update non-USD amount once USD amount is updated.

Update hidden input field value with another input field value? is related.


rev 1:

<script language="javascript">
  function convert(usd) {
    document.getElementById("EUR").value = usd.value * conversion_rate;
  }
</script>
<form>
  <!-- this is for customer input-->
  <input name="USD" onChange="convert(this)"/>

  <!-- this is for submission to payment gateway-->
  <input name="EUR" type="hidden" id="EUR"/>
</form>
paulz
  • 185
  • 2
  • 10