PayPal redirects to the same popup window

后端 未结 3 2076
感情败类
感情败类 2021-02-09 09:30

I integrated PayPal\'s Identity API in my webpage. As usual when user clicks login with paypal(JavaScript button) it opens a new window for login purpose. But after

相关标签:
3条回答
  • 2021-02-09 10:09

    You need to add the close action in your return URL (and most likely use a separate URL as the return URL with nothing but the close action in it).

    Take a look at the Adaptive Payments documentation. Do a find on that page for the word close and it'll take you straight to the section that covers how to handle this.

    Note: You are responsible for closing the minibrowser after PayPal redirects to the page specified in either the return or cancel URL. PayPal provides a JavaScript function that you call to close a PayPal minibrowser or lightbox.

    0 讨论(0)
  • 2021-02-09 10:10

    I had the exact problem, but the solution is in the documentation here:

    https://developer.paypal.com/docs/classic/express-checkout/digital-goods/ClosingWindow/

    Refer to "Reloading Parent Page to a Specific URL" and add this script to the return and cancel pages.

    <script>
        top.window.opener.location ='http://your-url-here.html';
        // if you want to close the window
        // window.close();
    </script>
    
    0 讨论(0)
  • 2021-02-09 10:17

    Setting top.window.opener.location will update your original "opener" window. You will also need to close the dialog by calling top.close(). This is just an attempt at combining the other two answers and sharing the solution I arrived at with their help. Note that this code is in a url other than the "opener" window.

    <script src="https://www.paypalobjects.com/js/external/api.js"></script>
    <script>
    top.window.opener.location ='http://yourdomain.com';
    top.close();
    </script>
    
    0 讨论(0)
提交回复
热议问题