I have a react project.
I have an external payment gateway that I need to submit a hidden form to. The documentation of this gateway suggests I create a simple with action and submit. When doing this, I achieve the expected behaviour - it changes my current window location to that of the action, and the information passed in the hidden inputs is displayed.
The problem is, I need to dynamically load the inputs from my own backend so need to use Javascript with either Fetch or Axios to send a post request with the data from my own backend. When I attempt to do this, I get both a CORS error and the page doesn't navigate to the desired action page.
TDLR: How do I convert this HTML form to either Axios or Fetch in JavaScript:
<form method="post" action="https://mdepayments.epdq.co.uk/ncol/test/orderstandard_utf8.asp" id="form1" name="form1">
<input type="hidden" name="PSPID" value=""/>
<input type="hidden" name="ORDERID" value=""/>
<input type="hidden" name="AMOUNT" value=""/>
<input type="hidden" name="CURRENCY" value=""/>
<input type="hidden" name="LANGUAGE" value=""/>
<input type="submit" value="Submit" id="submit2" name="submit2">
</form>