PayPal integration with iframe-based shopping cart

We use the PayPal Payments Pro NVP API to provide seamless credit card and PayPal processing on our website. We have created an iframe-based basket widget that our customers post on their website so that their users can purchase goods and pay for them through our Paypal account.

While credit card transactions are working fine, we see problems when a user tries to pay with his PayPal account. The API uses redirection when clicking on the PayPal logo, but then the PayPal code seems to run the script frame code and the transaction cannot continue.

I am looking for offers or sample code to handle users who want PayPal to pay via iframe. One option is to pop up in a new window, but then it leaves the design open for problems, as the user can switch between this window and the window containing the iframe, and possibly cause the cart to not synchronize with what the PayPal window displays .

+5
source share
3 answers

Both of the above answers are correct. However, PayPal technical support provided a more detailed set of instructions, which I provided below. Hope they help someone else.

SetExpressCheckout, RETURNURL CANCELURL , ( ).

script, - PayPal. script "302 " ( ) , , . ( PHP "header" - , header("Location: https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=$token");.) script HTML/JavaScript ( "TOKEN" , PayPal). , PayPal. , , , . , , , /, , onClick.

<script type="text/javascript"> window.open("https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=TOKEN","_blank","width=1024,height=768,location=1,resizable=1,scrollbars=1,status=1",true); </script>

, ( - PHP, , ). iframe. RETURNURL SetExpressCheckout . "paypalreturn.php" script, , PayPal.

<html>
<body>
<script type="text/javascript">
window.opener.location="http://www.regattacentral.com/paypalreturn.php?token=<? echo $_REQUEST["token"]; ?>&PayerID=<? echo $_REQUEST["PayerID"]; ?>";
window.close();
</script>
</body>
</html>

, CANCELURL.

• iframe, .

+6

PayPal Express Checkout/ "Pay with PayPal" Pro Hosted iframe . ( target = _parent) - .

+1

Set the target of the form - target = "_ top"

0
source

All Articles