I am integrating PayPal integration using JavaScript in PhoneGap, but I'm facing an issue that it is not opening in the inApp browser. Instead of that it is opening outside of my app. So I want the PayPal URL to be opened in the inApp browser.
I'm new to PhoneGap so if anyone knows please help with it. Below is the code
<form id="openpaypal" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="NSH74TD463ZSU">
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
//script here
<script>
document.getElementById("openpaypal").addEventListener("click", openBrowser);
function openBrowser() {
alert("called here");
var url = 'https://www.paypal.com/cgi-bin/webscr';
var target = '_blank';
var options = "location=yes"
var ref = cordova.InAppBrowser.open(url, target, options);
ref.addEventListener('loadstart', loadstartCallback);
ref.addEventListener('loadstop', loadstopCallback);
ref.addEventListener('loadloaderror', loaderrorCallback);
ref.addEventListener('exit', exitCallback);
function loadstartCallback(event) {
console.log('Loading started: ' + event.url)
}
function loadstopCallback(event) {
console.log('Loading finished: ' + event.url)
}
function loaderrorCallback(error) {
console.log('Loading error: ' + error.message)
}
function exitCallback() {
console.log('Browser is closed...')
}
}
</script>