how to send a http request using html form string

Viewed 16

I want to implement 3Ds payment in my website. The document of 3Ds says I have to post data like:

<html>
<body onload="document.frm.submit()"><form method="post" action="https://www.sa*****.com/fim/es***8te" name="frm">

    <input type="hidden" name="okUrl" value="http://localhost:5000/t/success/">
    <input type="hidden" name="failUrl" value="http://localhost:5000/t/failure/">

    <input type="hidden" name="amount" value="877.140816">
    <input type="hidden" name="currency" value="949">

    <input type="hidden" name="Ecom_Payment_Card_ExpDate_Year" value="****">
    <input type="hidden" name="Ecom_Payment_Card_ExpDate_Month" value="**">
    <input type="hidden" name="pan" value="********">
    <input type="hidden" name="cv2" value="****">
    <input type="hidden" name="cardType" value="2">
    <input type="hidden" name="taksit" value="">

    <input type="hidden" name="lang" value="en">

    <input type="hidden" name="clientid" value="*******">
    <input type="hidden" name="oid" value="">

    <input type="hidden" name="rnd" value="Tue Sep 20 16:22:15 TRT 2022" >
    <input type="hidden" name="hash" value="Tk**********aME=" >
    <input type="hidden" name="islemtipi" value="PreAuth" >
    <input type="hidden" name="storetype" value=" 3d_pay">

</form>

</body>
</html>

It is in string form, so I have to use that string html. My question is that: I use ReactJs. How can I send a http request using this string. And get an response using this string. Note: URLs below are the endpoints of my backend in case failure and succes.

<input type="hidden" name="okUrl" value="http://localhost:5000/t/success/">
<input type="hidden" name="failUrl" value="http://localhost:5000/t/failure/">

Note2: How can I reedirect user to 3ds page or should I create an iframe.

0 Answers
Related