Include the SDK script
Include the v6 SDK script on each page of your site that needs to accept payments.Initialize the v6 SDK
Usewindow.paypal.createInstance()
to initialize the SDK with your server-generated client token and configure components, locale, and page type settings. The method returns an SDK instance that provides access to payment eligibility checking and session creation methods.
window.paypal.createInstance(options)
Use paypal.createInstance
to initialize the PayPal SDK with your client token and configuration. This method configures the SDK for your specific integration needs and returns an SDK instance that you’ll use to create payment sessions.
The client token authenticates your integration and must be generated server-side. This token is domain-bound for security and expires after 15 minutes.
Parameters
Parameter | Required | Description |
---|---|---|
clientToken | yes | string. A secure, browser-safe token generated by your server using your PayPal client ID and secret. This token authenticates all SDK operations and is bound to your domain for security. The token expires after 15 minutes and cannot be refreshed—you must generate a new token when needed. |
components | no | string[] An array of SDK components to load for your integration. Each component enables specific payment functionality. Available components:
Default: |
pageType | no | string. The type of page where the SDK is being initialized. This helps PayPal optimize the payment experience and provide better analytics. Accepted values:
|
locale | no | string. The locale for the SDK UI components, specified as a BCP-47 language tag (e.g., “en-US”, “fr-FR”, “de-DE”). If not specified, the SDK automatically detects the buyer’s locale from their browser settings. |
clientMetadataId | no | string. A unique identifier for tracking and debugging purposes. You can generate this using |
Returns
Returns a Promise that resolves to an SDK instance object. This instance provides methods for checking payment eligibility and creating payment sessions.findEligibleMethods()
- Check payment method availabilitycreatePayPalOneTimePaymentSession()
- Create payment sessionscreateFastlane()
- Initialize accelerated checkout