Enable In-Context Checkout

Important: This integration method is deprecated as of January 1, 2017. PayPal continues to support existing merchants using this method, but please be advised new features and enhancements will not be applied to these integrations. For new integrations, see the PayPal Checkout Integration Guide.

Add the In-Context JavaScript

To integrate In-Context Checkout, include the PayPal checkout.js JavaScript on the page that hosts your PayPal button.

Note: Load and run the checkout.js script from //www.paypalobjects.com/api/. Do not download a local copy to your server and load it from there.

<script src="https://www.paypalobjects.com/api/checkout.js" async></script>

Basic integration example

A basic Express Checkout integration assumes that you are sending the API calls from your own server using a form or an a tag. The following example integration script calls paypal.checkout.setup and must be loaded after the form or a tag:

<form id="myContainer" method="post" action="/checkout"></form>

   window.paypalCheckoutReady = function () {
     paypal.checkout.setup('<Your-Merchant-ID>', {
         environment: 'sandbox',
         container: 'myContainer'

<script src="https://www.paypalobjects.com/api/checkout.js" async></script>

In advanced Express Checkout integrations, checkout.js is initiated through a click event, as described in Advanced In-Context JavaScript settings.

Note: The paypalCheckoutReady function runs after the script loads.

Try It!
JavaScript button demo

For more information, see the In-Context API functions.

In-Context Checkout processing

The checkout.js script completes this processing:

  1. The setup call automatically populates and displays the PayPal Checkout out button in your container.
  2. When the buyer clicks the button, the script uses AJAX to manage the form submit in the background.
  3. The form submit invokes your code on the server to call the SetExpressCheckout method.
  4. Your server code redirects the buyer to a PayPal URL with the token appended.
  5. The script manages the redirect within a secure pop-up window on your website.
  6. After the buyer checks out, PayPal redirects the buyer to the return URL specified in the SetExpressCheckout call.

Note: For assistance with implementing In-Context Checkout, contact your PayPal integration engineer.

Debugging tips

To turn on console debugging logs:

  1. Open the console panel in your browser developer tools.
  2. In your console, enter this setting:


    Note: The console setting is case-sensitive.

  3. Refresh the page.

Note: To disable Quirks Mode and Compatibility View in Internet Explorer, add <!DOCTYPE html> and <meta http-equiv="X-UA-Compatible" content="IE=edge" /> to the page that initiates the checkout flow.


Complete one of these tasks: