Options For Closing the Lightbox or Mini-browser

The following options for closing the lightbox or mini-browser reload the parent page:

Reloading Parent Page to a Specific URL

This procedure for closing the lightbox or mini-browser reloads the parent page to a specific URL:

  1. Optionally, to obtain details about the buyer to display to your web page, call the GetExpressCheckoutDetails API operation.
  2. Call DoExpressCheckout to complete payment. See Completing the Digital Goods Transaction.
  3. Include JavaScript code, such as in the following example, on the return URL and cancel URL pages:
    <!-- Use result of DoEC to send the buyer to the correct page -->
    <!DOCTYPE html>
    <html>
    <head>
    <title></title>
    <script>
    top.window.opener.location ='http://example.com/path_to_fulfillment_page';
    </script>
    </head>
    <body>
    If this page does not redirect <a href="[page to deliver content
    to non-JS customer]">Click Here</a>
    </body>
    </html>
    

If the buyer cancels the order, close the lightbox or mini-browser without fulfilling the order.

The top window is the browser window. This code replaces the top window content with the content of the page at the specified URL.

Reloading Parent Page by Removing Frames

This procedure for closing the lightbox or mini-browser reloads the parent page by removing frames:

  1. Optionally, to obtain details about the buyer to display to your web page, call the GetExpressCheckoutDetails API operation.
  2. Call DoExpressCheckout to complete payment. See Completing the Digital Goods Transaction. Note: You perform the previous 2 steps while you are still in control of the lightbox.
  3. Include JavaScript code, such as in the following example, on the return URL and cancel URL pages:
    <!-- Use result of DoEC to send the buyer to the correct page -->
    <!DOCTYPE html>
    <html>
    <head>
    <title></title>
    <script>
    if (window != top) {
    top.location.replace(document.location);
    }
    </script>
    </head>
    <body>
    <!-- Include non-JavaScript content here -->
    If this page does not redirect <a href="[page to deliver content
    to non-JS customer]">Click Here</a>
    </body>
    </html>
    

If the buyer cancels the order, close the lightbox or mini-browser without fulfilling the order.

The top window is the browser window. This code replaces the top window content with the content of the page at the specified URL.