Upgrade your integration

If possible, upgrade your PayPal messages integration to the latest PayPal JavaScript SDK. The new code keeps you current with messages, features, and styles.

Know before you code

  • These steps upgrade an existing legacy integration to PayPal's latest JavaScript SDK.
  • If you want to continue using your legacy integration, you must add a <script /> tag wherever you wanted to render messages.

How it works

To upgrade:

  1. Remove the legacy <script /> tags that you're currently using for PayPal messages.
  2. Add the PayPal JavaScript SDK with the messages component to the <head></head> of your document.
<script src="https://www.paypal.com/sdk/js?client-id=YOUR_CLIENT_ID&components=messages"></script>
  1. Add div elements with proper attributes inside the <body></body> of your document where you want to render messages.

Sample code

<!--
  In your code, dynamically update data-pp-amount with the price or
  cart amount. For example, data-pp-amount="89.99" for $89.99 product

  Also, update data-pp-placement with the page type. Can be one of
  "home", "category", "product", "cart" or "payment"
-->
<div
  data-pp-message
  data-pp-style-layout="text"
  data-pp-style-logo-type="inline"
  data-pp-amount="ENTER_VALUE_HERE"
  data-pp-placement="ENTER_PAGE_TYPE_HERE"
></div>

The following explains the legacy messaging integrations that help you identify your integration and upgrade. For a full set of instructions on adding and customizing messages with the PayPal JavaScript SDK, refer to the main integration page.

Legacy merchant.js integration

In this integration, you added one or more <script /> tags to your site, inside of which you're loading a merchant.js using www.paypalobjects.com/upstream/bizcomponents/js/merchant.js.

Sample code

<script type="text/javascript" data-pp-payerid="YOUR_PAYER_ID">
  (function (d, t) {
    var s = d.getElementsByTagName(t)[0],
      n = d.createElement(t);
    n.src = "//www.paypalobjects.com/upstream/bizcomponents/js/merchant.js";
    s.parentNode.insertBefore(n, s);
  })(document, "script");
</script>

Steps

To upgrade, complete the following:

  1. Remove the <script /> tags that are loading the merchant.js.
  2. Add the PayPal JavaScript SDK to the <head></head> of your site.
  3. Add div elements with proper attributes where you want to render messages.

Note: The value added to data-pp-payerid is different than from client-id required when loading the PayPal JavaScript SDK. If you don't yet know or have your client-id, follow the Get Started instructions to get your PayPal API credentials.

Legacy merchant.js subdomain integration

This integration is similar to the merchant.js integration outlined earlier, but it loads merchant.js using paypal.adtag.where.com.

Sample code

<script type="text/javascript" data-pp-pubid="YOUR_PAYER_ID">
  (function (d, t) {
    var s = d.getElementsByTagName(t)[0],
      n = d.createElement(t);
    n.src = "//paypal.adtag.where.com/merchant.js";
    s.parentNode.insertBefore(n, s);
  })(document, "script");
</script>

Steps

To upgrade, complete the following:

  1. Remove the <script /> tags that are loading the merchant.js.
  2. Add the PayPal JavaScript SDK to the <head></head> of your site.
  3. Add div elements with proper attributes where you want to render messages.

Note: The value provided to data-pp-pubid is different from the client-id required when loading the PayPal JS SDK. Follow the Get Started instructions to get your PayPal API credentials.

Legacy direct integration

This legacy integration directly loads assets directly from from ad.where.com/jin/spotlight/ads.

Sample code

<script type="text/javascript">
  document.write("<scr");
  document.write(
    'ipt type="text/javascript" data-ppmnid="92820893359741" src="//ad.where.com/jin/spotlight/ads?pubid= K94SASJJZDBBQ&format=js&v=2.4&placementtype=120x90&ppmnid=92820893359741&rand=' +
      Math.round(Math.random() * 100000000000000) +
      '">'
  );
  document.write("</scr" + "ipt>");
</script>

Steps

To upgrade, complete the following:

  1. Remove the <script /> tags.
  2. Add the PayPal JavaScript SDK to the <head></head> of your site.
  3. Add div elements with proper attributes where you want to render messages.

Note: The values provided to ppmnid and pubid are different from the client-id required when loading the PayPal JS SDK. If you don't yet know or have your client-id, follow the Get Started instructions to get your PayPal API credentials.