Skip to main content
Use this guide to upgrade your PayPal integration from the JavaScript SDK v5 to the JavaScript SDK v6. The v6 SDK introduces custom elements for UI, uses payment sessions to manage checkout flows, and offers flexible authentication with a client ID or client token.

Compare v5 and v6

The following table shows how the v5 and v6 SDKs are different.

Migration overview

The following sections explain the main changes and concepts you need to consider when upgrading from v5 to v6 of the PayPal JavaScript SDK.

SDK script

In v5, you load the SDK using a script tag with the client ID and configuration directly in the URL.
In v6, you load the SDK core script without the client ID or any configuration in the URL.
v5 uses your client ID in the script URL. v6 uses your client ID in the createInstance call when initializing the SDK (recommended for most integrations):
Alternative: Client Token For specific features like PayPal payment vaulting or Fastlane, you’ll need to use client token authentication instead:
See Authenticate the SDK for details on when to use each method.

Render payment buttons

In v5, you render PayPal buttons directly through paypal.Buttons().render().
In v6, you use custom elements for payment buttons. You control visibility and actions in JavaScript.

Manage orders and callbacks

In v5, you define createOrder and onApprove inside the button configuration.
In v6, you define these as standalone functions and pass them to the payment session.

Handle sessions and button events

In v5, you handle button logic inside the paypal.Buttons configuration. In v6, you create a payment session and attach a click handler to the button.

Check eligibility

In v5, eligibility checks are built in internally before rendering each button. In v6, you check eligibility with the findEligibleMethods method or by calling the server-side API.

Summary of changes

  • v6 uses client ID authentication (similar to v5) for most integrations, making migration straightforward. A client token is required only for specific features like PayPal vaulting and Fastlane.
  • You use custom elements and payment sessions instead of button configurations.
  • Built-in methods to check payment method availability.
  • Load only the components you need for your integration.
  • You pass callbacks directly to checkout sessions instead of button configurations.
For detailed code samples and advanced scenarios, see the Javascript SDK v6 examples on GitHub.