I’m trying to set up an iframe-based payment gateway for a WooCommerce online store. The instructions I got from the bank say that I need to “generate a post action inside of the contained IFRAME on the page.”
The result should be that when the checkout page loads, inside the iframe I should be seeing fields for the customer to enter their credit card information.
But I don’t understand how to take the form below (from the documentation) and automatically post it to the iframe.
Payment Gateway Documentation:
To initiate a transaction, your system must generate a POST action inside of the contained IFRAME on the page.using the format below to the URL designated for your system. You will be provided with a URL for testing and live transaction processing by the processor when your merchant accounts have been configured.
Example:
<form ACTION="https://tranpage/demogwtxnif/txnif.aspx" METHOD="post"> <input type="hidden" NAME="MERCHKEY" VALUE="MYDEMOMERCHANTKEY" /> <input type=âhiddenâ NAME=âTRANTYPEâ VALUE=âAUTHâ/> <input type=âhiddenâ NAME=âAMTâ VALUE=â10.00â /> <input type=âhiddenâ NAME=âCURRâ VALUE=âCADâ /> <input NAME=âinvoiceâ VALUE=âDemoSale1â /> <input NAME=âtranidâ VALUE=â123456789â /> <input NAME=âamtâ VALUE=1.00 /> <input NAME=âcurrâ VALUE=âUSDâ /> <input NAME=âURLAPPROVEDâ VALUE=âhttp://www.webstore.com/cgishl/goodpayment.exe?res=#RC#&fres=#FC#&ac=#APP#&ref=#REF#&tran=#TRANID#&invoice=#INVOICE#&err=#EM#â /> <input NAME=âURLOTHERâ VALUE=âhttp://www.webstore.com/cgishl/paymentincomplete.exe?res=#RC#&fres=#FC#&ac=#APP#&ref=#REF#&tran=#TRANID#&invoice=#INVOICE#&err=#EM#â /> <INPUT name=SUBMIT type=submit value="Pay Now"> </form>
Have the form’s target attribute match the iframe’s name attribute.
Source: https://css-tricks.com/snippets/html/post-data-to-an-iframe/
There is working example (you need to add a simple js line to submit your form):