Compare v5 and v6
The following table shows how the v5 and v6 SDKs are different.| Feature | v5 | v6 |
|---|---|---|
| SDK script URL | You load the SDK with https://www.paypal.com/sdk/js?client-id=YOUR_CLIENT_ID¤cy=USD. | You load the SDK with https://www.sandbox.paypal.com/web-sdk/v6/core. |
Global paypal object | All features are available from the global object. | You call createInstance, which sets up the SDK. |
| Button rendering | You render buttons with paypal.Buttons({ ... }).render(). | You use <paypal-button/> with an event listener and call session.start(). |
| Callbacks | You pass callbacks into paypal.Buttons(). | You pass callbacks into a checkout session, such as createPayPalOneTimePaymentSession. |
| Venmo support | Venmo is included automatically in the smart stack. | You enable Venmo with the venmo-payments component. |
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.Authentication: Client ID (Recommended)
v5 uses your client ID in the script URL. v6 uses your client ID in thecreateInstance call when initializing the SDK (recommended for most integrations):
Render payment buttons
In v5, you render PayPal buttons directly throughpaypal.Buttons().render().
Manage orders and callbacks
In v5, you definecreateOrder and onApprove inside the button configuration.
Handle sessions and button events
In v5, you handle button logic inside thepaypal.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 thefindEligibleMethods 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.