Reputation: 153
Because we are not PCI compliant, the payment gateway providers gave us <iframe>
to make payments. The issue is I cannot set the amount field inside the iframe with my cart total(19.00).
check out page:
payment page:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('#myiframe').load(function(){
var iframe = $('#myiframe').contents();
iframe.find("#amount").val(<?php echo total; ?>);
iframe.find("#firstname").attr('readonly','readonly');
});
});
</script>
</head>
<body>
<iframe id="myiframe" src="paymentgateway.com">
<p>Your browser does not support iframes.</p>
</iframe>
</body>
</html>
The above code does not work as negete.net/sys/checkout.php is in one domain and payment form in another domain. Reason is problem with Cross-Origin Resource Sharing (CORS).
I tried to solve this, but nothing worked. If anyone has encountered issues like this, your help is much appreciated. Given below are some links which I found related to CORS.
Upvotes: 0
Views: 1255
Reputation: 153
I got a way to tackle the above issue. Actually it is in payment gateway issuer's documentation which I missed. The solution is you can pass the amount as an query string in iframe url .
<iframe id="myiframe" src="paymentgateway.com?amount=50">
<p>Your browser does not support iframes.</p>
</iframe>
Thanks for the help.
Upvotes: 1