Options For Closing the Lightbox or Mini-browser

Important: This integration method is Deprecated as of January 1, 2017. For new integrations, see the PayPal Express Checkout Integration Guide.

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

Reload parent page to a specific URL

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

  1. (Optional) Call the GetExpressCheckoutDetails API operation to btain and display details about the buyer on your web page.

  2. Call DoExpressCheckout to complete payment. See Complete the Digital Goods Transaction. Note: You perform the previous two 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>
           top.window.opener.location = 'https://example.com/path_to_fulfillment_page';
         </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.

Reload parent page by removing frames

This procedure closes the lightbox or mini-browser and reloads the parent page by removing frames:

  1. (Optional) To obtain and display details about the buyer on your web page, call the GetExpressCheckoutDetails API operation.

  2. Call DoExpressCheckout to complete payment. See Complete the digital goods transaction. Note: You perform the previous two 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.