I am integrating a payment gateway in my app that is developed in Ionic v1, so payment gate way need a form redirection as soon as I click on pay now button , it redirect to payment gateway with a form hidden form.
<body ng-app="payment">
<div ng-controller="PaymentCtrl" style="text-align: center; color: #FF0000;">
<form name="sendParam" method="post" action="https://test.sbiepay.com/secure/AggregatorHostedListener">
<input type="hidden" id="EncryptTrans" name="EncryptTrans" />
<input type="hidden" name="merchIdVal" value= "1000003" />
<input type="submit" value="enter" style="position: absolute; left: -9999px"/>
</form>
<div class="loaderImg"><img style="width:300px;" src="img/loader.gif" /></div>
<p style="font-weight: bold;">Please device wait..!</p>
<p>We are redirecting you to payment gateway</p>
<p>Please do not hit refresh or back button or close the window..</p>
</div>
<script>
var transactionParam = window.localStorage.getItem('transParams');
document.getElementById('EncryptTrans').value = transactionParam;
setTimeout(function(){ document.sendParam.submit(); }, 5000);
</script>
</body>
So , on browser it append all required headers automatically, but in case of device it does not add the required header which payment gateway ask to add in case of android. Like while sending request from device payment gateway verify the Referer Header, but it does not present in that case, so it refuse the request.
Can anyone assist me in this, I have tried so many tricks but nothing working.
window.localStorage.setItem('transParams', fieldDevice);
//Post all required paremeters to the payment gateway
iabRef = window.open('epayDevice.html', '_self', 'location=no');
And in ePayDevice.html has a form which submit using javascript as following.
which header are you trying to pass. Can you give an example what you see in the browser when it works. I already gave an example in my first reply. You can find thousands of those examples on google
You cannot change the Origin or the referer header. I think it is checking with the X-Auth-Token field. If you are loading your local form.html inside window.open, it does not make a difference.I think the api works in a specific way. You have to contact your provider to see how their api works.( How to fetch the token etc…) .
Yes , this is the issue with ionic only. payment gateway verify the origin of the request. and refuse the request if it found origin as NULL. any way thanks for your attention.
If you have time then check this one oopen issue with ionic.