braintree-web/paypal-checkout-v6

A component to integrate with the PayPal Web SDK v6.

Source:

Members

(static) VERSION :string

The current version of the SDK, i.e. 3.136.0.

Source:

Methods

(static) create(options, callbackopt) → {Promise|void}

Creates a PayPal Checkout V6 component instance. See the PayPalCheckoutV6 class for usage examples.

Parameters:
Name Type Attributes Description
options object

Creation options:

Properties
Name Type Attributes Description
client Client <optional>

A Client instance.

authorization string <optional>

A clientToken. Can be used in place of options.client. Note: V6 requires client tokens; tokenization keys are not supported.

merchantAccountId string <optional>

A non-default merchant account ID to use for tokenization.

callback callback <optional>

The second argument, data, is the PayPalCheckoutV6 instance.

Source:
Example
braintree.client.create({
  authorization: 'CLIENT_TOKEN_FROM_SERVER'
}).then(function (clientInstance) {
  return braintree.paypalCheckoutV6.create({
    client: clientInstance
  });
}).then(function (paypalCheckoutV6Instance) {
  // Load the PayPal V6 SDK
  return paypalCheckoutV6Instance.loadPayPalSDK();
}).then(function (paypalCheckoutV6Instance) {
  // Create payment session
  var session = paypalCheckoutV6Instance.createOneTimePaymentSession({
    amount: '10.00',
    currency: 'USD',
    onApprove: function (data) {
      return paypalCheckoutV6Instance.tokenizePayment(data);
    }
  });

  // Start payment on button click
  document.querySelector('#paypal-button').addEventListener('click', function () {
    session.start();
  });
}).catch(function (err) {
  console.error('Error!', err);
});

(static) isSupported() → {Boolean}

Returns true if PayPal Checkout supports this browser.

Deprecated:
  • Previously, this method checked for Popup support in the browser. The PayPal JS SDK now falls back to a modal if popups are not supported.

Source: