Embed PayPal in an IFRAME

2019-02-08 10:44发布

问题:

Is it possible to embed paypal in an IFRAME. I have tried to do this but it just came back a blank page as if there was nothing on it. I dont want to use adaptive payments. Is this possible?

Thanks

回答1:

They are probably prohibiting it by setting the X-FRAME-OPTIONS header. It's a security measure and there is no way to work around it.

If you have a payment running through PayPal, you can provide a "back to site" link - that's all you can do.



回答2:

You can host PayPal in an iframe only with Adaptive Payments for Digital Goods / Express Checkout for Digital Goods (kind of), Hosted Solution (hosted Website Payments Pro, not currently available in the US), Payflow Pro, and Payflow Link.

You cannot host Website Payments Standard checkout pages in iframes. As Pekka stated, PayPal does set the X-FRAME-OPTIONS header.



回答3:

No way to get around the same origin policy.

A way around this is to create an anchor tag in the iframe:

<a href="<?=$paypal_redirect?>" target="_blank">Continue Checking out</a>
or
<a href="<?=$paypal_redirect?>" target="_top">Continue Checking out</a>

The above will only allow the continuation of the checkout process in another tab/window; it will not process the checkout within your iframe.