cancel
Showing results for 
Search instead for 
Did you mean: 

Pretty much ready to give up (can't redirect from payment success properly)

Options
pennywise79
Contributor
Posted on

So I don't know what to do.  I am using Paypal embedded flow with a light box and I want to close the light box and redirect users to my reciept page.  The problem is that I can't properly close the light box and redirect in all browsers.  I've tried this:

 

       if (window != top) {
            top.location.replace(document.location);
        }

 

While the above works in most browsers, it does not close the embedded flow in Internet Exporer or Edge.

 

So I added this:

 

    $(document).ready(function () {
        if (window.opener) { // check if opened in popup
            window.close();
        }
        if (window != top) {
            top.location.replace(document.location);
        }
    })

 

This does close the flow for all desktop browsers I have tried, but does not work on Safari for mobile devices because it closes the window with my receipt and does not reload it without the light box.  So I'm at a total loss.  Does anyone have a cross browser code that will exit the light box upon successful payment and redirect users to full screen page (i.e., close the light box embedded view and redirect to full page)?

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.