diff --git a/3.111.1/AmericanExpress.html b/3.111.1/AmericanExpress.html new file mode 100644 index 00000000..f3018385 --- /dev/null +++ b/3.111.1/AmericanExpress.html @@ -0,0 +1,1057 @@ + + + + + + + + + AmericanExpress - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ AmericanExpress +

+ + + + +
+
+ +

+ + AmericanExpress + +

+ + +
+

This class allows you use a nonce to interact with American Express Checkout. To accept American Express cards, use Hosted Fields.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new AmericanExpress(options) +

+
+ + + + + +
+

You cannot use this constructor directly. Use braintree.american-express.create instead.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

Options

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ getExpressCheckoutProfile(options, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Gets the Express Checkout nonce profile given a nonce from American Express.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Request options

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nonce + + + + string + + + + + + + +

An existing nonce from American Express (note that this is not a nonce from Braintree).

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the returned server data. If no callback is provided, getExpressCheckoutProfile returns a promise that resolves with the server data.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
var americanExpress = require('braintree-web/american-express');
+
+americanExpress.create({client: clientInstance}, function (createErr, americanExpressInstance) {
+  var options = {nonce: existingAmericanExpressNonce};
+  americanExpressInstance.getExpressCheckoutProfile(options, function (getErr, payload) {
+    if (getErr) {
+      // Handle error
+      return;
+    }
+
+    console.log('Number of cards: ' + payload.amexExpressCheckoutCards.length);
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ getRewardsBalance(options, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Gets the rewards balance associated with a Braintree nonce.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Request options

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nonce + + + + string + + + + + + + +

An existing Braintree nonce.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the returned server data. If no callback is provided, getRewardsBalance returns a promise that resolves with the server data.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
var americanExpress = require('braintree-web/american-express');
+
+americanExpress.create({client: clientInstance}, function (createErr, americanExpressInstance) {
+  var options = {nonce: existingBraintreeNonce};
+  americanExpressInstance.getRewardsBalance(options, function (getErr, payload) {
+    if (getErr || payload.error) {
+      // Handle error
+      return;
+    }
+
+    console.log('Rewards amount: ' + payload.rewardsAmount);
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ teardown(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Cleanly tear down anything set up by create.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called once teardown is complete. No data is returned if teardown completes successfully.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
americanExpressInstance.teardown();
+ +

+ With callback +

+ + +
americanExpressInstance.teardown(function () {
+  // teardown is complete
+});
+ + +
+ + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/ApplePay.html b/3.111.1/ApplePay.html new file mode 100644 index 00000000..b32ecd00 --- /dev/null +++ b/3.111.1/ApplePay.html @@ -0,0 +1,2084 @@ + + + + + + + + + ApplePay - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ApplePay +

+ + + + +
+
+ +

+ + ApplePay + +

+ + +
+

This class represents an Apple Pay component. Instances of this class have methods for validating the merchant server and tokenizing payments.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new ApplePay(options) +

+
+ + + + + +
+

You cannot use this constructor directly. Use braintree.applePay.create instead.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

Options

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ merchantIdentifier +

+ + + + +
+

A special merchant ID which represents the merchant association with Braintree. Required when using ApplePaySession.canMakePaymentsWithActiveCard.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + +
Example
+ + +
var promise = ApplePaySession.canMakePaymentsWithActiveCard(applePayInstance.merchantIdentifier);
+promise.then(function (canMakePaymentsWithActiveCard) {
+  if (canMakePaymentsWithActiveCard) {
+    // Set up Apple Pay buttons
+  }
+});
+ + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ createPaymentRequest(paymentRequest) → {external:ApplePayPaymentRequest|Promise} +

+
+ + + + + +
+

Merges a payment request with Braintree defaults to return an {external:ApplePayPaymentRequest}.

+

The following properties are assigned to paymentRequest if not already defined. Their default values come from the Braintree gateway.

+
    +
  • countryCode
  • +
  • currencyCode
  • +
  • merchantCapabilities
  • +
  • supportedNetworks
  • +
+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
paymentRequest + + + + external:ApplePayPaymentRequest + + + + + + + +

The payment request details to apply on top of those from Braintree.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
var applePay = require('braintree-web/apple-pay');
+
+applePay.create({client: clientInstance}, function (applePayErr, applePayInstance) {
+  if (applePayErr) {
+    // Handle error here
+    return;
+  }
+
+  var paymentRequest = applePayInstance.createPaymentRequest({
+    total: {
+      label: 'My Company',
+      amount: '19.99'
+    }
+  });
+
+  var session = new ApplePaySession(3, paymentRequest);
+
+  // ...
+ +

+ With deferred client +

+ + +
var applePay = require('braintree-web/apple-pay');
+
+applePay.create({
+  authorization: 'client-token-or-tokenization-key',
+  useDeferredClient: true
+}, function (applePayErr, applePayInstance) {
+  if (applePayErr) {
+    // Handle error here
+    return;
+  }
+
+  applePayInstance.createPaymentRequest({
+    total: {
+      label: 'My Company',
+      amount: '19.99'
+    }
+  }).then(function (paymentRequest) {
+    var session = new ApplePaySession(3, paymentRequest);
+
+    // ...
+  });
+ + +
+ + + + + + + + + + + + + + +

+ performValidation(options, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Validates your merchant website, as required by ApplePaySession before payment can be authorized.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Options

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
validationURL + + + + string + + + + + + + +

The validationURL from an ApplePayValidateMerchantEvent.

+ +
displayName + + + + string + + + + + + + +

The canonical name for your store. Use a non-localized name. This parameter should be a UTF-8 string that is a maximum of 64 characters. The system may display this name to the user.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the Apple Pay merchant session object. If no callback is provided, performValidation returns a promise. +Pass the merchant session to your Apple Pay session's completeMerchantValidation method.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
var applePay = require('braintree-web/apple-pay');
+
+applePay.create({client: clientInstance}, function (applePayErr, applePayInstance) {
+  if (applePayErr) {
+    // Handle error here
+    return;
+  }
+
+  var paymentRequest = applePayInstance.createPaymentRequest({
+    total: {
+      label: 'My Company',
+      amount: '19.99'
+    }
+  });
+  var session = new ApplePaySession(3, paymentRequest);
+
+  session.onvalidatemerchant = function (event) {
+    applePayInstance.performValidation({
+      validationURL: event.validationURL,
+      displayName: 'My Great Store'
+    }, function (validationErr, validationData) {
+      if (validationErr) {
+        console.error(validationErr);
+        session.abort();
+        return;
+      }
+
+      session.completeMerchantValidation(validationData);
+    });
+  };
+});
+ + +
+ + + + + + + + + + + + + + +

+ teardown(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Cleanly tear down anything set up by create.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called once teardown is complete. No data is returned if teardown completes successfully.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
applePayInstance.teardown();
+ +

+ With callback +

+ + +
applePayInstance.teardown(function () {
+  // teardown is complete
+});
+ + +
+ + + + + + + + + + + + + + +

+ tokenize(options, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Tokenizes an Apple Pay payment. This will likely be called in your ApplePaySession's onpaymentauthorized callback.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Options

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
token + + + + object + + + + + + + +

The payment.token property of an external:ApplePayPaymentAuthorizedEvent.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is a tokenizePayload. If no callback is provided, tokenize returns a promise that resolves with a tokenizePayload.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
var applePay = require('braintree-web/apple-pay');
+
+applePay.create({client: clientInstance}, function (applePayErr, applePayInstance) {
+  if (applePayErr) {
+    // Handle error here
+    return;
+  }
+
+  var paymentRequest = applePayInstance.createPaymentRequest({
+    total: {
+      label: 'My Company',
+      amount: '19.99'
+    }
+  });
+  var session = new ApplePaySession(3, paymentRequest);
+
+  session.onpaymentauthorized = function (event) {
+    applePayInstance.tokenize({
+      token: event.payment.token
+    }, function (tokenizeErr, tokenizedPayload) {
+      if (tokenizeErr) {
+        session.completePayment(ApplePaySession.STATUS_FAILURE);
+        return;
+      }
+      // Send the tokenizedPayload to your server here!
+
+      // Once the transaction is complete, call completePayment
+      // to close the Apple Pay sheet
+      session.completePayment(ApplePaySession.STATUS_SUCCESS);
+    });
+  };
+
+  // ...
+});
+ + +
+ + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ tokenizePayload :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nonce + + + + string + + + + + + + +

The payment method nonce.

+
details + + + + object + + + + + + + +

Additional details.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
cardType + + + + string + + + + + + + +

Type of card, ex: Visa, MasterCard.

+
cardHolderName + + + + string + + + + + + + +

The name of the card holder.

+
dpanLastTwo + + + + string + + + + + + + +

Last two digits of card number.

+
+ +
description + + + + string + + + + + + + +

A human-readable description.

+
type + + + + string + + + + + + + +

The payment method type, always ApplePayCard.

+
binData + + + + object + + + + + + + +

Information about the card based on the bin.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
commercial + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
countryOfIssuance + + + + string + + + + + + + +

The country of issuance.

+
debit + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
durbinRegulated + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
healthcare + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
issuingBank + + + + string + + + + + + + +

The issuing bank.

+
payroll + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
prepaid + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
productId + + + + string + + + + + + + +

The product id.

+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/BraintreeError.html b/3.111.1/BraintreeError.html new file mode 100644 index 00000000..030caf5a --- /dev/null +++ b/3.111.1/BraintreeError.html @@ -0,0 +1,9775 @@ + + + + + + + + + BraintreeError - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ BraintreeError +

+ + + + +
+
+ +

+ + BraintreeError + +

+ + +
+

This class is used to report error conditions, frequently as the first parameter to callbacks throughout the Braintree SDK.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new BraintreeError(options) +

+
+ + + + + +
+

You cannot use this constructor directly. Interact with instances of this class through callbacks.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

Construction options

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) American Express - getExpressCheckoutProfile Error Codes +

+ + + + +
+

Errors that occur when creating components.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
AMEX_NONCE_REQUIRED + + + + MERCHANT + + + + + + + +

Occurs when a nonce is not provided to method.

+
AMEX_NETWORK_ERROR + + + + NETWORK + + + + + + + +

Occurs when there is an error communicating with the Braintree gateway.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) American Express - getRewardsBalance Error Codes +

+ + + + +
+

Errors that occur when creating components.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
AMEX_NONCE_REQUIRED + + + + MERCHANT + + + + + + + +

Occurs when a nonce is not provided to method.

+
AMEX_NETWORK_ERROR + + + + NETWORK + + + + + + + +

Occurs when there is an error communicating with the Braintree gateway.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Apple Pay - Creation Error Codes +

+ + + + +
+

Errors that occur when creating the Apple Pay component.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
APPLE_PAY_NOT_ENABLED + + + + MERCHANT + + + + + + + +

Occurs when the authorization used is not authorized to process Apple Pay.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Apple Pay - performValidation Error Codes +

+ + + + +
+

Errors that occur when validating.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
APPLE_PAY_VALIDATION_URL_REQUIRED + + + + MERCHANT + + + + + + + +

Occurs when the validationURL option is not passed in.

+
APPLE_PAY_MERCHANT_VALIDATION_FAILED + + + + MERCHANT + + + + + + + +

Occurs when the website domain has not been registered in the Braintree control panel.

+
APPLE_PAY_MERCHANT_VALIDATION_NETWORK + + + + NETWORK + + + + + + + +

Occurs when an unknown network error occurs.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Apple Pay - tokenize Error Codes +

+ + + + +
+

Errors that occur when tokenizing.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
APPLE_PAY_PAYMENT_TOKEN_REQUIRED + + + + MERCHANT + + + + + + + +

Occurs when the token option is not passed in.

+
APPLE_PAY_TOKENIZATION + + + + NETWORK + + + + + + + +

Occurs when an unknown network error occurs.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Client - Create Error Codes +

+ + + + +
+

Errors that may occur when creating the client

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
CLIENT_INVALID_AUTHORIZATION + + + + MERCHANT + + + + + + + +

Occurs when client token cannot be parsed.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Client - Request Error Codes +

+ + + + +
+

Errors that may occur when using the request method

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
CLIENT_OPTION_REQUIRED + + + + MERCHANT + + + + + + + +

An option required in the request method was not provided. Usually options.method or options.endpoint

+
CLIENT_OPTION_INVALID + + + + MERCHANT + + + + + + + +

The request option provided is invalid.

+
CLIENT_GATEWAY_NETWORK + + + + MERCHANT + + + + + + + +

The Braintree gateway could not be contacted.

+
CLIENT_REQUEST_TIMEOUT + + + + NETWORK + + + + + + + +

The request took too long to complete and timed out.

+
CLIENT_REQUEST_ERROR + + + + NETWORK + + + + + + + +

The response from a request had status 400 or greater.

+
CLIENT_GRAPHQL_REQUEST_ERROR + + + + NETWORK + + + + + + + +

The response from a request to GraphQL contained an error.

+
CLIENT_RATE_LIMITED + + + + MERCHANT + + + + + + + +

The response from a request had a status of 429, indicating rate limiting.

+
CLIENT_AUTHORIZATION_INSUFFICIENT + + + + MERCHANT + + + + + + + +

The user associated with the client token or tokenization key does not have permissions to make the request.

+
CLIENT_AUTHORIZATION_INVALID + + + + MERCHANT + + + + + + + +

The provided authorization could not be found. Either the client token has expired and a new client token must be generated or the tokenization key used is set to be inactive or has been deleted.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) 3D Secure - cancelVerifyCard Error Codes +

+ + + + +
+

Errors that occur when using the cancelVerifyCard method.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
THREEDS_NO_VERIFICATION_PAYLOAD + + + + MERCHANT + + + + + + + +

Occurs when the 3D Secure flow is canceled, but there is no 3D Secure information available.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) 3D Secure - Creation Error Codes +

+ + + + +
+

Errors that occur when creating the 3D Secure component.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
THREEDS_NOT_ENABLED + + + + MERCHANT + + + + + + + +

Occurs when 3D Secure is not enabled in the Braintree control panel.

+
THREEDS_CAN_NOT_USE_TOKENIZATION_KEY + + + + MERCHANT + + + + + + + +

Occurs when 3D Secure component is created without a Client Token.

+
THREEDS_HTTPS_REQUIRED + + + + MERCHANT + + + + + + + +

Occurs when 3D Secure component is created in production over HTTPS.

+
THREEDS_NOT_ENABLED_FOR_V2 + + + + MERCHANT + + + + + + + +

Occurs when 3D Secure component is created with version 2 parameter, but merchant is not enabled to use version 2.

+
THREEDS_UNRECOGNIZED_VERSION + + + + MERCHANT + + + + + + + +

Occurs when unrecognized version enum is passed into the create call.

+
THREEDS_CARDINAL_SDK_SETUP_FAILED + + + + UNKNOWN + + + + + + + +

Occurs when Cardinal's Songbird.js library fails to setup for an unknown reason.

+
THREEDS_CARDINAL_SDK_SCRIPT_LOAD_FAILED + + + + NETWORK + + + + + + + +

Occurs when using version 2 and Cardinal's Songbird.js script could not be loaded.

+
THREEDS_CARDINAL_SDK_SETUP_TIMEDOUT + + + + UNKNOWN + + + + + + + +

Occurs when Cardinal's Songbird.js library takes longer than 60 seconds to set up.

+
THREEDS_CARDINAL_SDK_RESPONSE_TIMEDOUT + + + + UNKNOWN + + + + + + + +

Occurs when Cardinal sends a response indicating a timeout on /Validate, /Confirm, or /Continue.

+
THREEDS_CARDINAL_SDK_BAD_CONFIG + + + + MERCHANT + + + + + + + +

Occurs when there is no JWT in the request. Also when there's some other malformed aspect of config.

+
THREEDS_CARDINAL_SDK_BAD_JWT + + + + MERCHANT + + + + + + + +

Occurs when a malformed config causes a either a missing response JWT or a malformed Cardinal response.

+
THREEDS_CARDINAL_SDK_ERROR + + + + UNKNOWN + + + + + + + +

Occurs when a "general error" or a Cardinal hosted fields error happens. Description contains more details.

+
THREEDS_CARDINAL_SDK_CANCELED + + + + CUSTOMER + + + + + + + +

Occurs when customer cancels the transaction mid-flow, usually with alt-pays that have their own cancel buttons.

+
THREEDS_UNSUPPORTED_VERSION + + + + MERCHANT + + + + + + + +

Occurs when 3D Secure component is created with version 1 (or default version) parameter.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) 3D Secure - verifyCard Error Codes +

+ + + + +
+

Errors that occur when using the verifyCard method.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
THREEDS_AUTHENTICATION_IN_PROGRESS + + + + MERCHANT + + + + + + + +

Occurs when another verification is already in progress.

+
THREEDS_MISSING_VERIFY_CARD_OPTION + + + + MERCHANT + + + + + + + +

Occurs when a required option is missing.

+
THREEDS_JWT_AUTHENTICATION_FAILED + + + + UNKNOWN + + + + + + + +

Occurs when something went wrong authenticating the JWT from the Cardinal SDK.

+
THREEDS_LOOKUP_TOKENIZED_CARD_NOT_FOUND_ERROR + + + + MERCHANT + + + + + + + +

Occurs when the supplied payment method nonce does not exist or the payment method nonce has already been consumed.

+
THREEDS_LOOKUP_VALIDATION_ERROR + + + + CUSTOMER + + + + + + + +

Occurs when a validation error occurs during the 3D Secure lookup.

+
THREEDS_LOOKUP_ERROR + + + + UNKNOWN + + + + + + + +

An unknown error occurred while attempting the 3D Secure lookup.

+
THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT + + + + MERCHANT + + + + + + + +

Occurs when the 3D Secure flow is canceled by the merchant using cancelVerifyCard (3D Secure v2 flows only).

+
THREEDS_INLINE_IFRAME_DETAILS_INCORRECT + + + + UNKNOWN + + + + + + + +

An unknown error occurred while attempting to use the inline iframe framework.

+
THREEDS_REQUESTED_EXEMPTION_TYPE_INVALID + + + + MERCHANT + + + + + + + +

Occurs when unrecognized exemption enum value is passed into verifyCard.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Data Collector - Creation Error Codes +

+ + + + +
+

Errors that occur when creating the Data Collector component.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
DATA_COLLECTOR_KOUNT_NOT_ENABLED + + + + MERCHANT + + + + + + + +

Occurs when Kount is enabled in creation options but is not enabled on the Braintree control panel.

+
DATA_COLLECTOR_KOUNT_ERROR + + + + MERCHANT + + + + + + + +

Occurs when Kount errors while setting up.

+
DATA_COLLECTOR_REQUIRES_CREATE_OPTIONS + + + + MERCHANT + + + + + + + +

Occurs when Kount or PayPal Fraudnet could not be enabled.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Google Payment - Creation Error Codes +

+ + + + +
+

Errors that occur when creating the Google Payment component.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
GOOGLE_PAYMENT_NOT_ENABLED + + + + MERCHANT + + + + + + + +

Occurs when Google Pay is not enabled on the Braintree control panel.

+
GOOGLE_PAYMENT_UNSUPPORTED_VERSION + + + + MERCHANT + + + + + + + +

Occurs when a Google Pay version is used that is not supported by the Braintree SDK.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Google Payment - parseResponse Error Codes +

+ + + + +
+

Errors that occur when parsing the response from Google.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
GOOGLE_PAYMENT_GATEWAY_ERROR + + + + UNKNOWN + + + + + + + +

Occurs when Google Pay could not be tokenized.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Hosted Fields - Creation Error Codes +

+ + + + +
+

Errors that occur when creating the Hosted Fields component.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
HOSTED_FIELDS_TIMEOUT + + + + UNKNOWN + + + + + + + +

Occurs when Hosted Fields does not finish setting up within 60 seconds.

+
HOSTED_FIELDS_INVALID_FIELD_KEY + + + + MERCHANT + + + + + + + +

Occurs when Hosted Fields is instantiated with an invalid Field option.

+
HOSTED_FIELDS_INVALID_FIELD_SELECTOR + + + + MERCHANT + + + + + + + +

Occurs when Hosted Fields given a field selector that is not valid.

+
HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME + + + + MERCHANT + + + + + + + +

Occurs when Hosted Fields given a field selector that already contains an iframe.

+
HOSTED_FIELDS_FIELD_PROPERTY_INVALID + + + + MERCHANT + + + + + + + +

Occurs when a field configuration option is not valid.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Hosted Fields - Field Manipulation Error Codes +

+ + + + +
+

Errors that occur when modifying fields through addClass, removeClass, setAttribute, removeAttribute, clear, focus, and setMonthOptions.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
HOSTED_FIELDS_FIELD_INVALID + + + + MERCHANT + + + + + + + +

Occurs when attempting to modify a field that is not a valid Hosted Fields option.

+
HOSTED_FIELDS_FIELD_NOT_PRESENT + + + + MERCHANT + + + + + + + +

Occurs when attempting to modify a field that is not configured with Hosted Fields.

+
HOSTED_FIELDS_FIELD_PROPERTY_INVALID + + + + MERCHANT + + + + + + + +

Occurs when a field configuration option is not valid.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Hosted Fields - Set Attribute Error Codes +

+ + + + +
+

Errors that occur when using the setAttribute method

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED + + + + MERCHANT + + + + + + + +

Occurs when trying to set an attribute that is not supported to be set.

+
HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED + + + + MERCHANT + + + + + + + +

Occurs when the type of value for an attribute is not allowed to be set.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Hosted Fields - Tokenize Error Codes +

+ + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR + + + + NETWORK + + + + + + + +

Occurs when the Braintree gateway cannot be contacted.

+
HOSTED_FIELDS_TOKENIZATION_FAIL_ON_DUPLICATE + + + + CUSTOMER + + + + + + + +

Occurs when attempting to vault a card, but the client token being used is configured to fail if the card already exists in the vault.

+
HOSTED_FIELDS_TOKENIZATION_CVV_VERIFICATION_FAILED + + + + CUSTOMER + + + + + + + +

Occurs when cvv verification is turned on in the Braintree control panel.

+
HOSTED_FIELDS_FAILED_TOKENIZATION + + + + CUSTOMER + + + + + + + +

Occurs when the credit card details were sent to Braintree, but failed to tokenize.

+
HOSTED_FIELDS_FIELDS_EMPTY + + + + CUSTOMER + + + + + + + +

Occurs when all the Hosted Fields inputs are empty.

+
HOSTED_FIELDS_FIELDS_INVALID + + + + CUSTOMER + + + + + + + +

Occurs when one ore more fields are invalid.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) LocalPayment - Creation Error Codes +

+ + + + +
+

Errors that occur when creating the Local Payment component.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
LOCAL_PAYMENT_NOT_ENABLED + + + + MERCHANT + + + + + + + +

Occurs when Local Payment is not enabled on the Braintree control panel.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) LocalPayment - startPayment Error Codes +

+ + + + +
+

Errors that occur when using the startPayment method.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
LOCAL_PAYMENT_START_PAYMENT_MISSING_REQUIRED_OPTION + + + + MERCHANT + + + + + + + +

Occurs when a startPayment is missing a required option.

+
LOCAL_PAYMENT_ALREADY_IN_PROGRESS + + + + MERCHANT + + + + + + + +

Occurs when a startPayment call is already in progress.

+
LOCAL_PAYMENT_INVALID_PAYMENT_OPTION + + + + MERCHANT + + + + + + + +

Occurs when a startPayment call has an invalid option.

+
LOCAL_PAYMENT_START_PAYMENT_FAILED + + + + NETWORK + + + + + + + +

Occurs when a startPayment call fails.

+
LOCAL_PAYMENT_TOKENIZATION_FAILED + + + + NETWORK + + + + + + + +

Occurs when a startPayment call fails to tokenize the result from authorization.

+
LOCAL_PAYMENT_CANCELED + + + + CUSTOMER + + + + + + + +

Occurs when the customer cancels the Local Payment.

+
LOCAL_PAYMENT_WINDOW_CLOSED + + + + CUSTOMER + + + + + + + +

Occurs when the customer closes the Local Payment window.

+
LOCAL_PAYMENT_WINDOW_OPEN_FAILED + + + + MERCHANT + + + + + + + +

Occurs when the Local Payment window fails to open. Usually because startPayment was not called as a direct result of a user action.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Masterpass - Creation Error Codes +

+ + + + +
+

Errors that occur when creating the Masterpass component.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
MASTERPASS_BROWSER_NOT_SUPPORTED + + + + CUSTOMER + + + + + + + +

Occurs when browser is not a supported browser for Masterpass.

+
MASTERPASS_NOT_ENABLED + + + + MERCHANT + + + + + + + +

Occurs when Masterpass is not enabled in the Braintree control panel.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Masterpass - Tokenize Error Codes +

+ + + + +
+

Errors that occur when tokenizing.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
MASTERPASS_TOKENIZE_MISSING_REQUIRED_OPTION + + + + MERCHANT + + + + + + + +

Occurs when tokenize is called without a required option.

+
MASTERPASS_TOKENIZATION_ALREADY_IN_PROGRESS + + + + MERCHANT + + + + + + + +

Occurs if tokenization flow is initialized while another flow is already in progress.

+
MASTERPASS_ACCOUNT_TOKENIZATION_FAILED + + + + NETWORK + + + + + + + +

Occurs when tokenization of Masterpass details fails.

+
MASTERPASS_POPUP_OPEN_FAILED + + + + MERCHANT + + + + + + + +

Occurs when the popup fails to open.

+
MASTERPASS_POPUP_MISSING_REQUIRED_PARAMETERS + + + + MERCHANT + + + + + + + +

Occurs when Masterpass is missing required parameters for tokenization.

+
MASTERPASS_POPUP_CLOSED + + + + CUSTOMER + + + + + + + +

Occurs when the popup is closed by the customer.

+
MASTERPASS_INVALID_PAYMENT_OPTION + + + + MERCHANT + + + + + + + +

Occurs when an invalid payment option is used to tokenize Masterpass.

+
MASTERPASS_FLOW_FAILED + + + + NETWORK + + + + + + + +

Occurs when an error is returned from request to tokenize.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Payment Request - canMakePayment Error Codes +

+ + + + +
+

Errors that occur when using the canMakePayment method

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED + + + + MERCHANT + + + + + + + +

Occurs when the Payment Request is instantiated with misconfigured options.

+
PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED + + + + MERCHANT + + + + + + + +

Occurs when canMakePayment results in a DomException with a NotAllowedError. This usually occurs when canMakePayment is called multiple times with different supported payment options.

+
PAYMENT_REQUEST_UNSUPPORTED_PAYMENT_METHOD + + + + MERCHANT + + + + + + + +

Occurs when canMakePayment is called with a supportedPaymentMethods array that contains a payment method that is not supported by the Braintree SDK.

+
PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED + + + + UNKNOWN + + + + + + + +

Occurs when canMakePayment fails for any reason other than a misconfigured Payment Request object.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Payment Request - createSupportedPaymentMethodsConfiguration Error Codes +

+ + + + +
+

Errors that occur when using the createSupportedPaymentMethodsConfiguration method

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_MUST_INCLUDE_TYPE + + + + MERCHANT + + + + + + + +

Occurs when no type is supplied for method.

+
PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_TYPE_NOT_ENABLED + + + + MERCHANT + + + + + + + +

Occurs when configured type is not enabled.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Payment Request - Creation Error Codes +

+ + + + +
+

Errors that occur when creating the Payment Request component.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
PAYMENT_REQUEST_NO_VALID_SUPPORTED_PAYMENT_METHODS + + + + MERCHANT + + + + + + + +

Occurs when there are no valid payment methods configured.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Payment Request - tokenize Error Codes +

+ + + + +
+

Errors that occur when using the tokenize method

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
PAYMENT_REQUEST_CANCELED + + + + CUSTOMER + + + + + + + +

Occurs when customer cancels the Payment Request.

+
PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED + + + + MERCHANT + + + + + + + +

Occurs when the Payment Request is closed do to the options being misconfigured.

+
PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE + + + + MERCHANT + + + + + + + +

Occurs when a Google Payment payment method is unable to be tokenized.

+
PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR + + + + UNKNOWN + + + + + + + +

Occurs when the result of tokenizing a Google Payment payment method could not be parsed.

+
PAYMENT_REQUEST_NOT_COMPLETED + + + + CUSTOMER + + + + + + + +

Occurs when an error prevented the Payment Request from being completed.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) PayPal - Creation Error Codes +

+ + + + +
+

Errors that occur when creating the PayPal component.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
PAYPAL_NOT_ENABLED + + + + MERCHANT + + + + + + + +

Occurs when PayPal is not enabled on the Braintree control panel.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) PayPal - tokenize Error Codes +

+ + + + +
+

Errors that occur when using the tokenize method.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
PAYPAL_TOKENIZATION_REQUEST_ACTIVE + + + + MERCHANT + + + + + + + +

Occurs when a tokenization request is already in progress.

+
PAYPAL_FLOW_OPTION_REQUIRED + + + + MERCHANT + + + + + + + +

Occurs when flow option is not provided.

+
PAYPAL_ACCOUNT_TOKENIZATION_FAILED + + + + NETWORK + + + + + + + +

Occurs when PayPal account could not be tokenized.

+
PAYPAL_FLOW_FAILED + + + + NETWORK + + + + + + + +

Occurs when PayPal flow could not be initiated.

+
PAYPAL_POPUP_OPEN_FAILED + + + + MERCHANT + + + + + + + +

Occurs when PayPal window could not be opened.

+
PAYPAL_POPUP_CLOSED + + + + CUSTOMER + + + + + + + +

Occurs when customer closes the PayPal window before completing the flow.

+
PAYPAL_INVALID_PAYMENT_OPTION + + + + MERCHANT + + + + + + + +

Occurs when an invalid payment option is passed.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) PayPal Checkout - createPayment Error Codes +

+ + + + +
+

Errors that occur when using the createPayment method.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
PAYPAL_FLOW_OPTION_REQUIRED + + + + MERCHANT + + + + + + + +

Occurs when a required option is missing.

+
PAYPAL_INVALID_PAYMENT_OPTION + + + + MERCHANT + + + + + + + +

Occurs when an option contains an invalid value.

+
PAYPAL_FLOW_FAILED + + + + NETWORK + + + + + + + +

Occurs when something goes wrong when initializing the flow.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) PayPal Checkout - Creation Error Codes +

+ + + + +
+

Errors that occur when creating the PayPal Checkout component.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
PAYPAL_NOT_ENABLED + + + + MERCHANT + + + + + + + +

Occurs when PayPal is not enabled on the Braintree control panel.

+
PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED + + + + MERCHANT + + + + + + + +

Occurs only when testing in Sandbox, when a PayPal sandbox account is not linked to the merchant account in the Braintree control panel.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) PayPal Checkout - startVaultInitiatedCheckout Error Codes +

+ + + + +
+

Errors that occur when using the startVaultInitiatedCheckout method.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED + + + + MERCHANT + + + + + + + +

Occurs when a required param is missing when calling the method.

+
PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED + + + + MERCHANT + + + + + + + +

Occurs when PayPal window could not be opened. This often occurs because the call to start the vault initiated flow was not triggered from a click event.

+
PAYPAL_START_VAULT_INITIATED_CHECKOUT_CANCELED + + + + CUSTOMER + + + + + + + +

Occurs when a customer closes the PayPal flow before completion.

+
PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS + + + + MERCHANT + + + + + + + +

Occurs when the flow is initialized while an authorization is already in progress.

+
PAYPAL_START_VAULT_INITIATED_CHECKOUT_SETUP_FAILED + + + + NETWORK + + + + + + + +

Occurs when something went wrong setting up the flow.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) PayPal Checkout - tokenizePayment Error Codes +

+ + + + +
+

Errors that occur when using the tokenizePayment method.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
PAYPAL_ACCOUNT_TOKENIZATION_FAILED + + + + NETWORK + + + + + + + +

Occurs when PayPal account could not be tokenized.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Paypal Checkout - updatePayment Error Codes +

+ + + + +
+

Errors that occur when using the updatePayment method.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
PAYPAL_INVALID_PAYMENT_OPTION + + + + MERCHANT + + + + + + + +

Occurs when an option contains an invalid value.

+
PAYPAL_MISSING_REQUIRED_OPTION + + + + MERCHANT + + + + + + + +

Occurs when a required option is missing.

+
PAYPAL_FLOW_FAILED + + + + NETWORK + + + + + + + +

Occurs when something goes wrong when initializing the flow or communicating with the server.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) SEPA - tokenize Error Codes +

+ + + + +
+

Errors that occur when using the sepa.tokenize method.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
SEPA_CREATE_MANDATE_FAILED + + + + MERCHANT + + + + + + + +

Occurs when there was an issue creating a mandate. This can occur if the request fails, or if the merchant does not have SEPA enabled.

+
SEPA_CUSTOMER_CANCELED + + + + CUSTOMER + + + + + + + +

Occurs when the customer has canceled the SEPA authorization process. This can be within the mandate approval popup, or by canceling the popup itself.

+
SEPA_INVALID_MANDATE_TYPE + + + + MERCHANT + + + + + + + +

Occurs when an invalid mandate type is provided.

+
SEPA_TOKENIZATION_FAILED + + + + UNKNOWN + + + + + + + +

Occurs when tokenization fails during the mandate approval process for unknown reasons.

+
SEPA_TOKENIZE_MISSING_REQUIRED_OPTION + + + + MERCHANT + + + + + + + +

Occurs when there are required input options not provided.

+
SEPA_TRANSACTION_FAILED + + + + UNKNOWN + + + + + + + +

Occurs when final tokenization fails.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Shared Errors - Component Creation Error Codes +

+ + + + +
+

Errors that occur when creating components.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
INSTANTIATION_OPTION_REQUIRED + + + + MERCHANT + + + + + + + +

Occurs when a component is created that is missing a required option.

+
INCOMPATIBLE_VERSIONS + + + + MERCHANT + + + + + + + +

Occurs when a component is created with a client with a different version than the component.

+
CLIENT_SCRIPT_FAILED_TO_LOAD + + + + NETWORK + + + + + + + +

Occurs when a component attempts to load the Braintree client script, but the request fails.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Shared Errors - Component Instance Error Codes +

+ + + + +
+

Errors that occur when using instances of components.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
METHOD_CALLED_AFTER_TEARDOWN + + + + MERCHANT + + + + + + + +

Occurs when a method is called on a component instance after it has been torn down.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static, readonly) types +

+ + + + +
+

Enum for BraintreeError types.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
CUSTOMER + + + + string + + + + + + + +

An error caused by the customer.

+
MERCHANT + + + + string + + + + + + + +

An error that is actionable by the merchant.

+
NETWORK + + + + string + + + + + + + +

An error due to a network problem.

+
INTERNAL + + + + string + + + + + + + +

An error caused by Braintree code.

+
UNKNOWN + + + + string + + + + + + + +

An error where the origin is unknown.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Us Bank Account - Creation Error Codes +

+ + + + +
+

Errors that occur when creating the Us Bank Account component.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
US_BANK_ACCOUNT_NOT_ENABLED + + + + MERCHANT + + + + + + + +

Occurs when US Bank Account is not enabled in the Braintree control panel.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Us Bank Account - tokenize Error Codes +

+ + + + +
+

Errors that occur when using the tokenize method.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
US_BANK_ACCOUNT_OPTION_REQUIRED + + + + MERCHANT + + + + + + + +

Occurs when a required option is not passed.

+
US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS + + + + MERCHANT + + + + + + + +

Occurs when 1 or more incompatible options are passed.

+
US_BANK_ACCOUNT_LOGIN_LOAD_FAILED + + + + NETWORK + + + + + + + +

Occurs when bank login flow fails.

+
US_BANK_ACCOUNT_LOGIN_CLOSED + + + + CUSTOMER + + + + + + + +

Occurs when bank login window is closed.

+
US_BANK_ACCOUNT_LOGIN_REQUEST_ACTIVE + + + + MERCHANT + + + + + + + +

Occurs when a bank login flow is already active.

+
US_BANK_ACCOUNT_TOKENIZATION_NETWORK_ERROR + + + + NETWORK + + + + + + + +

Occurs when payment details could not be tokenized.

+
US_BANK_ACCOUNT_FAILED_TOKENIZATION + + + + CUSTOMER + + + + + + + +

Occurs when payment details failed to be tokenized.

+
US_BANK_ACCOUNT_BANK_LOGIN_NOT_ENABLED + + + + MERCHANT + + + + + + + +

Occurs when bank login flow is not enabled in the Braintree control panel.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Vault Manager - deletePaymentMethod Error Codes +

+ + + + +
+

Errors that occur when using the deletePaymentMethod method.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
VAULT_MANAGER_DELETE_PAYMENT_METHOD_NONCE_REQUIRES_CLIENT_TOKEN + + + + MERCHANT + + + + + + + +

Occurs when vault manager is initialized with a tokenization key instead of a Client Token.

+
VAULT_MANAGER_PAYMENT_METHOD_NONCE_NOT_FOUND + + + + MERCHANT + + + + + + + +

Occurs when the specified payment method can not be found.

+
VAULT_MANAGER_DELETE_PAYMENT_METHOD_UNKNOWN_ERROR + + + + UNKNOWN + + + + + + + +

Occurs when there is an error attempting to delete the payment method.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Venmo - Creation Error Codes +

+ + + + +
+

Errors that occur when creating the Venmo component.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
VENMO_NOT_ENABLED + + + + MERCHANT + + + + + + + +

Occurs when Venmo is not enabled on the Braintree control panel.

+
VENMO_INVALID_PROFILE_ID + + + + MERCHANT + + + + + + + +

Occurs when Venmo is initialized with a profile id, but it is invalid.

+
VENMO_MOBILE_POLLING_SETUP_FAILED + + + + UNKNOWN + + + + + + + +

Deprecated No longer returned. Use VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED instead.

+
VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED + + + + UNKNOWN + + + + + + + +

Occurs when the request to set up a Venmo Payment Context object fails.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Venmo - tokenize Error Codes +

+ + + + +
+

Errors that occur when using the tokenize method.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
VENMO_APP_CANCELED + + + + CUSTOMER + + + + + + + +

Occurs when customer cancels flow from the Venmo app.

+
VENMO_APP_FAILED + + + + UNKNOWN + + + + + + + +

Occurs when tokenization fails.

+
VENMO_CANCELED + + + + CUSTOMER + + + + + + + +

Occurs when customer cancels the flow or Venmo app is not available.

+
VENMO_CUSTOMER_CANCELED + + + + CUSTOMER + + + + + + + +

Occurs when customer cancels the flow.

+
VENMO_DESKTOP_CANCELED + + + + CUSTOMER + + + + + + + +

Occurs when customer cancels the Venmo Desktop flow by closing the modal.

+
VENMO_DESKTOP_UNKNOWN_ERROR + + + + UNKNOWN + + + + + + + +

Occurs when an unknown error causes the Venmo Desktop flow to fail.

+
VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR + + + + UNKNOWN + + + + + + + +

Occurs when an unknown network error causes the mobile polling process to fail.

+
VENMO_MOBILE_POLLING_TOKENIZATION_EXPIRED + + + + CUSTOMER + + + + + + + +

Occurs when the polling has expired and the payment cannot be completed.

+
VENMO_MOBILE_POLLING_TOKENIZATION_CANCELED + + + + CUSTOMER + + + + + + + +

Occurs when the polling operation is canceled by the customer.

+
VENMO_MOBILE_POLLING_TOKENIZATION_TIMEOUT + + + + CUSTOMER + + + + + + + +

Occurs when customer takes too long to complete payment.

+
VENMO_MOBILE_POLLING_TOKENIZATION_FAILED + + + + UNKNOWN + + + + + + + +

Occurs if there is an unknown error during the mobile polling process.

+
VENMO_NETWORK_ERROR + + + + NETWORK + + + + + + + +

Occurs when a network error causes a request to fail.

+
VENMO_TOKENIZATION_CANCELED_BY_MERCHANT + + + + MERCHANT + + + + + + + +

Occurs when cancelTokenization is called while tokenization is in progress.

+
VENMO_TOKENIZATION_FAILED + + + + UNKNOWN + + + + + + + +

Occurs when there is an unknown error during the web login experience.

+
VENMO_TOKENIZATION_REQUEST_ACTIVE + + + + MERCHANT + + + + + + + +

Occurs when tokenize is called when the flow is already in progress.

+
VENMO_TOKENIZATION_REQUEST_NOT_ACTIVE + + + + MERCHANT + + + + + + + +

Occurs when cancelTokenization is called when the flow is not in progress.

+
VENMO_ECD_DISABLED + + + + MERCHANT + + + + + + + +

Occurs when the merchant tries to access customer details without enabling Enriched Customer Data.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Visa Checkout - createInitOptions Error Codes +

+ + + + +
+

Errors that occur when using the createInitOptions method.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
VISA_CHECKOUT_INIT_OPTIONS_REQUIRED + + + + MERCHANT + + + + + + + +

Occurs when no options are provided to method.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Visa Checkout - Creation Error Codes +

+ + + + +
+

Errors that occur when creating the Visa Checkout component.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
VISA_CHECKOUT_NOT_ENABLED + + + + MERCHANT + + + + + + + +

Occurs when Visa Checkout is not enabled in the Braintree control panel.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) Visa Checkout - tokenize Error Codes +

+ + + + +
+

Errors that occur when using the tokenize method.

+
+ + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
VISA_CHECKOUT_PAYMENT_REQUIRED + + + + MERCHANT + + + + + + + +

Occurs when no payment data is not provided.

+
VISA_CHECKOUT_TOKENIZATION + + + + NETWORK + + + + + + + +

Occurs when tokenization fails.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ code :string +

+ + + + +
+

A code that corresponds to specific errors.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ details :object +

+ + + + +
+

Additional information about the error, such as an underlying network error response.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ message :string +

+ + + + +
+

A short description of the error.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ type :BraintreeError.types +

+ + + + +
+

The type of error.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/Client.html b/3.111.1/Client.html new file mode 100644 index 00000000..c82a7f7d --- /dev/null +++ b/3.111.1/Client.html @@ -0,0 +1,1482 @@ + + + + + + + + + Client - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ Client +

+ + + + +
+
+ +

+ + Client + +

+ + +
+

This class is required by many other Braintree components. It serves as the base API layer that communicates with our servers. It is also capable of being used to formulate direct calls to our servers, such as direct credit card tokenization. See Client#request.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new Client(configuration) +

+
+ + + + + +
+

Do not use this constructor directly. Use braintree.client.create instead.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
configuration + + + + Client~configuration + + + + + + + +

Options

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ teardown +

+ + + + +
+

Cleanly tear down anything set up by create.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + +
Examples
+ + +
clientInstance.teardown();
+ +

+ With callback +

+ + +
clientInstance.teardown(function () {
+  // teardown is complete
+});
+ + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ getConfiguration() → {Client~configuration} +

+
+ + + + + +
+

Returns a copy of the configuration values.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ getVersion() → {String|void} +

+
+ + + + + +
+

Returns the Client version.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
var createClient = require('braintree-web/client').create;
+
+createClient({
+  authorization: CLIENT_AUTHORIZATION
+}, function (createErr, clientInstance) {
+  console.log(clientInstance.getVersion()); // Ex: 1.0.0
+});
+ + +
+ + + + + + + + + + + + + + +

+ request(options, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Used by other modules to formulate all network requests to the Braintree gateway. It is also capable of being used directly from your own form to tokenize credit card information. However, be sure to satisfy PCI compliance if you use direct card tokenization.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Request options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
method + + + + string + + + + + + + + + + + + + + + +

HTTP method, e.g. "get" or "post".

+ +
endpoint + + + + string + + + + + + + + + + + + + + + +

Endpoint path, e.g. "payment_methods".

+ +
data + + + + object + + + + + + + + + + + + + + + +

Data to send with the request.

+ +
timeout + + + + number + + + + + + + + + <optional>
+ + + + + +
+ + 60000 + + +

Set a timeout (in milliseconds) for the request.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the returned server data.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ +

+ Direct Credit Card Tokenization +

+ + +
var createClient = require('braintree-web/client').create;
+
+createClient({
+  authorization: CLIENT_AUTHORIZATION
+}, function (createErr, clientInstance) {
+  var form = document.getElementById('my-form-id');
+  var data = {
+    creditCard: {
+      number: form['cc-number'].value,
+      cvv: form['cc-cvv'].value,
+      expirationDate: form['cc-expiration-date'].value,
+      billingAddress: {
+        postalCode: form['cc-postal-code'].value
+      },
+      options: {
+        validate: false
+      }
+    }
+  };
+
+  // Warning: For a merchant to be eligible for the easiest level of PCI compliance (SAQ A),
+  // payment fields cannot be hosted on your checkout page.
+  // For an alternative to the following, use Hosted Fields.
+  clientInstance.request({
+    endpoint: 'payment_methods/credit_cards',
+    method: 'post',
+    data: data
+  }, function (requestErr, response) {
+    // More detailed example of handling API errors: https://codepen.io/braintree/pen/MbwjdM
+    if (requestErr) { throw new Error(requestErr); }
+
+    console.log('Got nonce:', response.creditCards[0].nonce);
+  });
+});
+ +

+ Tokenizing Fields for AVS Checks +

+ + +
var createClient = require('braintree-web/client').create;
+
+createClient({
+  authorization: CLIENT_AUTHORIZATION
+}, function (createErr, clientInstance) {
+  var form = document.getElementById('my-form-id');
+  var data = {
+    creditCard: {
+      number: form['cc-number'].value,
+      cvv: form['cc-cvv'].value,
+      expirationDate: form['cc-date'].value,
+      // The billing address can be checked with AVS rules.
+      // See: https://articles.braintreepayments.com/support/guides/fraud-tools/basic/avs-cvv-rules
+      billingAddress: {
+        postalCode: form['cc-postal-code'].value,
+        streetAddress: form['cc-street-address'].value,
+        countryName: form['cc-country-name'].value,
+        countryCodeAlpha2: form['cc-country-alpha2'].value,
+        countryCodeAlpha3: form['cc-country-alpha3'].value,
+        countryCodeNumeric: form['cc-country-numeric'].value
+      },
+      options: {
+        validate: false
+      }
+    }
+  };
+
+  // Warning: For a merchant to be eligible for the easiest level of PCI compliance (SAQ A),
+  // payment fields cannot be hosted on your checkout page.
+  // For an alternative to the following, use Hosted Fields.
+  clientInstance.request({
+    endpoint: 'payment_methods/credit_cards',
+    method: 'post',
+    data: data
+  }, function (requestErr, response) {
+    // More detailed example of handling API errors: https://codepen.io/braintree/pen/MbwjdM
+    if (requestErr) { throw new Error(requestErr); }
+
+    console.log('Got nonce:', response.creditCards[0].nonce);
+  });
+});
+ + +
+ + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ configuration :object +

+
+ + + + + +
+

This object is returned by getConfiguration. This information is used extensively by other Braintree modules to properly configure themselves.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
client + + + + object + + + + + + + +

The braintree-web/client parameters.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
authorization + + + + string + + + + + + + +

A tokenizationKey or clientToken.

+
+ +
gatewayConfiguration + + + + object + + + + + + + +

Gateway-supplied configuration.

+
analyticsMetadata + + + + object + + + + + + + +

Analytics-specific data.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
sessionId + + + + string + + + + + + + +

Uniquely identifies a browsing session.

+
sdkVersion + + + + string + + + + + + + +

The braintree.js version.

+
merchantAppId + + + + string + + + + + + + +

Identifies the merchant's web app.

+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/DataCollector.html b/3.111.1/DataCollector.html new file mode 100644 index 00000000..b2dfc699 --- /dev/null +++ b/3.111.1/DataCollector.html @@ -0,0 +1,896 @@ + + + + + + + + + DataCollector - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ DataCollector +

+ + + + +
+
+ +

+ + DataCollector + +

+ + +
+

This class is used for fraud integration with PayPal and Kount. Instances of this class have deviceData which is used to correlate user sessions with server transactions.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new DataCollector() +

+
+ + + + + +
+

Do not use this constructor directly. Use braintree-web.data-collector.create instead.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ deviceData :string +

+ + + + +
+

JSON string to pass with server transactions.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ rawDeviceData :object +

+ + + + +
+

The device data as an object instead of a string.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ getDeviceData(optionsopt, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Resolves with device data once it is ready.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + <optional>
+ + + + + +
+

Options for how device data is resolved.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
raw + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + false + + +

When set to true, the device data will resolve as an object instead of a JSON string.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called on completion. If no callback is provided, getDeviceData returns a promise.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
dataCollectorInstance.getDeviceData();
+ +

+ Without options +

+ + +
dataCollectorInstance.getDeviceData().then(function (deviceData) {
+  // typeof deviceData === 'string'
+  // pass onto your server with the payment method nonce
+});
+ +

+ With options +

+ + +
dataCollectorInstance.getDeviceData({
+  raw: true
+}).then(function (deviceData) {
+  // typeof deviceData === 'object'
+  // for if you'd like to parse the data before sending it to your server
+});
+ + +
+ + + + + + + + + + + + + + +

+ teardown(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Cleanly remove anything set up by create.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called on completion. If no callback is provided, teardown returns a promise.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
dataCollectorInstance.teardown();
+ +

+ With callback +

+ + +
dataCollectorInstance.teardown(function () {
+  // teardown is complete
+});
+ + +
+ + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/GooglePayment.html b/3.111.1/GooglePayment.html new file mode 100644 index 00000000..85e36a50 --- /dev/null +++ b/3.111.1/GooglePayment.html @@ -0,0 +1,1739 @@ + + + + + + + + + GooglePayment - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ GooglePayment +

+ + + + +
+
+ +

+ + GooglePayment + +

+ + +
+

This class represents a Google Payment component produced by braintree-web/google-payment.create. Instances of this class have methods for initializing the Google Pay flow.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new GooglePayment(options) +

+
+ + + + + +
+

Do not use this constructor directly. Use braintree-web.google-payment.create instead.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

Google Payment create options.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ createPaymentDataRequest(overrides) → {object|Promise} +

+
+ + + + + +
+

Create a configuration object for use in the loadPaymentData method.

+

Note: Version 1 of the Google Pay Api is deprecated and will become unsupported in a future version. Until then, version 1 will continue to be used by default, and version 1 schema parameters and overrides will remain functional on existing integrations. However, new integrations and all following examples will be presented in the GooglePay version 2 schema. See Google Pay's upgrade guide to see how to update your integration.

+

If options.googlePayVersion === 2 was set during the initial create call, overrides must match the Google Pay v2 schema to be valid.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
overrides + + + + object + + + + + + + +

The supplied parameters for creating the PaymentDataRequest object. Required parameters are:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
transactionInfo + + + + object + + + + + + + +

Object according to the Google Pay Transaction Info spec. +Optionally, any of the parameters in the PaymentDataRequest parameters can be overridden, but note that it is recommended only to override top level parameters to avoid squashing deeply nested configuration objects. An example can be found below showing how to safely edit these deeply nested objects.

+ +
+ + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
var paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
+  merchantInfo: {
+    merchantId: 'my-merchant-id-from-google'
+  },
+  transactionInfo: {
+    currencyCode: 'USD',
+    totalPriceStatus: 'FINAL',
+    totalPrice: '100.00'
+  }
+});
+
+// Update card payment methods to require billing address
+var cardPaymentMethod = paymentDataRequest.allowedPaymentMethods;
+cardPaymentMethod.parameters.billingAddressRequired = true;
+cardPaymentMethod.parameters.billingAddressParameters = {
+  format: 'FULL',
+  phoneNumberRequired: true
+};
+
+var paymentsClient = new google.payments.api.PaymentsClient({
+  environment: 'TEST' // or 'PRODUCTION'
+})
+
+paymentsClient.loadPaymentData(paymentDataRequest).then(function (response) {
+  // handle response with googlePaymentInstance.parseResponse
+  // (see below)
+});
+ +

+ With deferred client +

+ + +
googlePaymentInstance.createPaymentDataRequest({
+  merchantInfo: {
+    merchantId: 'my-merchant-id-from-google'
+  },
+  transactionInfo: {
+    currencyCode: 'USD',
+    totalPriceStatus: 'FINAL',
+    totalPrice: '100.00'
+  }
+}).then(function (paymentDataRequest) {
+  // Update card payment methods to require billing address
+  var cardPaymentMethod = paymentDataRequest.allowedPaymentMethods;
+  cardPaymentMethod.parameters.billingAddressRequired = true;
+  cardPaymentMethod.parameters.billingAddressParameters = {
+    format: 'FULL',
+    phoneNumberRequired: true
+  };
+
+  var paymentsClient = new google.payments.api.PaymentsClient({
+    environment: 'TEST' // or 'PRODUCTION'
+  })
+
+  return paymentsClient.loadPaymentData(paymentDataRequest);
+}).then(function (response) {
+  // handle response with googlePaymentInstance.parseResponse
+  // (see below)
+});
+ + +
+ + + + + + + + + + + + + + +

+ parseResponse(response, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Parse the response from the tokenization.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
response + + + + object + + + + + + + + + + + + + +

The response back from the Google Pay tokenization.

+ +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is a tokenizePayload. If no callback is provided, parseResponse returns a promise that resolves with a tokenizePayload.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
with callback
+var paymentsClient = new google.payments.api.PaymentsClient({
+  environment: 'TEST' // or 'PRODUCTION'
+})
+
+paymentsClient.loadPaymentData(paymentDataRequestFromCreatePaymentDataRequest).then(function (response) {
+  googlePaymentInstance.parseResponse(response, function (err, data) {
+    if (err) {
+      // handle errors
+    }
+    // send parsedResponse.nonce to your server
+  });
+});
+ + +
with promise
+var paymentsClient = new google.payments.api.PaymentsClient({
+  environment: 'TEST' // or 'PRODUCTION'
+})
+
+paymentsClient.loadPaymentData(paymentDataRequestFromCreatePaymentDataRequest).then(function (response) {
+  return googlePaymentInstance.parseResponse(response);
+}).then(function (parsedResponse) {
+  // send parsedResponse.nonce to your server
+}).catch(function (err) {
+  // handle errors
+});
+ + +
+ + + + + + + + + + + + + + +

+ teardown(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Cleanly tear down anything set up by create.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called once teardown is complete. No data is returned if teardown completes successfully.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
googlePaymentInstance.teardown();
+ +

+ With callback +

+ + +
googlePaymentInstance.teardown(function () {
+  // teardown is complete
+});
+ + +
+ + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ tokenizePayload :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nonce + + + + string + + + + + + + +

The payment method nonce.

+
details + + + + object + + + + + + + +

Additional account details.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
cardType + + + + string + + + + + + + +

Type of card, ex: Visa, MasterCard.

+
lastFour + + + + string + + + + + + + +

Last four digits of card number.

+
lastTwo + + + + string + + + + + + + +

Last two digits of card number.

+
isNetworkTokenized + + + + boolean + + + + + + + +

True if the card is network tokenized.

+
bin + + + + string + + + + + + + +

First six digits of card number.

+
+ +
description + + + + string + + + + + + + +

A human-readable description.

+
type + + + + string + + + + + + + +

The payment method type, CreditCard or AndroidPayCard.

+
binData + + + + object + + + + + + + +

Information about the card based on the bin.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
commercial + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
countryOfIssuance + + + + string + + + + + + + +

The country of issuance.

+
debit + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
durbinRegulated + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
healthcare + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
issuingBank + + + + string + + + + + + + +

The issuing bank.

+
payroll + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
prepaid + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
productId + + + + string + + + + + + + +

The product id.

+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/HostedFields.html b/3.111.1/HostedFields.html new file mode 100644 index 00000000..10f1357f --- /dev/null +++ b/3.111.1/HostedFields.html @@ -0,0 +1,7877 @@ + + + + + + + + + HostedFields - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ HostedFields +

+ + + + +
+
+ +

+ + HostedFields + +

+ + +
+

This class represents a Hosted Fields component produced by braintree-web/hosted-fields.create. Instances of this class have methods for interacting with the input fields within Hosted Fields' iframes.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new HostedFields(options) +

+
+ + + + + +
+

Do not use this constructor directly. Use braintree-web.hosted-fields.create instead.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

The Hosted Fields create options.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ addClass(field, classname, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Add a class to a field. Useful for updating field styles when events occur elsewhere in your checkout.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
field + + + + string + + + + + + + + + + + + + +

The field you wish to add a class to. Must be a valid fieldOption.

+ +
classname + + + + string + + + + + + + + + + + + + +

The class to be added.

+ +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Callback executed on completion, containing an error if one occurred. No data is returned if the class is added successfully.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr) {
+  if (addClassErr) {
+    console.error(addClassErr);
+  }
+});
+ + +
+ + + + + + + + + + + + + + +

+ clear(field, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Clear the value of a field.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
field + + + + string + + + + + + + + + + + + + +

The field you wish to clear. Must be a valid fieldOption.

+ +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Callback executed on completion, containing an error if one occurred. No data is returned if the field cleared successfully.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
hostedFieldsInstance.clear('number', function (clearErr) {
+  if (clearErr) {
+    console.error(clearErr);
+  }
+});
+ +

+ Clear several fields +

+ + +
hostedFieldsInstance.clear('number');
+hostedFieldsInstance.clear('cvv');
+hostedFieldsInstance.clear('expirationDate');
+ + +
+ + + + + + + + + + + + + + +

+ focus(field, callbackopt) → {void} +

+
+ + + + + +
+

Programmatically focus a field.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
field + + + + string + + + + + + + + + + + + + +

The field you want to focus. Must be a valid fieldOption.

+ +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Callback executed on completion, containing an error if one occurred. No data is returned if the field focused successfully.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
hostedFieldsInstance.focus('number', function (focusErr) {
+  if (focusErr) {
+    console.error(focusErr);
+  }
+});
+ +

+ Using an event listener +

+ + +
myElement.addEventListener('click', function (e) {
+  // In Firefox, the focus method can be suppressed
+  //   if the element has a tabindex property or the element
+  //   is an anchor link with an href property.
+  e.preventDefault();
+  hostedFieldsInstance.focus('number');
+});
+ + +
+ + + + + + + + + + + + + + +

+ getChallenges(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Get card verification challenges, such as requirements for cvv and postal code.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called on completion, containing an error if one occurred. If no callback is provided, getChallenges returns a promise.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
hostedFieldsInstance.getChallenges().then(function (challenges) {
+  challenges // ['cvv', 'postal_code']
+});
+ + +
+ + + + + + + + + + + + + + +

+ getState() → {object} +

+
+ + + + + +
+

Returns an object that includes the state of all fields and possible card types.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Check if all fields are valid +

+ + +
var state = hostedFieldsInstance.getState();
+
+var formValid = Object.keys(state.fields).every(function (key) {
+  return state.fields[key].isValid;
+});
+ + +
+ + + + + + + + + + + + + + +

+ getSupportedCardTypes(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Get supported card types configured in the Braintree Control Panel

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called on completion, containing an error if one occurred. If no callback is provided, getSupportedCardTypes returns a promise.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
hostedFieldsInstance.getSupportedCardTypes().then(function (cardTypes) {
+  cardTypes // ['Visa', 'American Express', 'Mastercard']
+});
+ + +
+ + + + + + + + + + + + + + +

+ off(event, handler) → {void} +

+
+ + + + + +
+

Unsubscribes the handler function to a named event.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + + + + string + + + + + + + +

The name of the event to which you are unsubscribing.

+ +
handler + + + + function + + + + + + + +

The callback for the event you are unsubscribing from.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Subscribing and then unsubscribing from a Hosted Field event, in this case 'focus' +

+ + +
hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+  var callback = function (event) {
+    console.log(event.emittedBy, 'has been focused');
+  };
+  hostedFieldsInstance.on('focus', callback);
+
+  // later on
+  hostedFieldsInstance.off('focus', callback);
+});
+ + +
+ + + + + + + + + + + + + + +

+ on(event, handler) → {void} +

+
+ + + + + +
+

Subscribes a handler function to a named event.

+

Events that emit a stateObject.

+ +

Other Events

+ +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + + + + string + + + + + + + +

The name of the event to which you are subscribing.

+ +
handler + + + + function + + + + + + + +

A callback to handle the event.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Listening to a Hosted Field event, in this case 'focus' +

+ + +
hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+  hostedFieldsInstance.on('focus', function (event) {
+    console.log(event.emittedBy, 'has been focused');
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ removeAttribute(options, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Removes a supported attribute from a field.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

The options for the attribute you wish to remove.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
field + + + + string + + + + + + + +

The field from which you wish to remove an attribute. Must be a valid fieldOption.

+ +
attribute + + + + string + + + + + + + +

The name of the attribute you wish to remove from the field.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Callback executed on completion, containing an error if one occurred. No data is returned if the attribute is removed successfully.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Remove the placeholder attribute of a field +

+ + +
hostedFieldsInstance.removeAttribute({
+  field: 'number',
+  attribute: 'placeholder'
+}, function (attributeErr) {
+  if (attributeErr) {
+    console.error(attributeErr);
+  }
+});
+ + +
+ + + + + + + + + + + + + + +

+ removeClass(field, classname, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Removes a class to a field. Useful for updating field styles when events occur elsewhere in your checkout.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
field + + + + string + + + + + + + + + + + + + +

The field you wish to remove a class from. Must be a valid fieldOption.

+ +
classname + + + + string + + + + + + + + + + + + + +

The class to be removed.

+ +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Callback executed on completion, containing an error if one occurred. No data is returned if the class is removed successfully.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr) {
+  if (addClassErr) {
+    console.error(addClassErr);
+    return;
+  }
+
+  // some time later...
+  hostedFieldsInstance.removeClass('number', 'custom-class');
+});
+ + +
+ + + + + + + + + + + + + + +

+ setAttribute(options, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Sets an attribute of a field. +Supported attributes are aria-invalid, aria-required, disabled, and placeholder.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

The options for the attribute you wish to set.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
field + + + + string + + + + + + + +

The field to which you wish to add an attribute. Must be a valid fieldOption.

+ +
attribute + + + + string + + + + + + + +

The name of the attribute you wish to add to the field.

+ +
value + + + + string + + + + + + + +

The value for the attribute.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Callback executed on completion, containing an error if one occurred. No data is returned if the attribute is set successfully.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ +

+ Set the placeholder attribute of a field +

+ + +
hostedFieldsInstance.setAttribute({
+  field: 'number',
+  attribute: 'placeholder',
+  value: '1111 1111 1111 1111'
+}, function (attributeErr) {
+  if (attributeErr) {
+    console.error(attributeErr);
+  }
+});
+ +

+ Set the aria-required attribute of a field +

+ + +
hostedFieldsInstance.setAttribute({
+  field: 'number',
+  attribute: 'aria-required',
+  value: true
+}, function (attributeErr) {
+  if (attributeErr) {
+    console.error(attributeErr);
+  }
+});
+ + +
+ + + + + + + + + + + + + + +

+ setMessage(options) → {void} +

+
+ + + + + +
+

Sets a visually hidden message (for screen readers) on a field.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

The options for the attribute you wish to set.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
field + + + + string + + + + + + + +

The field to which you wish to add an attribute. Must be a valid field.

+ +
message + + + + string + + + + + + + +

The message to set.

+ +
+ + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ +

+ Set an error message on a field +

+ + +
hostedFieldsInstance.setMessage({
+  field: 'number',
+  message: 'Invalid card number'
+});
+ +

+ Remove the message on a field +

+ + +
hostedFieldsInstance.setMessage({
+  field: 'number',
+  message: ''
+});
+ + +
+ + + + + + + + + + + + + + +

+ setMonthOptions(options, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Sets the month options for the expiration month field when presented as a select element.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + array + + + + + + + + + + + + + +

An array of 12 entries corresponding to the 12 months.

+ +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Callback executed on completion, containing an error if one occurred. No data is returned if the options are updated successfully. Errors if expirationMonth is not configured on the Hosted Fields instance or if the expirationMonth field is not configured to be a select input.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Update the month options to spanish +

+ + +
hostedFieldsInstance.setMonthOptions([
+  '01 - enero',
+  '02 - febrero',
+  '03 - marzo',
+  '04 - abril',
+  '05 - mayo',
+  '06 - junio',
+  '07 - julio',
+  '08 - agosto',
+  '09 - septiembre',
+  '10 - octubre',
+  '11 - noviembre',
+  '12 - diciembre'
+]);
+ + +
+ + + + + + + + + + + + + + +

+ setPlaceholder(field, placeholder, callbackopt) → {Promise|void} +

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
field + + + + string + + + + + + + + + + + + + +

The field whose placeholder you wish to change. Must be a valid fieldOption.

+ +
placeholder + + + + string + + + + + + + + + + + + + +

Will be used as the placeholder attribute of the input.

+ +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Callback executed on completion, containing an error if one occurred. No data is returned if the placeholder updated successfully.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
+ +
+ +
+ +
+ + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ teardown(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Cleanly remove anything set up by create.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called on completion, containing an error if one occurred. No data is returned if teardown completes successfully. If no callback is provided, teardown returns a promise.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
hostedFieldsInstance.teardown(function (teardownErr) {
+  if (teardownErr) {
+    console.error('Could not tear down Hosted Fields!');
+  } else {
+    console.info('Hosted Fields has been torn down!');
+  }
+});
+ + +
+ + + + + + + + + + + + + + +

+ tokenize(optionsopt, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Tokenizes fields and returns a nonce payload.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + <optional>
+ + + + + +
+

All tokenization options for the Hosted Fields component.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
vault + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + false + + +

When true, will vault the tokenized card. Cards will only be vaulted when using a client created with a client token that includes a customer ID. Note: merchants using Advanced Fraud Tools should not use this option, as device data will not be included.

+ +
authenticationInsight + + + + object + + + + + + + + + <optional>
+ + + + + +
+ + +

Options for checking authentication insight - the regulatory environment of the tokenized card.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
merchantAccountId + + + + string + + + + + + + +

The Braintree merchant account id to use to look up the authentication insight information.

+ +
+ + +
fieldsToTokenize + + + + array + + + + + + + + + <optional>
+ + + + + +
+ + +

By default, all fields will be tokenized. You may specify which fields specifically you wish to tokenize with this property. Valid options are 'number', 'cvv', 'expirationDate', 'expirationMonth', 'expirationYear', 'postalCode', 'cardholderName'.

+ +
cardholderName + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

When supplied, the cardholder name to be tokenized with the contents of the fields.

+ +
billingAddress.postalCode + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

When supplied, this postal code will be tokenized along with the contents of the fields. If a postal code is provided as part of the Hosted Fields configuration, the value of the field will be tokenized and this value will be ignored.

+ +
billingAddress.firstName + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

When supplied, this customer first name will be tokenized along with the contents of the fields.

+ +
billingAddress.lastName + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

When supplied, this customer last name will be tokenized along with the contents of the fields.

+ +
billingAddress.company + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

When supplied, this company name will be tokenized along with the contents of the fields.

+ +
billingAddress.streetAddress + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

When supplied, this street address will be tokenized along with the contents of the fields.

+ +
billingAddress.extendedAddress + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

When supplied, this extended address will be tokenized along with the contents of the fields.

+ +
billingAddress.locality + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

When supplied, this locality (the city) will be tokenized along with the contents of the fields.

+ +
billingAddress.region + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

When supplied, this region (the state) will be tokenized along with the contents of the fields.

+ +
billingAddress.countryCodeNumeric + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

When supplied, this numeric country code will be tokenized along with the contents of the fields.

+ +
billingAddress.countryCodeAlpha2 + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

When supplied, this alpha 2 representation of a country will be tokenized along with the contents of the fields.

+ +
billingAddress.countryCodeAlpha3 + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

When supplied, this alpha 3 representation of a country will be tokenized along with the contents of the fields.

+ +
billingAddress.countryName + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

When supplied, this country name will be tokenized along with the contents of the fields.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

May be used as the only parameter of the function if no options are passed in. The second argument, data, is a tokenizePayload. If no callback is provided, tokenize returns a function that resolves with a tokenizePayload.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ +

+ Tokenize a card +

+ + +
hostedFieldsInstance.tokenize(function (tokenizeErr, payload) {
+  if (tokenizeErr) {
+    switch (tokenizeErr.code) {
+      case 'HOSTED_FIELDS_FIELDS_EMPTY':
+        // occurs when none of the fields are filled in
+        console.error('All fields are empty! Please fill out the form.');
+        break;
+      case 'HOSTED_FIELDS_FIELDS_INVALID':
+        // occurs when certain fields do not pass client side validation
+        console.error('Some fields are invalid:', tokenizeErr.details.invalidFieldKeys);
+
+        // you can also programmatically access the field containers for the invalid fields
+        tokenizeErr.details.invalidFields.forEach(function (fieldContainer) {
+          fieldContainer.className = 'invalid';
+        });
+        break;
+      case 'HOSTED_FIELDS_TOKENIZATION_FAIL_ON_DUPLICATE':
+        // occurs when:
+        //   * the client token used for client authorization was generated
+        //     with a customer ID and the fail on duplicate payment method
+        //     option is set to true
+        //   * the card being tokenized has previously been vaulted (with any customer)
+        // See: https://developer.paypal.com/braintree/docs/reference/request/client-token/generate#options.fail_on_duplicate_payment_method
+        console.error('This payment method already exists in your vault.');
+        break;
+      case 'HOSTED_FIELDS_TOKENIZATION_CVV_VERIFICATION_FAILED':
+        // occurs when:
+        //   * the client token used for client authorization was generated
+        //     with a customer ID and the verify card option is set to true
+        //     and you have credit card verification turned on in the Braintree
+        //     control panel
+        //   * the cvv does not pass verification (https://developer.paypal.com/braintree/docs/reference/general/testing#avs-and-cvv/cid-responses)
+        // See: https://developer.paypal.com/braintree/docs/reference/request/client-token/generate#options.verify_card
+        console.error('CVV did not pass verification');
+        break;
+      case 'HOSTED_FIELDS_FAILED_TOKENIZATION':
+        // occurs for any other tokenization error on the server
+        console.error('Tokenization failed server side. Is the card valid?');
+        break;
+      case 'HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR':
+        // occurs when the Braintree gateway cannot be contacted
+        console.error('Network error occurred when tokenizing.');
+        break;
+      default:
+        console.error('Something bad happened!', tokenizeErr);
+    }
+  } else {
+    console.log('Got nonce:', payload.nonce);
+  }
+});
+ +

+ Tokenize and vault a card +

+ + +
hostedFieldsInstance.tokenize({
+  vault: true
+}, function (tokenizeErr, payload) {
+  if (tokenizeErr) {
+    console.error(tokenizeErr);
+  } else {
+    console.log('Got nonce:', payload.nonce);
+  }
+});
+ +

+ Tokenize a card with non-Hosted Fields cardholder name +

+ + +
hostedFieldsInstance.tokenize({
+  cardholderName: 'First Last'
+}, function (tokenizeErr, payload) {
+  if (tokenizeErr) {
+    console.error(tokenizeErr);
+  } else {
+    console.log('Got nonce:', payload.nonce);
+  }
+});
+ +

+ Tokenize a card with non-Hosted Fields postal code option +

+ + +
hostedFieldsInstance.tokenize({
+  billingAddress: {
+    postalCode: '11111'
+  }
+}, function (tokenizeErr, payload) {
+  if (tokenizeErr) {
+    console.error(tokenizeErr);
+  } else {
+    console.log('Got nonce:', payload.nonce);
+  }
+});
+ +

+ Tokenize a card with additional billing address options +

+ + +
hostedFieldsInstance.tokenize({
+  billingAddress: {
+    firstName: 'First',
+    lastName: 'Last',
+    company: 'Company',
+    streetAddress: '123 Street',
+    extendedAddress: 'Unit 1',
+    // passing just one of the country options is sufficient to
+    // associate the card details with a particular country
+    // valid country names and codes can be found here:
+    // https://developer.paypal.com/braintree/docs/reference/general/countries/ruby#list-of-countries
+    countryName: 'United States',
+    countryCodeAlpha2: 'US',
+    countryCodeAlpha3: 'USA',
+    countryCodeNumeric: '840'
+  }
+}, function (tokenizeErr, payload) {
+  if (tokenizeErr) {
+    console.error(tokenizeErr);
+  } else {
+    console.log('Got nonce:', payload.nonce);
+  }
+});
+ +

+ Allow tokenization with empty cardholder name field +

+ + +
var state = hostedFieldsInstance.getState();
+var fields = Object.keys(state.fields);
+
+// normally, if you tried to tokenize an empty cardholder name field
+// you would get an error, to allow making this field optional,
+// tokenize all the fields except for the cardholder name field
+// when the cardholder name field is empty. Otherwise, tokenize
+// all the fields
+if (state.fields.cardholderName.isEmpty) {
+ fields = fields.filter(function (field) {
+   return field !== 'cardholderName';
+ });
+}
+
+hostedFieldsInstance.tokenize({
+ fieldsToTokenize: fields
+}, function (tokenizeErr, payload) {
+  if (tokenizeErr) {
+    console.error(tokenizeErr);
+  } else {
+    console.log('Got nonce:', payload.nonce);
+  }
+});
+ + +
+ + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ binPayload :object +

+
+ + + + + +
+

The event payload sent from on when the binAvailable event is emitted.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
bin + + + + string + + + + + + + +

The first 6 digits of the card number.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ hostedFieldsCard :object +

+
+ + + + + +
+

Information about the card type, sent in stateObjects.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + + + + string + + + + + + + +

The code-friendly representation of the card type. It will be one of the following strings:

+
    +
  • american-express
  • +
  • diners-club
  • +
  • discover
  • +
  • jcb
  • +
  • maestro
  • +
  • master-card
  • +
  • unionpay
  • +
  • visa
  • +
+
niceType + + + + string + + + + + + + +

The pretty-printed card type. It will be one of the following strings:

+
    +
  • American Express
  • +
  • Diners Club
  • +
  • Discover
  • +
  • JCB
  • +
  • Maestro
  • +
  • MasterCard
  • +
  • UnionPay
  • +
  • Visa
  • +
+
code + + + + object + + + + + + + +

This object contains data relevant to the security code requirements of the card brand. +For example, on a Visa card there will be a CVV of 3 digits, whereas an +American Express card requires a 4-digit CID.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + + + string + + + + + + + +

"CVV" "CID" "CVC"

+
size + + + + number + + + + + + + +

The expected length of the security code. Typically, this is 3 or 4.

+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ hostedFieldsFieldData :object +

+
+ + + + + +
+

Data about Hosted Fields fields, sent in stateObjects.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
container + + + + HTMLElement + + + + + + + +

Reference to the container DOM element on your page associated with the current event.

+
isFocused + + + + boolean + + + + + + + +

Whether or not the input is currently focused.

+
isEmpty + + + + boolean + + + + + + + +

Whether or not the user has entered a value in the input.

+
isPotentiallyValid + + + + boolean + + + + + + + +

A determination based on the future validity of the input value. +This is helpful when a user is entering a card number and types "41". +While that value is not valid for submission, it is still possible for +it to become a fully qualified entry. However, if the user enters "4x" +it is clear that the card number can never become valid and isPotentiallyValid will +return false.

+
isValid + + + + boolean + + + + + + + +

Whether or not the value of the associated input is fully qualified for submission.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ stateObject :object +

+
+ + + + + +
+

The event payload sent from on or getState.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
cards + + + + Array.<HostedFields~hostedFieldsCard> + + + + + + + +

This will return an array of potential cards. If the card type has been determined, the array will contain only one card. +Internally, Hosted Fields uses credit-card-type, +an open-source card detection library.

+
emittedBy + + + + string + + + + + + + +

The name of the field associated with an event. This will not be included if returned by getState. It will be one of the following strings:

+
    +
  • "number"
  • +
  • "cvv"
  • +
  • "expirationDate"
  • +
  • "expirationMonth"
  • +
  • "expirationYear"
  • +
  • "postalCode"
  • +
  • "cardholderName"
  • +
+
fields + + + + object + + + + + + + + + +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
number + + + + HostedFields~hostedFieldsFieldData + + + + + + + + + + + <nullable>
+ +
+

hostedFieldsFieldData for the number field, if it is present.

+
cvv + + + + HostedFields~hostedFieldsFieldData + + + + + + + + + + + <nullable>
+ +
+

hostedFieldsFieldData for the CVV field, if it is present.

+
expirationDate + + + + HostedFields~hostedFieldsFieldData + + + + + + + + + + + <nullable>
+ +
+

hostedFieldsFieldData for the expiration date field, if it is present.

+
expirationMonth + + + + HostedFields~hostedFieldsFieldData + + + + + + + + + + + <nullable>
+ +
+

hostedFieldsFieldData for the expiration month field, if it is present.

+
expirationYear + + + + HostedFields~hostedFieldsFieldData + + + + + + + + + + + <nullable>
+ +
+

hostedFieldsFieldData for the expiration year field, if it is present.

+
postalCode + + + + HostedFields~hostedFieldsFieldData + + + + + + + + + + + <nullable>
+ +
+

hostedFieldsFieldData for the postal code field, if it is present.

+
cardholderName + + + + HostedFields~hostedFieldsFieldData + + + + + + + + + + + <nullable>
+ +
+

hostedFieldsFieldData for the cardholder name field, if it is present.

+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ tokenizePayload :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nonce + + + + string + + + + + + + +

The payment method nonce.

+
authenticationInsight + + + + object + + + + + + + +

Info about the regulatory environment of the tokenized card. Only available if authenticationInsight.merchantAccountId is passed in the tokenize method options.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
regulationEnvironment + + + + string + + + + + + + +

The regulation environment for the tokenized card.

+
+ +
details + + + + object + + + + + + + +

Additional account details.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
bin + + + + string + + + + + + + +

The BIN number of the card.

+
cardType + + + + string + + + + + + + +

Type of card, ex: Visa, MasterCard.

+
expirationMonth + + + + string + + + + + + + +

The expiration month of the card.

+
expirationYear + + + + string + + + + + + + +

The expiration year of the card.

+
cardholderName + + + + string + + + + + + + +

The cardholder name tokenized with the card.

+
lastFour + + + + string + + + + + + + +

Last four digits of card number.

+
lastTwo + + + + string + + + + + + + +

Last two digits of card number.

+
+ +
description + + + + string + + + + + + + +

A human-readable description.

+
type + + + + string + + + + + + + +

The payment method type, always CreditCard.

+
binData + + + + object + + + + + + + +

Information about the card based on the bin.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
commercial + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
countryOfIssuance + + + + string + + + + + + + +

The country of issuance.

+
debit + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
durbinRegulated + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
healthcare + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
issuingBank + + + + string + + + + + + + +

The issuing bank.

+
payroll + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
prepaid + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
productId + + + + string + + + + + + + +

The product id.

+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +

Events

+ + + + + + + + + + + + + +

+ binAvailable :string +

+
+ + + + + +
+

This event is emitted when the first 6 digits of the card number have been entered by the customer.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Listening to a `binAvailable` event +

+ + +
hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+  hostedFieldsInstance.on('binAvailable', function (event) {
+    event.bin // send bin to 3rd party bin service
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ blur :HostedFields~stateObject +

+
+ + + + + +
+

This event is emitted when a field loses focus.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Listening to a blur event +

+ + +
hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+  hostedFieldsInstance.on('blur', function (event) {
+    console.log(event.emittedBy, 'lost focus');
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ cardTypeChange :HostedFields~stateObject +

+
+ + + + + +
+

This event is emitted when activity within the number field has changed such that the possible card type has changed.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Listening to a cardTypeChange event +

+ + +
hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+  hostedFieldsInstance.on('cardTypeChange', function (event) {
+    if (event.cards.length === 1) {
+      console.log(event.cards[0].type);
+    } else {
+      console.log('Type of card not yet known');
+    }
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ empty :HostedFields~stateObject +

+
+ + + + + +
+

This event is emitted when a field transitions from having data to being empty.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Listening to an empty event +

+ + +
hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+  hostedFieldsInstance.on('empty', function (event) {
+    console.log(event.emittedBy, 'is now empty');
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ focus :HostedFields~stateObject +

+
+ + + + + +
+

This event is emitted when a field gains focus.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Listening to a focus event +

+ + +
hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+  hostedFieldsInstance.on('focus', function (event) {
+    console.log(event.emittedBy, 'gained focus');
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ inputSubmitRequest :HostedFields~stateObject +

+
+ + + + + +
+

This event is emitted when the user requests submission of an input field, such as by pressing the Enter or Return key on their keyboard, or mobile equivalent.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Clicking a submit button upon hitting Enter (or equivalent) within a Hosted Field +

+ + +
var hostedFields = require('braintree-web/hosted-fields');
+var submitButton = document.querySelector('input[type="submit"]');
+
+hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+  hostedFieldsInstance.on('inputSubmitRequest', function () {
+    // User requested submission, e.g. by pressing Enter or equivalent
+    submitButton.click();
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ notEmpty :HostedFields~stateObject +

+
+ + + + + +
+

This event is emitted when a field transitions from being empty to having data.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Listening to an notEmpty event +

+ + +
hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+  hostedFieldsInstance.on('notEmpty', function (event) {
+    console.log(event.emittedBy, 'is now not empty');
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ validityChange :HostedFields~stateObject +

+
+ + + + + +
+

This event is emitted when the validity of a field has changed. Validity is represented in the stateObject as two booleans: isValid and isPotentiallyValid.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Listening to a validityChange event +

+ + +
hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+  hostedFieldsInstance.on('validityChange', function (event) {
+    var field = event.fields[event.emittedBy];
+
+    if (field.isValid) {
+      console.log(event.emittedBy, 'is fully valid');
+    } else if (field.isPotentiallyValid) {
+      console.log(event.emittedBy, 'is potentially valid');
+    } else {
+      console.log(event.emittedBy, 'is not valid');
+    }
+  });
+});
+ + +
+ + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/LocalPayment.html b/3.111.1/LocalPayment.html new file mode 100644 index 00000000..b7761c3f --- /dev/null +++ b/3.111.1/LocalPayment.html @@ -0,0 +1,5319 @@ + + + + + + + + + LocalPayment - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ LocalPayment +

+ + + + +
+
+ +

+ + LocalPayment + +

+ + +
+

This class represents a LocalPayment component. Instances of this class can open a LocalPayment window for paying with alternate payments local to a specific country. Any additional UI, such as disabling the page while authentication is taking place, is up to the developer.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new LocalPayment(options) +

+
+ + + + + +
+

Do not use this constructor directly. Use braintree-web.local-payment.create instead.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

see local-payment.create

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ closeWindow() → {void} +

+
+ + + + + +
+

Closes the LocalPayment window if it is open.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
localPaymentInstance.closeWindow();
+ + +
+ + + + + + + + + + + + + + +

+ focusWindow() → {void} +

+
+ + + + + +
+

Focuses the LocalPayment window if it is open.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
localPaymentInstance.focusWindow();
+ + +
+ + + + + + + + + + + + + + +

+ hasTokenizationParams() → {Boolean} +

+
+ + + + + +
+

Checks if required tokenization parameters are available in querystring for manual tokenization requests.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
// if query string contains
+// ?btLpToken=token&btLpPaymentId=payment-id&btLpPayerId=payer-id
+localPaymentInstance.hasTokenizationParams(); // true
+
+// if query string is missing required params
+localPaymentInstance.hasTokenizationParams(); // false
+
+if (localPaymentInstance.hasTokenizationParams()) {
+  localPaymentInstance.tokenize();
+}
+ + +
+ + + + + + + + + + + + + + +

+ startPayment(options, callback) → {Promise|void} +

+
+ + + + + +
+

Launches the local payment flow and returns a nonce payload. Only one local payment flow should be active at a time. One way to achieve this is to disable your local payment button while the flow is open.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + LocalPayment~StartPaymentOptions + + + | + + + LocalPayment~StartPaymentPayUponInvoiceOptions + + + + + + + +

Options for initiating the local payment payment flow.

+ +
callback + + + + callback + + + + + + + +

The second argument, data, is a startPaymentPayload. If no callback is provided, the method will return a Promise that resolves with a startPaymentPayload.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
localPaymentInstance.startPayment({
+  paymentType: 'ideal',
+  paymentTypeCountryCode: 'NL',
+  fallback: {
+    buttonText: 'Return to Merchant',
+    url: 'https://example.com/my-checkout-page'
+  },
+  amount: '10.00',
+  currencyCode: 'EUR',
+  givenName: 'Joe',
+  surname: 'Doe',
+  address: {
+    countryCode: 'NL'
+  },
+  onPaymentStart: function (data, continueCallback) {
+    // Do any preprocessing before starting the flow
+    // data.paymentId is the ID of the localPayment
+    continueCallback();
+  }
+}).then(function (payload) {
+  // Submit payload.nonce to your server
+}).catch(function (startPaymentError) {
+  // Handle flow errors or premature flow closure
+  console.error('Error!', startPaymentError);
+});
+ +

+ Pay Upon Invoice +

+ + +
localPaymentInstance.startPayment({
+  paymentType: 'pay_upon_invoice',
+  amount: '100.00',
+  currencyCode: 'EUR',
+  givenName: 'Max',
+  surname: 'Mustermann',
+  address: { // This is used as the shipping address.
+    streetAddress: 'Taunusanlage 12',
+    locality: 'Frankfurt',
+    postalCode: '60325',
+    countryCode: 'DE',
+  },
+  billingAddress: {
+    streetAddress: 'Schönhauser Allee 84',
+    locality: 'Berlin',
+    postalCode: '10439',
+    countryCode: 'DE'
+  },
+  birthDate: '1990-01-01',
+  email: 'buyer@example.com',
+  locale: 'en-DE',
+  customerServiceInstructions: 'Customer service phone is +49 6912345678.',
+  lineItems: [{
+    category: 'PHYSICAL_GOODS',
+    name: 'Basketball Shoes',
+    quantity: '1',
+    unitAmount: '81.00',
+    unitTaxAmount: '19.00',
+  }],
+  phone: '6912345678',
+  phoneCountryCode: '49',
+  correlationId: correlationId,
+  onPaymentStart: function (data) {
+    // NOTE: It is critical here to store data.paymentId on your server
+    //       so it can be mapped to a webhook sent by Braintree once the
+    //       buyer completes their payment.
+    console.log('Payment ID:', data.paymentId);
+  },
+}).catch(function (err) {
+  // Handle any error calling startPayment.
+  console.error(err);
+});
+ +

+ BLIK seamless +

+ + +
localPaymentInstance.startPayment({
+  paymentType: 'blik',
+  paymentTypeCountryCode: 'PL',
+  amount: '10.00',
+  currencyCode: 'PLN',
+  givenName: 'Joe',
+  surname: 'Doe',
+  phone: '1234566789',
+  address: {
+    streetAddress: 'Mokotowska 1234',
+    locality: 'Warsaw',
+    postalCode: '02-697',
+    countryCode: 'PL',
+  },
+  blikOptions: {
+    level_0: {
+      authCode: "123456",
+    },
+  },
+  onPaymentStart: function (data) {
+    // NOTE: It is critical here to store data.paymentId on your server
+    //       so it can be mapped to a webhook sent by Braintree once the
+    //       buyer completes their payment.
+    console.log('Payment ID:', data.paymentId);
+  },
+}).catch(function (err) {
+  // Handle any error calling startPayment.
+  console.error(err);
+});
+ +

+ BLIK oneclick first payment +

+ + +
localPaymentInstance.startPayment({
+  paymentType: 'blik',
+  paymentTypeCountryCode: 'PL',
+  amount: '10.00',
+  currencyCode: 'PLN',
+  givenName: 'Joe',
+  surname: 'Doe',
+  phone: '1234566789',
+  address: {
+    streetAddress: 'Mokotowska 1234',
+    locality: 'Warsaw',
+    postalCode: '02-697',
+    countryCode: 'PL',
+  },
+  blikOptions: {
+    oneClick: {
+      authCode: "123456",
+      consumerReference: "ABCde123",
+      aliasLabel: "my uniq alias",
+    },
+  },
+  onPaymentStart: function (data) {
+    // NOTE: It is critical here to store data.paymentId on your server
+    //       so it can be mapped to a webhook sent by Braintree once the
+    //       buyer completes their payment.
+    console.log('Payment ID:', data.paymentId);
+  },
+}).catch(function (err) {
+  // Handle any error calling startPayment.
+  console.error(err);
+});
+ +

+ BLIK oneclick subsequent payment +

+ + +
localPaymentInstance.startPayment({
+  paymentType: 'blik',
+  paymentTypeCountryCode: 'PL',
+  amount: '10.00',
+  currencyCode: 'PLN',
+  givenName: 'Joe',
+  surname: 'Doe',
+  phone: '1234566789',
+  address: {
+    streetAddress: 'Mokotowska 1234',
+    locality: 'Warsaw',
+    postalCode: '02-697',
+    countryCode: 'PL',
+  },
+  blikOptions: {
+    oneClick: {
+      consumerReference: "ABCde123",
+      aliasKey: "123456789",
+    },
+  },
+  onPaymentStart: function (data) {
+    // NOTE: It is critical here to store data.paymentId on your server
+    //       so it can be mapped to a webhook sent by Braintree once the
+    //       buyer completes their payment.
+    console.log('Payment ID:', data.paymentId);
+  },
+}).catch(function (err) {
+  // Handle any error calling startPayment.
+  console.error(err);
+});
+ +

+ MB WAY +

+ + +
localPaymentInstance.startPayment({
+  paymentType: 'mbway',
+  amount: '10.00',
+  currencyCode: 'EUR',
+  givenName: 'Joe',
+  surname: 'Doe',
+  phone: '1234566789',
+  phoneCountryCode: '351'
+  address: {
+    streetAddress: 'Rua Escura 12',
+    locality: 'Porto',
+    postalCode: '4465-283',
+    countryCode: 'PT',
+  },
+  onPaymentStart: function (data) {
+    // NOTE: It is critical here to store data.paymentId on your server
+    //       so it can be mapped to a webhook sent by Braintree once the
+    //       buyer completes their payment.
+    console.log('Payment ID:', data.paymentId);
+  },
+}).catch(function (err) {
+  // Handle any error calling startPayment.
+  console.error(err);
+});
+ +

+ BANCOMAT PAY +

+ + +
localPaymentInstance.startPayment({
+  paymentType: 'bancomatpay',
+  amount: '10.00',
+  currencyCode: 'EUR',
+  givenName: 'Joe',
+  surname: 'Doe',
+  phone: '1234566789',
+  phoneCountryCode: '49'
+  address: {
+    streetAddress: 'Via del Corso 12',
+    locality: 'Roma',
+    postalCode: '00100',
+    countryCode: 'IT',
+  },
+  onPaymentStart: function (data) {
+    // NOTE: It is critical here to store data.paymentId on your server
+    //       so it can be mapped to a webhook sent by Braintree once the
+    //       buyer completes their payment.
+    console.log('Payment ID:', data.paymentId);
+  },
+}).catch(function (err) {
+  // Handle any error calling startPayment.
+  console.error(err);
+});
+ + +
+ + + + + + + + + + + + + + +

+ teardown(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Cleanly remove anything set up by create.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called on completion.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
localPaymentInstance.teardown();
+ +

+ With callback +

+ + +
localPaymentInstance.teardown(function () {
+  // teardown is complete
+});
+ + +
+ + + + + + + + + + + + + + +

+ tokenize(paramsopt, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Manually tokenizes params for a local payment received from PayPal.When app switching back from a mobile application (such as a bank application for an iDEAL payment), the window may lose context with the parent page. In that case, a fallback url is used, and this method can be used to finish the flow.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
params + + + + object + + + + + + + + + <optional>
+ + + + + +
+

All options for tokenizing local payment parameters. If no params are passed in, the params will be pulled off of the query string of the page.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
btLpToken + + + + string + + + + + + + +

The token representing the local payment. Aliased to token if btLpToken is not present.

+ +
btLpPaymentId + + + + string + + + + + + + +

The payment id for the local payment. Aliased to paymentId if btLpPaymentId is not present.

+ +
btLpPayerId + + + + string + + + + + + + +

The payer id for the local payment. Aliased to PayerID if btLpPayerId is not present.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is a startPaymentPayload. If no callback is provided, the method will return a Promise that resolves with a startPaymentPayload.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
localPaymentInstance.tokenize().then(function (payload) {
+  // send payload.nonce to your server
+}).catch(function (err) {
+  // handle tokenization error
+});
+ + +
+ + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ StartPaymentOptions :object +

+
+ + + + + +
+

Options used for most local payment types.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
fallback + + + + object + + + + + + + + + + + +

Configuration for what to do when app switching back from a Bank app on a mobile device. Only applicable to the popup flow.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
buttonText + + + + string + + + + + + + +

The text to display in a button to redirect back to the merchant page.

+
url + + + + string + + + + + + + +

The url to redirect to when the redirect button is pressed. Query params will be added to the url to process the data returned from the bank.

+
cancelButtonText + + + + string + + + + + + + +

The text to display in a button to redirect back to the merchant page when the customer cancels. If no cancelButtonText is provided, buttonText will be used.

+
cancelUrl + + + + string + + + + + + + +

The url to redirect to when the redirect button is pressed when the customer cancels. Query params will be added to the url to check the state of the payment. If no cancelUrl is provided, url will be used.

+
+ +
windowOptions + + + + object + + + + + + + + + <optional>
+ + + +
+

The options for configuring the window that is opened when starting the payment. Only applicable to the popup flow.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
width + + + + number + + + + + + + + + <optional>
+ + + +
+ + 1282 + + +

The width in pixels of the window opened when starting the payment. The default width size is this large to allow various banking partner landing pages to display the QR Code to be scanned by the bank's mobile app. Many will not display the QR code when the window size is smaller than a standard desktop screen.

+
height + + + + number + + + + + + + + + <optional>
+ + + +
+ + 720 + + +

The height in pixels of the window opened when starting the payment.

+
+ +
amount + + + + string + + + + + + + + + + + +

The amount to authorize for the transaction.

+
currencyCode + + + + string + + + + + + + + + + + +

The currency to process the payment (three-character ISO-4217).

+
displayName + + + + string + + + + + + + + + <optional>
+ + + +
+

The merchant name displayed inside of the window that is opened when starting the payment.

+
paymentType + + + + string + + + + + + + + + + + +

The type of local payment. See https://developer.paypal.com/braintree/docs/guides/local-payment-methods/client-side-custom

+
paymentTypeCountryCode + + + + string + + + + + + + + + + + +

The country code of the local payment. This value must be one of the supported country codes for a given local payment type listed here. For local payments supported in multiple countries, this value may determine which banks are presented to the customer.

+
email + + + + string + + + + + + + + + + + +

Payer email of the customer.

+
givenName + + + + string + + + + + + + + + + + +

First name of the customer.

+
surname + + + + string + + + + + + + + + + + +

Last name of the customer.

+
phone + + + + string + + + + + + + + + + + +

Phone number of the customer.

+
bic + + + + string + + + + + + + + + + + +

Bank Identification Code of the customer (specific to iDEAL transactions).

+
recurrent + + + + boolean + + + + + + + + + + + +

Enable recurrent payment.

+
customerId + + + + string + + + + + + + + + + + +

The customer's id in merchant's system (required for recurrent payments).

+
shippingAddressRequired + + + + boolean + + + + + + + + + + + +

Indicates whether or not the payment needs to be shipped. For digital goods, this should be false. Defaults to false.

+
address + + + + object + + + + + + + + + + + +

The shipping address.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
streetAddress + + + + string + + + + + + + +

Line 1 of the Address (eg. number, street, etc). An error will occur if this address is not valid.

+
extendedAddress + + + + string + + + + + + + +

Line 2 of the Address (eg. suite, apt #, etc.). An error will occur if this address is not valid.

+
locality + + + + string + + + + + + + +

Customer's city.

+
region + + + + string + + + + + + + +

Customer's region or state.

+
postalCode + + + + string + + + + + + + +

Customer's postal code.

+
countryCode + + + + string + + + + + + + +

Customer's country code (two-character ISO 3166-1 code).

+
+ +
onPaymentStart + + + + function + + + + + + + + + + + +

A function that will be called with two parameters: an object containing the paymentId and a continueCallback that must be called to launch the flow. You can use method to do any preprocessing on your server before the flow begins..

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ StartPaymentOptions :object +

+
+ + + + + +
+

Options used for the seamless/oneclick BLIK local payment type.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
amount + + + + string + + + + + + + + + + + +

The amount to authorize for the transaction.

+
currencyCode + + + + string + + + + + + + + + + + +

The currency to process the payment (three-character ISO-4217).

+
displayName + + + + string + + + + + + + + + <optional>
+ + + +
+

The merchant name displayed inside of the window that is opened when starting the payment.

+
paymentType + + + + string + + + + + + + + + + + +

The type of local payment. Must be blik.

+
paymentTypeCountryCode + + + + string + + + + + + + + + + + +

The country code of the local payment. This value must be one of the supported country codes for a given local payment type listed here. For local payments supported in multiple countries, this value may determine which banks are presented to the customer.

+
email + + + + string + + + + + + + + + + + +

Payer email of the customer.

+
givenName + + + + string + + + + + + + + + + + +

First name of the customer.

+
surname + + + + string + + + + + + + + + + + +

Last name of the customer.

+
phone + + + + string + + + + + + + + + + + +

Phone number of the customer.

+
shippingAddressRequired + + + + boolean + + + + + + + + + + + +

Indicates whether or not the payment needs to be shipped. For digital goods, this should be false. Defaults to false.

+
address + + + + object + + + + + + + + + + + +

The shipping address.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
streetAddress + + + + string + + + + + + + +

Line 1 of the Address (eg. number, street, etc). An error will occur if this address is not valid.

+
extendedAddress + + + + string + + + + + + + +

Line 2 of the Address (eg. suite, apt #, etc.). An error will occur if this address is not valid.

+
locality + + + + string + + + + + + + +

Customer's city.

+
region + + + + string + + + + + + + +

Customer's region or state.

+
postalCode + + + + string + + + + + + + +

Customer's postal code.

+
countryCode + + + + string + + + + + + + +

Customer's country code (two-character ISO 3166-1 code).

+
+ +
blikOptions + + + + object + + + + + + + + + + + +

Blik seamless/oneclick specific options. Should contain only one object: level_0 or oneClick.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
level_0 + + + + object + + + + + + + +

Blik seamless specific options.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
authCode + + + + string + + + + + + + +

6-digit code used to authenticate a consumer within BLIK.

+
+ +
oneClick + + + + object + + + + + + + +

Blik oneclick specific options.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
authCode + + + + string + + + + + + + +

6-digit code used to authenticate a consumer within BLIK.

+
consumerReference + + + + string + + + + + + + +

The merchant generated, unique reference serving as a primary identifier for accounts connected between Blik and a merchant.

+
aliasLabel + + + + string + + + + + + + +

A bank defined identifier used as a display name to allow the payer to differentiate between multiple registered bank accounts.

+
aliasKey + + + + string + + + + + + + +

A Blik-defined identifier for a specific Blik-enabled bank account that is associated with a given merchant. Used only in conjunction with a Consumer Reference.

+
+ +
+ +
onPaymentStart + + + + function + + + + + + + + + + + +

A function that will be called with an object containing the paymentId. The continueCallback is not provided as it is not needed for this use case.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ StartPaymentPayUponInvoiceOptions :object +

+
+ + + + + +
+

Options used for the Pay Upon Invoice local payment type.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
amount + + + + string + + + + + + + + + + + +

The amount to authorize for the transaction.

+
currencyCode + + + + string + + + + + + + + + + + +

The currency to process the payment (three-character ISO-4217).

+
displayName + + + + string + + + + + + + + + <optional>
+ + + +
+

The merchant name displayed inside of the window that is opened when starting the payment.

+
paymentType + + + + string + + + + + + + + + + + +

The type of local payment. Must be pay_upon_invoice.

+
paymentTypeCountryCode + + + + string + + + + + + + + + <optional>
+ + + +
+

The country code of the local payment. This value must be one of the supported country codes for a given local payment type listed here. For local payments supported in multiple countries, this value may determine which banks are presented to the customer.

+
email + + + + string + + + + + + + + + + + +

Payer email of the customer.

+
givenName + + + + string + + + + + + + + + + + +

First name of the customer.

+
surname + + + + string + + + + + + + + + + + +

Last name of the customer.

+
phone + + + + string + + + + + + + + + + + +

Phone number of the customer.

+
phoneCountryCode + + + + string + + + + + + + + + + + +

The country calling code.

+
birthDate + + + + string + + + + + + + + + + + +

The birth date of the customer in YYYY-MM-DD format.

+
address + + + + object + + + + + + + + + + + +

The shipping address.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
streetAddress + + + + string + + + + + + + + + + + +

Line 1 of the Address (eg. number, street, etc). An error will occur if this address is not valid.

+
extendedAddress + + + + string + + + + + + + + + <optional>
+ + + +
+

Line 2 of the Address (eg. suite, apt #, etc.). An error will occur if this address is not valid.

+
locality + + + + string + + + + + + + + + + + +

Customer's city.

+
region + + + + string + + + + + + + + + <optional>
+ + + +
+

Customer's region or state.

+
postalCode + + + + string + + + + + + + + + + + +

Customer's postal code.

+
countryCode + + + + string + + + + + + + + + + + +

Customer's country code (two-character ISO 3166-1 code).

+
+ +
shippingAmount + + + + string + + + + + + + + + <optional>
+ + + +
+

The shipping fee for all items. This value can not be a negative number.

+
discountAmount + + + + string + + + + + + + + + <optional>
+ + + +
+

The discount for all items. This value can not be a negative number.

+
billingAddress + + + + object + + + + + + + + + + + +

The billing address.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
streetAddress + + + + string + + + + + + + + + + + +

Line 1 of the Address (eg. number, street, etc). An error will occur if this address is not valid.

+
extendedAddress + + + + string + + + + + + + + + <optional>
+ + + +
+

Line 2 of the Address (eg. suite, apt #, etc.). An error will occur if this address is not valid.

+
locality + + + + string + + + + + + + + + + + +

Customer's city.

+
region + + + + string + + + + + + + + + <optional>
+ + + +
+

Customer's region or state.

+
postalCode + + + + string + + + + + + + + + + + +

Customer's postal code.

+
countryCode + + + + string + + + + + + + + + + + +

Customer's country code (two-character ISO 3166-1 code).

+
+ +
lineItems + + + + Array.<object> + + + + + + + + + + + +

List of line items.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
category + + + + string + + + + + + + +

The item category type: 'DIGITAL_GOODS', 'PHYSICAL_GOODS', or 'DONATION'.

+
name + + + + string + + + + + + + +

Item name. Maximum 127 characters.

+
quantity + + + + string + + + + + + + +

Number of units of the item purchased. This value must be a whole number and can't be negative or zero.

+
unitAmount + + + + string + + + + + + + +

Per-unit price of the item. Can include up to 2 decimal places. This value can't be negative or zero.

+
unitTaxAmount + + + + string + + + + + + + +

Per-unit tax price of the item. Can include up to 2 decimal places. This value can't be negative.

+
+ +
locale + + + + string + + + + + + + + + + + +

The BCP 47-formatted locale. PayPal supports a five-character code. For example, en-DE, da-DK, he-IL, id-ID, ja-JP, no-NO, pt-BR, ru-RU, sv-SE, th-TH, zh-CN, zh-HK, or zh-TW.

+
customerServiceInstructions + + + + string + + + + + + + + + + + +

Instructions for how to contact the merchant's customer service. Maximum 4,000 characters.

+
correlationId + + + + string + + + + + + + + + + + +

Used to correlate user sessions with server transactions.

+
onPaymentStart + + + + function + + + + + + + + + + + +

A function that will be called with an object containing the paymentId. The continueCallback is not provided as it is not needed for this use case.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/Masterpass.html b/3.111.1/Masterpass.html new file mode 100644 index 00000000..738f68ba --- /dev/null +++ b/3.111.1/Masterpass.html @@ -0,0 +1,2304 @@ + + + + + + + + + Masterpass - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ Masterpass +

+ + + + +
+
+ +

+ + Masterpass + +

+ + +
+

This class represents an Masterpass component. Instances of this class have methods for launching a new window to process a transaction with Masterpass.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new Masterpass(options) +

+
+ + + + + +
+

You cannot use this constructor directly. Use braintree.masterpass.create instead.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

see masterpass.create

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ teardown(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Cleanly tear down anything set up by create.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called on completion. If no callback is provided, teardown returns a promise.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
masterpassInstance.teardown();
+ +

+ With callback +

+ + +
masterpassInstance.teardown(function () {
+  // teardown is complete
+});
+ + +
+ + + + + + + + + + + + + + +

+ tokenize(options, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Launches the Masterpass flow and returns a nonce payload. Only one Masterpass flow should be active at a time. One way to achieve this is to disable your Masterpass button while the flow is open.

+

Braintree will apply these properties in options.config. Merchants should not override these values, except for advanced usage.

+
    +
  • environment
  • +
  • requestToken
  • +
  • callbackUrl
  • +
  • merchantCheckoutId
  • +
  • allowedCardTypes
  • +
  • version
  • +
+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

All options for initiating the Masterpass payment flow.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
currencyCode + + + + string + + + + + + + + + + + + + +

The currency code to process the payment.

+ +
subtotal + + + + string + + + + + + + + + + + + + +

The amount to authorize for the transaction.

+ +
config + + + + object + + + + + + + + + <optional>
+ + + + + +
+

All configuration parameters accepted by Masterpass lightbox, except function data type. These options will override the values set by Braintree server. Please see https://developer.mastercard.com/page/masterpass-lightbox-parameters for more information.

+ +
frameOptions + + + + object + + + + + + + + + <optional>
+ + + + + +
+

Used to configure the window that contains the Masterpass login.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
width + + + + number + + + + + + + + + <optional>
+ + + + + +
+

Popup width to be used instead of default value (450px).

+ +
height + + + + number + + + + + + + + + <optional>
+ + + + + +
+

Popup height to be used instead of default value (660px).

+ +
top + + + + number + + + + + + + + + <optional>
+ + + + + +
+

The top position of the popup window to be used instead of default value, that is calculated based on provided height, and parent window size.

+ +
left + + + + number + + + + + + + + + <optional>
+ + + + + +
+

The left position to the popup window to be used instead of default value, that is calculated based on provided width, and parent window size.

+ +
+ + +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is a tokenizePayload. If no callback is provided, the method will return a Promise that resolves with a tokenizePayload.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
button.addEventListener('click', function () {
+  // Disable the button so that we don't attempt to open multiple popups.
+  button.setAttribute('disabled', 'disabled');
+
+  // Because tokenize opens a new window, this must be called
+  // as a result of a user action, such as a button click.
+  masterpassInstance.tokenize({
+    currencyCode: 'USD',
+    subtotal: '10.00'
+  }).then(function (payload) {
+    button.removeAttribute('disabled');
+    // Submit payload.nonce to your server
+  }).catch(function (tokenizeError) {
+    button.removeAttribute('disabled');
+    // Handle flow errors or premature flow closure
+
+    switch (tokenizeErr.code) {
+      case 'MASTERPASS_POPUP_CLOSED':
+        console.error('Customer closed Masterpass popup.');
+        break;
+      case 'MASTERPASS_ACCOUNT_TOKENIZATION_FAILED':
+        console.error('Masterpass tokenization failed. See details:', tokenizeErr.details);
+        break;
+      case 'MASTERPASS_FLOW_FAILED':
+        console.error('Unable to initialize Masterpass flow. Are your options correct?', tokenizeErr.details);
+        break;
+      default:
+        console.error('Error!', tokenizeErr);
+    }
+  });
+});
+ + +
+ + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ Address :object +

+
+ + + + + +
+

Masterpass Address object.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
countryCodeAlpha2 + + + + string + + + + + + + +

The customer's country code.

+
extendedAddress + + + + string + + + + + + + +

The customer's extended address.

+
locality + + + + string + + + + + + + +

The customer's locality.

+
postalCode + + + + string + + + + + + + +

The customer's postal code.

+
region + + + + string + + + + + + + +

The customer's region.

+
streetAddress + + + + string + + + + + + + +

The customer's street address.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ tokenizePayload :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nonce + + + + string + + + + + + + +

The payment method nonce.

+
description + + + + string + + + + + + + +

The human readable description.

+
type + + + + string + + + + + + + +

The payment method type, always MasterpassCard.

+
details + + + + object + + + + + + + +

Additional account details.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
cardType + + + + string + + + + + + + +

Type of card, ex: Visa, MasterCard.

+
lastFour + + + + string + + + + + + + +

Last four digits of card number.

+
lastTwo + + + + string + + + + + + + +

Last two digits of card number.

+
+ +
contact + + + + object + + + + + + + +

The customer's contact information.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
firstName + + + + string + + + + + + + +

The customer's first name.

+
lastName + + + + string + + + + + + + +

The customer's last name.

+
phoneNumber + + + + string + + + + + + + +

The customer's phone number.

+
emailAddress + + + + string + + + + + + + +

The customer's email address.

+
+ +
billingAddress + + + + Masterpass~Address + + + + + + + +

The customer's billing address.

+
shippingAddress + + + + Masterpass~Address + + + + + + + +

The customer's shipping address.

+
binData + + + + object + + + + + + + +

Information about the card based on the bin.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
commercial + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
countryOfIssuance + + + + string + + + + + + + +

The country of issuance.

+
debit + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
durbinRegulated + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
healthcare + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
issuingBank + + + + string + + + + + + + +

The issuing bank.

+
payroll + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
prepaid + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
productId + + + + string + + + + + + + +

The product id.

+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/PayPal.html b/3.111.1/PayPal.html new file mode 100644 index 00000000..c4a8ea60 --- /dev/null +++ b/3.111.1/PayPal.html @@ -0,0 +1,3542 @@ + + + + + + + + + PayPal - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ PayPal +

+ + + + +
+
+ +

+ + PayPal + +

+ + +
+

This class represents a PayPal component. Instances of this class can open a PayPal window for authenticating a PayPal account. Any additional UI, such as disabling the page while authentication is taking place, is up to the developer.

+

This component has been deprecated in favor of the PayPal Checkout component, which provides a fully managed UI. New features will not be added to this component.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new PayPal(options) +

+
+ + + + + +
+

Do not use this constructor directly. Use braintree-web.paypal.create instead.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

see paypal.create

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ teardown +

+ + + + +
+

Cleanly remove anything set up by create.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + +
Examples
+ + +
paypalInstance.teardown();
+ +

+ With callback +

+ + +
paypalInstance.teardown(function () {
+  // teardown is complete
+});
+ + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ closeWindow() → {void} +

+
+ + + + + +
+

Closes the PayPal window if it is open.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
paypalInstance.closeWindow();
+ + +
+ + + + + + + + + + + + + + +

+ focusWindow() → {void} +

+
+ + + + + +
+

Focuses the PayPal window if it is open.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
paypalInstance.focusWindow();
+ + +
+ + + + + + + + + + + + + + +

+ tokenize(options, callback) → {Promise|PayPal~tokenizeReturn} +

+
+ + + + + +
+

Launches the PayPal login flow and returns a nonce payload. Only one PayPal login flow should be active at a time. One way to achieve this is to disable your PayPal button while the flow is open.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

All tokenization options for the PayPal component.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
flow + + + + string + + + + + + + + + + + + + + + +

Set to 'checkout' for one-time payment flow, or 'vault' for Vault flow. If 'vault' is used with a client token generated with a customer id, the PayPal account will be added to that customer as a saved payment method.

+ +
intent + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + authorize + + +
    +
  • authorize - Submits the transaction for authorization but not settlement.
  • +
  • order - Validates the transaction without an authorization (i.e. without holding funds). Useful for authorizing and capturing funds up to 90 days after the order has been placed. Only available for Checkout flow.
  • +
  • sale - Payment will be immediately submitted for settlement upon creating a transaction.
  • +
+ +
offerCredit + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + false + + +

Offers PayPal Credit as the default funding instrument for the transaction. If the customer isn't pre-approved for PayPal Credit, they will be prompted to apply for it.

+ +
offerPayLater + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + false + + +

Offers PayPal Pay Later if the customer qualifies. Defaults to false. Only available with flow: 'checkout'.

+ +
useraction + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

Changes the call-to-action in the PayPal flow. By default the final button will show the localized +word for "Continue" and implies that the final amount billed is not yet known.

+

Setting this option to commit changes the button text to "Pay Now" and page text will convey to +the user that billing will take place immediately.

+ +
amount + + + + string + + + | + + + number + + + + + + + + + <optional>
+ + + + + +
+ + +

The amount of the transaction. Required when using the Checkout flow.

+ +
currency + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

The currency code of the amount, such as 'USD'. Required when using the Checkout flow.

+ +
displayName + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

The merchant name displayed inside of the PayPal lightbox; defaults to the company name on your Braintree account

+ +
locale + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + en_US + + +

Use this option to change the language, links, and terminology used in the PayPal flow. This locale will be used unless the buyer has set a preferred locale for their account. If an unsupported locale is supplied, a fallback locale (determined by buyer preference or browser data) will be used and no error will be thrown.

+

Supported locales are: +da_DK, +de_DE, +en_AU, +en_GB, +en_US, +es_ES, +fr_CA, +fr_FR, +id_ID, +it_IT, +ja_JP, +ko_KR, +nl_NL, +no_NO, +pl_PL, +pt_BR, +pt_PT, +ru_RU, +sv_SE, +th_TH, +zh_CN, +zh_HK, +and zh_TW.

+ +
enableShippingAddress + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + false + + +

Returns a shipping address object in PayPal#tokenize.

+ +
shippingAddressOverride + + + + object + + + + + + + + + <optional>
+ + + + + +
+ + +

Allows you to pass a shipping address you have already collected into the PayPal payment flow.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
line1 + + + + string + + + + + + + + + + + + + +

Street address.

+ +
line2 + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Street address (extended).

+ +
city + + + + string + + + + + + + + + + + + + +

City.

+ +
state + + + + string + + + + + + + + + + + + + +

State.

+ +
postalCode + + + + string + + + + + + + + + + + + + +

Postal code.

+ +
countryCode + + + + string + + + + + + + + + + + + + +

Country.

+ +
phone + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Phone number.

+ +
recipientName + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Recipient's name.

+ +
+ + +
shippingAddressEditable + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + true + + +

Set to false to disable user editing of the shipping address.

+ +
billingAgreementDescription + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

Use this option to set the description of the preapproved payment agreement visible to customers in their PayPal profile during Vault flows. Max 255 characters.

+ +
landingPageType + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

Use this option to specify the PayPal page to display when a user lands on the PayPal site to complete the payment.

+
    +
  • login - A PayPal account login page is used.
  • +
  • billing - A non-PayPal account landing page is used.
  • +
+ +
+ + +
callback + + + + callback + + + + + + + +

The second argument, data, is a tokenizePayload.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ +

+ Tokenizing with the vault flow +

+ + +
button.addEventListener('click', function () {
+  // Disable the button so that we don't attempt to open multiple popups.
+  button.setAttribute('disabled', 'disabled');
+
+  // if there is any other part of the page that must be disabled
+  // while authentication is in progress, do so now
+
+  // Because PayPal tokenization opens a popup, this must be called
+  // as a result of a user action, such as a button click.
+  paypalInstance.tokenize({
+    flow: 'vault' // Required
+    // Any other tokenization options
+  }, function (tokenizeErr, payload) {
+    button.removeAttribute('disabled');
+
+    // if any other part of the page was disabled, re-enable now
+
+    if (tokenizeErr) {
+      // Handle tokenization errors or premature flow closure
+
+      switch (tokenizeErr.code) {
+        case 'PAYPAL_POPUP_CLOSED':
+          console.error('Customer closed PayPal popup.');
+          break;
+        case 'PAYPAL_ACCOUNT_TOKENIZATION_FAILED':
+          console.error('PayPal tokenization failed. See details:', tokenizeErr.details);
+          break;
+        case 'PAYPAL_FLOW_FAILED':
+          console.error('Unable to initialize PayPal flow. Are your options correct?', tokenizeErr.details);
+          break;
+        default:
+          console.error('Error!', tokenizeErr);
+      }
+    } else {
+      // Submit payload.nonce to your server
+    }
+  });
+});
+ +

+ Tokenizing with the checkout flow +

+ + +
button.addEventListener('click', function () {
+  // Disable the button so that we don't attempt to open multiple popups.
+  button.setAttribute('disabled', 'disabled');
+
+  // Because PayPal tokenization opens a popup, this must be called
+  // as a result of a user action, such as a button click.
+  paypalInstance.tokenize({
+    flow: 'checkout', // Required
+    amount: '10.00', // Required
+    currency: 'USD' // Required
+    // Any other tokenization options
+  }, function (tokenizeErr, payload) {
+    button.removeAttribute('disabled');
+
+    if (tokenizeErr) {
+      // Handle tokenization errors or premature flow closure
+
+      switch (tokenizeErr.code) {
+        case 'PAYPAL_POPUP_CLOSED':
+          console.error('Customer closed PayPal popup.');
+          break;
+        case 'PAYPAL_ACCOUNT_TOKENIZATION_FAILED':
+          console.error('PayPal tokenization failed. See details:', tokenizeErr.details);
+          break;
+        case 'PAYPAL_FLOW_FAILED':
+          console.error('Unable to initialize PayPal flow. Are your options correct?', tokenizeErr.details);
+          break;
+        default:
+          console.error('Error!', tokenizeErr);
+      }
+    } else {
+      // Submit payload.nonce to your server
+    }
+  });
+});
+ + +
+ + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ tokenizePayload :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
nonce + + + + string + + + + + + + + + + + +

The payment method nonce.

+
type + + + + string + + + + + + + + + + + +

The payment method type, always PayPalAccount.

+
details + + + + object + + + + + + + + + + + +

Additional PayPal account details.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
email + + + + string + + + + + + + + + + + +

User's email address.

+
payerId + + + + string + + + + + + + + + + + +

User's payer ID, the unique identifier for each PayPal account.

+
firstName + + + + string + + + + + + + + + + + +

User's given name.

+
lastName + + + + string + + + + + + + + + + + +

User's surname.

+
countryCode + + + + string + + + + + + + + + + + <nullable>
+ +
+

User's 2 character country code.

+
phone + + + + string + + + + + + + + + + + <nullable>
+ +
+

User's phone number (e.g. 555-867-5309).

+
shippingAddress + + + + object + + + + + + + + + + + <nullable>
+ +
+

User's shipping address details, only available if shipping address is enabled.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
recipientName + + + + string + + + + + + + +

Recipient of postage.

+
line1 + + + + string + + + + + + + +

Street number and name.

+
line2 + + + + string + + + + + + + +

Extended address.

+
city + + + + string + + + + + + + +

City or locality.

+
state + + + + string + + + + + + + +

State or region.

+
postalCode + + + + string + + + + + + + +

Postal code.

+
countryCode + + + + string + + + + + + + +

2 character country code (e.g. US).

+
+ +
billingAddress + + + + object + + + + + + + + + + + <nullable>
+ +
+

User's billing address details. +Not available to all merchants; contact support for details on eligibility and enabling this feature. +Alternatively, see shippingAddress above as an available client option.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
line1 + + + + string + + + + + + + +

Street number and name.

+
line2 + + + + string + + + + + + + +

Extended address.

+
city + + + + string + + + + + + + +

City or locality.

+
state + + + + string + + + + + + + +

State or region.

+
postalCode + + + + string + + + + + + + +

Postal code.

+
countryCode + + + + string + + + + + + + +

2 character country code (e.g. US).

+
+ +
+ +
creditFinancingOffered + + + + object + + + + + + + + + + + <nullable>
+ +
+

This property will only be present when the customer pays with PayPal Credit.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
totalCost + + + + object + + + + + + + +

This is the estimated total payment amount including interest and fees the user will pay during the lifetime of the loan.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + + + string + + + + + + + +

An amount defined by ISO 4217 for the given currency.

+
currency + + + + string + + + + + + + +

3 letter currency code as defined by ISO 4217.

+
+ +
term + + + + number + + + + + + + +

Length of financing terms in months.

+
monthlyPayment + + + + object + + + + + + + +

This is the estimated amount per month that the customer will need to pay including fees and interest.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + + + string + + + + + + + +

An amount defined by ISO 4217 for the given currency.

+
currency + + + + string + + + + + + + +

3 letter currency code as defined by ISO 4217.

+
+ +
totalInterest + + + + object + + + + + + + +

Estimated interest or fees amount the payer will have to pay during the lifetime of the loan.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + + + string + + + + + + + +

An amount defined by ISO 4217 for the given currency.

+
currency + + + + string + + + + + + + +

3 letter currency code as defined by ISO 4217.

+
+ +
payerAcceptance + + + + boolean + + + + + + + +

Status of whether the customer ultimately was approved for and chose to make the payment using the approved installment credit.

+
cartAmountImmutable + + + + boolean + + + + + + + +

Indicates whether the cart amount is editable after payer's acceptance on PayPal side.

+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ tokenizeReturn :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
close + + + + function + + + + + + + +

A handle to close the PayPal checkout flow.

+
focus + + + + function + + + + + + + +

A handle to focus the PayPal checkout flow. Note that some browsers (notably iOS Safari) do not support focusing popups. Firefox requires the focus call to occur as the result of a user interaction, such as a button click.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/PayPalCheckout.html b/3.111.1/PayPalCheckout.html new file mode 100644 index 00000000..dd464280 --- /dev/null +++ b/3.111.1/PayPalCheckout.html @@ -0,0 +1,7602 @@ + + + + + + + + + PayPalCheckout - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ PayPalCheckout +

+ + + + +
+
+ +

+ + PayPalCheckout + +

+ + +
+

This class represents a PayPal Checkout component that coordinates with the PayPal SDK. Instances of this class can generate payment data and tokenize authorized payments.

+

All UI (such as preventing actions on the parent page while authentication is in progress) is managed by the PayPal SDK. You must provide your PayPal client-id as a query parameter. You can retrieve this value from the PayPal Dashboard.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new PayPalCheckout(options) +

+
+ + + + + +
+

Do not use this constructor directly. Use braintree-web.paypal-checkout.create instead.

+

Integrate Checkout Flow with PayPal SDK

+

You must have PayPal's script, configured with various query parameters, loaded on your page:

+
<script src="https://www.paypal.com/sdk/js?client-id=your-sandbox-or-prod-client-id"></script>
+<div id="paypal-button"></div>
+
+

When passing values in the createPayment method, make sure they match the corresponding parameters in the query parameters for the PayPal SDK script.

+
braintree.client.create({
+  authorization: 'authorization'
+}).then(function (clientInstance) {
+  return braintree.paypalCheckout.create({
+    client: clientInstance
+  });
+}).then(function (paypalCheckoutInstance) {
+  return paypal.Buttons({
+    createOrder: function () {
+      return paypalCheckoutInstance.createPayment({
+        flow: 'checkout',
+        currency: 'USD',
+        amount: '10.00',
+        intent: 'capture' // this value must either be `capture` or match the intent passed into the PayPal SDK intent query parameter
+        // your other createPayment options here
+      });
+    },
+
+    onApprove: function (data, actions) {
+      // some logic here before tokenization happens below
+      return paypalCheckoutInstance.tokenizePayment(data).then(function (payload) {
+        // Submit payload.nonce to your server
+      });
+    },
+
+    onCancel: function () {
+      // handle case where user cancels
+    },
+
+    onError: function (err) {
+      // handle case where error occurs
+    }
+  }).render('#paypal-button');
+}).catch(function (err) {
+ console.error('Error!', err);
+});
+
+

Integrate Vault Flow with PayPal SDK

+

You must have PayPal's script, configured with various query parameters, loaded on your page:

+
<script src="https://www.paypal.com/sdk/js?client-id=your-sandbox-or-prod-client-id&vault=true"></script>
+<div id="paypal-button"></div>
+
+

When passing values in the createPayment method, make sure they match the corresponding parameters in the query parameters for the PayPal SDK script.

+
braintree.client.create({
+  authorization: 'authorization'
+}).then(function (clientInstance) {
+  return braintree.paypalCheckout.create({
+    client: clientInstance
+  });
+}).then(function (paypalCheckoutInstance) {
+  return paypal.Buttons({
+    createBillingAgreement: function () {
+      return paypalCheckoutInstance.createPayment({
+        flow: 'vault'
+        // your other createPayment options here
+      });
+    },
+
+    onApprove: function (data, actions) {
+      // some logic here before tokenization happens below
+      return paypalCheckoutInstance.tokenizePayment(data).then(function (payload) {
+        // Submit payload.nonce to your server
+      });
+    },
+
+    onCancel: function () {
+      // handle case where user cancels
+    },
+
+    onError: function (err) {
+      // handle case where error occurs
+    }
+  }).render('#paypal-button');
+}).catch(function (err) {
+ console.error('Error!', err);
+});
+
+

Integrate with Checkout.js (deprecated PayPal SDK)

+

If you are creating a new PayPal integration, please follow the previous integration guide to use the current version of the PayPal SDK. Use this integration guide only as a reference if you are already integrated with Checkout.js.

+

You must have PayPal's Checkout.js script loaded on your page.

+
<script src="https://www.paypalobjects.com/api/checkout.js" data-version-4 log-level="warn"></script>
+
+
braintree.client.create({
+  authorization: 'authorization'
+}).then(function (clientInstance) {
+  return braintree.paypalCheckout.create({
+    client: clientInstance
+  });
+}).then(function (paypalCheckoutInstance) {
+  return paypal.Button.render({
+    env: 'production', // or 'sandbox'
+
+    payment: function () {
+      return paypalCheckoutInstance.createPayment({
+        // your createPayment options here
+      });
+    },
+
+    onAuthorize: function (data, actions) {
+      // some logic here before tokenization happens below
+      return paypalCheckoutInstance.tokenizePayment(data).then(function (payload) {
+        // Submit payload.nonce to your server
+      });
+    }
+  }, '#paypal-button');
+}).catch(function (err) {
+ console.error('Error!', err);
+});
+
+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

see paypal-checkout.create

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ createPayment(options, callbackopt) → {promise|void} +

+
+ + + + + +
+

Creates a PayPal payment ID or billing token using the given options. This is meant to be passed to the PayPal JS SDK. +When a callback is defined, the function returns undefined and invokes the callback with the id to be used with the PayPal JS SDK. Otherwise, it returns a Promise that resolves with the id.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

All options for the PayPalCheckout component.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
flow + + + + string + + + + + + + + + + + + + + + +

Set to 'checkout' for one-time payment flow, or 'vault' for Vault flow. If 'vault' is used with a client token generated with a customer ID, the PayPal account will be added to that customer as a saved payment method.

+ +
intent + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + authorize + + +
    +
  • authorize - Submits the transaction for authorization but not settlement.
  • +
  • order - Validates the transaction without an authorization (i.e. without holding funds). Useful for authorizing and capturing funds up to 90 days after the order has been placed. Only available for Checkout flow.
  • +
  • capture - Payment will be immediately submitted for settlement upon creating a transaction. sale can be used as an alias for this value.
  • +
+ +
offerCredit + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + false + + +

Offers PayPal Credit as the default funding instrument for the transaction. If the customer isn't pre-approved for PayPal Credit, they will be prompted to apply for it.

+ +
amount + + + + string + + + | + + + number + + + + + + + + + <optional>
+ + + + + +
+ + +

The amount of the transaction. Required when using the Checkout flow. Should not include shipping cost.

+
    +
  • Supports up to 2 digits after the decimal point
  • +
+ +
currency + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

The currency code of the amount, such as 'USD'. Required when using the Checkout flow.

+ +
displayName + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

The merchant name displayed inside of the PayPal lightbox; defaults to the company name on your Braintree account

+ +
requestBillingAgreement + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + +

If true and flow = checkout, the customer will be prompted to consent to a billing agreement during the checkout flow. This value is ignored when flow = vault.

+ +
billingAgreementDetails + + + + object + + + + + + + + + <optional>
+ + + + + +
+ + +

When requestBillingAgreement = true, allows for details to be set for the billing agreement portion of the flow.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
description + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Description of the billing agreement to display to the customer.

+ +
+ + +
vaultInitiatedCheckoutPaymentMethodToken + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

Use the payment method nonce representing a PayPal account with a Billing Agreement ID to create the payment and redirect the customer to select a new financial instrument. This option is only applicable to the checkout flow.

+ +
shippingOptions + + + + Array.<shippingOption> + + + + + + + + + <optional>
+ + + + + +
+ + +

List of shipping options offered by the payee or merchant to the payer to ship or pick up their items.

+ +
enableShippingAddress + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + false + + +

Returns a shipping address object in PayPal#tokenize.

+ +
shippingAddressOverride + + + + object + + + + + + + + + <optional>
+ + + + + +
+ + +

Allows you to pass a shipping address you have already collected into the PayPal payment flow.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
line1 + + + + string + + + + + + + + + + + + + +

Street address.

+ +
line2 + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Street address (extended).

+ +
city + + + + string + + + + + + + + + + + + + +

City.

+ +
state + + + + string + + + + + + + + + + + + + +

State.

+ +
postalCode + + + + string + + + + + + + + + + + + + +

Postal code.

+ +
countryCode + + + + string + + + + + + + + + + + + + +

Country.

+ +
phone + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Phone number.

+ +
recipientName + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Recipient's name.

+ +
+ + +
shippingAddressEditable + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + true + + +

Set to false to disable user editing of the shipping address.

+ +
billingAgreementDescription + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

Use this option to set the description of the preapproved payment agreement visible to customers in their PayPal profile during Vault flows. Max 255 characters.

+ +
landingPageType + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

Use this option to specify the PayPal page to display when a user lands on the PayPal site to complete the payment.

+
    +
  • login - A PayPal account login page is used.
  • +
  • billing - A non-PayPal account landing page is used.
  • +
+ +
lineItems + + + + Array.<lineItem> + + + + + + + + + <optional>
+ + + + + +
+ + +

The line items for this transaction. It can include up to 249 line items.

+ +
planType + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

Determines the charge pattern for the Recurring Billing Agreement. Can be 'RECURRING', 'SUBSCRIPTION', 'UNSCHEDULED', or 'INSTALLMENTS'.

+ +
planMetadata + + + + planMetadata + + + + + + + + + <optional>
+ + + + + +
+ + +

When plan type is defined, allows for plan metadata to be set for the Billing Agreement.

+ +
userAuthenticationEmail + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

Optional merchant-provided buyer email, used to streamline the sign-in process for both one-time checkout and vault flows.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument is a PayPal paymentId or billingToken string, depending on whether options.flow is checkout or vault. This is also what is resolved by the promise if no callback is provided.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
// this paypal object is created by the PayPal JS SDK
+// see https://github.com/paypal/paypal-checkout-components
+paypal.Buttons({
+  createOrder: function () {
+    // when createPayment resolves, it is automatically passed to the PayPal JS SDK
+    return paypalCheckoutInstance.createPayment({
+      flow: 'checkout',
+      amount: '10.00',
+      currency: 'USD',
+      intent: 'capture' // this value must either be `capture` or match the intent passed into the PayPal SDK intent query parameter
+    });
+  },
+  // Add other options, e.g. onApproved, onCancel, onError
+}).render('#paypal-button');
+ + +
// shippingOptions are passed to createPayment. You can review the result from onAuthorize to determine which shipping option id was selected.
+```javascript
+braintree.client.create({
+  authorization: 'authorization'
+}).then(function (clientInstance) {
+  return braintree.paypalCheckout.create({
+    client: clientInstance
+  });
+}).then(function (paypalCheckoutInstance) {
+  return paypal.Button.render({
+    env: 'production'
+
+    payment: function () {
+      return paypalCheckoutInstance.createPayment({
+        flow: 'checkout',
+        amount: '10.00',
+        currency: 'USD',
+        shippingOptions: [
+          {
+            id: 'UUID-9',
+            type: 'PICKUP',
+            label: 'Store Location Five',
+            selected: true,
+            amount: {
+              value: '1.00',
+              currency: 'USD'
+            }
+          },
+          {
+            id: 'shipping-speed-fast',
+            type: 'SHIPPING',
+            label: 'Fast Shipping',
+            selected: false,
+            amount: {
+              value: '1.00',
+              currency: 'USD'
+            }
+          },
+          {
+            id: 'shipping-speed-slow',
+            type: 'SHIPPING',
+            label: 'Slow Shipping',
+            selected: false,
+            amount: {
+              value: '1.00',
+              currency: 'USD'
+            }
+          }
+        ]
+      });
+    },
+
+    onAuthorize: function (data, actions) {
+      return paypalCheckoutInstance.tokenizePayment(data).then(function (payload) {
+        // Submit payload.nonce to your server
+      });
+    }
+  }, '#paypal-button');
+}).catch(function (err) {
+ console.error('Error!', err);
+});
+
+```
+ +

+ use the new plan features +

+ + +
// Plan and plan metadata are passed to createPayment
+```javascript
+braintree.client.create({
+  authorization: 'authorization'
+}).then(function (clientInstance) {
+  return braintree.paypalCheckout.create({
+    client: clientInstance
+  });
+}).then(function (paypalCheckoutInstance) {
+  return paypal.Button.render({
+    env: 'production'
+
+    payment: function () {
+      return paypalCheckoutInstance.createPayment({
+        flow: 'vault',
+        planType: 'RECURRING',
+        planMetadata: {
+          billingCycles: [
+            {
+               billingFrequency: "1",
+               billingFrequencyUnit: "MONTH",
+               numberOfExecutions: "1",
+               sequence: "1",
+               startDate: "2024-04-06T00:00:00Z",
+               trial: true,
+               pricingScheme: {
+                 pricingModel: "FIXED",
+             },
+           },
+           ],
+          currencyIsoCode: "USD",
+          name: "Netflix with Ads",
+          productDescription: "iPhone 13",
+          productQuantity: "1.0",
+          oneTimeFeeAmount: "10",
+          shippingAmount: "3.0",
+          productPrice: "200",
+          taxAmount: "20",
+       };
+      });
+    },
+
+    onAuthorize: function (data, actions) {
+      return paypalCheckoutInstance.tokenizePayment(data).then(function (payload) {
+        // Submit payload.nonce to your server
+      });
+    }
+  }, '#paypal-button');
+}).catch(function (err) {
+ console.error('Error!', err);
+});
+
+```
+ + +
+ + + + + + + + + + + + + + +

+ getClientId(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Resolves with the PayPal client id to be used when loading the PayPal SDK.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, id, is a the PayPal client id. If no callback is provided, the promise resolves with the PayPal client id.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
paypalCheckoutInstance.getClientId().then(function (id) {
+ var script = document.createElement('script');
+
+ script.src = 'https://www.paypal.com/sdk/js?client-id=' + id;
+ script.onload = function () {
+   // setup the PayPal SDK
+ };
+
+ document.body.appendChild(script);
+});
+ + +
+ + + + + + + + + + + + + + +

+ loadPayPalSDK(optionsopt, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Resolves when the PayPal SDK has been successfully loaded onto the page.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + <optional>
+ + + + + +
+

A configuration object to modify the query params and data-attributes on the PayPal SDK. A subset of the parameters are listed below. For a full list of query params, see the PayPal docs.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
client-id + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

By default, this will be the client id associated with the authorization used to create the Braintree component. When used in conjunction with passing authorization when creating the PayPal Checkout component, you can speed up the loading of the PayPal SDK.

+ +
intent + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + "authorize" + + +

By default, the PayPal SDK defaults to an intent of capture. Since the default intent when calling createPayment is authorize, the PayPal SDK will be loaded with intent=authorize. If you wish to use a different intent when calling createPayment, make sure it matches here. If sale is used, it will be converted to capture for the PayPal SDK. If the vault: true param is used, tokenize will be passed as the default intent.

+ +
locale + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + en_US + + +

Use this option to change the language, links, and terminology used in the PayPal flow. This locale will be used unless the buyer has set a preferred locale for their account. If an unsupported locale is supplied, a fallback locale (determined by buyer preference or browser data) will be used and no error will be thrown.

+

Supported locales are: +da_DK, +de_DE, +en_AU, +en_GB, +en_US, +es_ES, +fr_CA, +fr_FR, +id_ID, +it_IT, +ja_JP, +ko_KR, +nl_NL, +no_NO, +pl_PL, +pt_BR, +pt_PT, +ru_RU, +sv_SE, +th_TH, +zh_CN, +zh_HK, +and zh_TW.

+ +
currency + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + "USD" + + +

If a currency is passed in createPayment, it must match the currency passed here.

+ +
vault + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + +

Must be true when using flow: vault in createPayment.

+ +
components + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + buttons + + +

By default, the Braintree SDK will only load the PayPal smart buttons component. If you would like to load just the messages component, pass messages. If you would like to load both, pass buttons,messages

+ +
dataAttributes + + + + object + + + + + + + + + <optional>
+ + + + + +
+ + +

The data attributes to apply to the script. Any data attribute can be passed. A subset of the parameters are listed below. For a full list of data attributes, see the PayPal docs.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
client-token + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The client token to use in the script. (usually not needed)

+ +
csp-nonce + + + + string + + + + + + + + + <optional>
+ + + + + +
+

See the PayPal docs about content security nonces.

+ +
+ + +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called when the PayPal SDK has been loaded onto the page. The second argument is the PayPal Checkout instance. If no callback is provided, the promise resolves with the PayPal Checkout instance when the PayPal SDK has been loaded onto the page.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ +

+ Without options +

+ + +
paypalCheckoutInstance.loadPayPalSDK().then(function () {
+  // window.paypal.Buttons is now available to use
+});
+ +

+ With options +

+ + +
paypalCheckoutInstance.loadPayPalSDK({
+  'client-id': 'PayPal Client Id', // Can speed up rendering time to hardcode this value
+
+  intent: 'capture', // Make sure this value matches the value in createPayment
+  currency: 'USD', // Make sure this value matches the value in createPayment
+}).then(function () {
+  // window.paypal.Buttons is now available to use
+});
+ +

+ With Vaulting +

+ + +
paypalCheckoutInstance.loadPayPalSDK({
+  vault: true
+}).then(function () {
+  // window.paypal.Buttons is now available to use
+});
+ + +
+ + + + + + + + + + + + + + +

+ teardown(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Cleanly tear down anything set up by create.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called once teardown is complete. No data is returned if teardown completes successfully.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
paypalCheckoutInstance.teardown();
+ +

+ With callback +

+ + +
paypalCheckoutInstance.teardown(function () {
+  // teardown is complete
+});
+ + +
+ + + + + + + + + + + + + + +

+ tokenizePayment(tokenizeOptions, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Tokenizes the authorize data from the PayPal JS SDK when completing a buyer approval flow. +When a callback is defined, invokes the callback with tokenizePayload and returns undefined. Otherwise, returns a Promise that resolves with a tokenizePayload.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
tokenizeOptions + + + + object + + + + + + + + + + + + + +

Tokens and IDs required to tokenize the payment.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
payerId + + + + string + + + + + + + + + + + + + + + +

Payer ID returned by PayPal onApproved callback.

+ +
paymentId + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

Payment ID returned by PayPal onApproved callback.

+ +
billingToken + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

Billing Token returned by PayPal onApproved callback.

+ +
vault + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + true + + +

Whether or not to vault the resulting PayPal account (if using a client token generated with a customer id and the vault flow).

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, payload, is a tokenizePayload. If no callback is provided, the promise resolves with a tokenizePayload.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Opt out of auto-vaulting behavior +

+ + +
// create the paypalCheckoutInstance with a client token generated with a customer id
+paypal.Buttons({
+  createBillingAgreement: function () {
+    return paypalCheckoutInstance.createPayment({
+      flow: 'vault'
+      // your other createPayment options here
+    });
+  },
+  onApproved: function (data) {
+    data.vault = false;
+
+    return paypalCheckoutInstance.tokenizePayment(data);
+  },
+  // Add other options, e.g. onCancel, onError
+}).render('#paypal-button');
+ + +
+ + + + + + + + + + + + + + +

+ updatePayment(options, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Use this function to update line items and/or shipping options associated with a PayPalCheckout flow (paymentId). +When a callback is defined, this function returns undefined and invokes the callback. The second callback argument, data, is the returned server data. If no callback is provided, updatePayment returns a promise that resolves with the server data.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

All options for the PayPalCheckout component.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
paymentId + + + + string + + + + + + + + + + + + + +

This should be PayPal paymentId.

+ +
amount + + + + string + + + | + + + number + + + + + + + + + + + + + +

The amount of the transaction, including the amount of the selected shipping option, and all line_items.

+
    +
  • Supports up to 2 decimal digits.
  • +
+ +
currency + + + + string + + + + + + + + + + + + + +

The currency code of the amount, such as 'USD'. Required when using the Checkout flow.

+ +
shippingOptions + + + + Array.<shippingOption> + + + + + + + + + <optional>
+ + + + + +
+

List of shipping options offered by the payee or merchant to the payer to ship or pick up their items.

+ +
lineItems + + + + Array.<lineItem> + + + + + + + + + <optional>
+ + + + + +
+

The line items for this transaction. It can include up to 249 line items.

+ +
amountBreakdown + + + + object + + + + + + + + + <optional>
+ + + + + +
+

Optional collection of amounts that break down the total into individual pieces.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
itemTotal + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Optional, item amount

+ +
shipping + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Optional, shipping amount

+ +
handling + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Optional, handling amount

+ +
taxTotal + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Optional, tax amount

+ +
insurance + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Optional, insurance amount

+ +
shippingDiscount + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Optional, shipping discount amount

+ +
discount + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Optional, discount amount

+ +
+ + +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument is a PayPal paymentId or billingToken string, depending on whether options.flow is checkout or vault. This is also what is resolved by the promise if no callback is provided.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
// this paypal object is created by the PayPal JS SDK
+// see https://github.com/paypal/paypal-checkout-components
+paypal.Buttons({
+  createOrder: function () {
+    // when createPayment resolves, it is automatically passed to the PayPal JS SDK
+    return paypalCheckoutInstance.createPayment({
+      //
+    });
+  },
+  onShippingChange: function (data) {
+    // Examine data and determine if the payment needs to be updated.
+    // when updatePayment resolves, it is automatically passed to the PayPal JS SDK
+    return paypalCheckoutInstance.updatePayment({
+        paymentId: data.paymentId,
+        amount: '15.00',
+        currency: 'USD',
+        shippingOptions: [
+          {
+            id: 'shipping-speed-fast',
+            type: 'SHIPPING',
+            label: 'Fast Shipping',
+            selected: true,
+            amount: {
+              value: '5.00',
+              currency: 'USD'
+            }
+          },
+          {
+            id: 'shipping-speed-slow',
+            type: 'SHIPPING',
+            label: 'Slow Shipping',
+            selected: false,
+            amount: {
+              value: '1.00',
+              currency: 'USD'
+            }
+          }
+        ]
+    });
+  }
+  // Add other options, e.g. onApproved, onCancel, onError
+}).render('#paypal-button');
+
+```
+ + +
+ + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ billingCycles :Object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
billingFrequency + + + + string + + + | + + + number + + + + + + + +

The frequency of billing.

+
billingFrequencyUnit + + + + string + + + + + + + +

The unit of billing frequency. Options are DAY, WEEK, MONTH, or YEAR.

+
numberOfExecutions + + + + string + + + | + + + number + + + + + + + +

The number of executions for the billing cycle.

+
sequence + + + + string + + + | + + + number + + + + + + + +

The order in the upcoming billing cycles.

+
startDate + + + + string + + + + + + + +

The start date in ISO 8601 format (2024-04-06T00:00:00Z). If populated and the intent is to charge the buyer for the billing cycle at the checkout, it should be populated as current time in ISO 8601 format.

+
trial + + + + boolean + + + + + + + +

Indicates if the billing cycle is a trial.

+
pricingScheme + + + + pricingScheme + + + + + + + +

The pricing scheme object for this billing cycle.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ lineItem :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
quantity + + + + string + + + + + + + + + + + +

Number of units of the item purchased. This value must be a whole number and can't be negative or zero.

+
unitAmount + + + + string + + + + + + + + + + + +

Per-unit price of the item. Can include up to 2 decimal places. This value can't be negative or zero.

+
name + + + + string + + + + + + + + + + + +

Item name. Maximum 127 characters.

+
kind + + + + string + + + + + + + + + + + +

Indicates whether the line item is a debit (sale) or credit (refund) to the customer. Accepted values: debit and credit.

+
unitTaxAmount + + + + string + + + + + + + + + + + <nullable>
+ +
+

Per-unit tax price of the item. Can include up to 2 decimal places. This value can't be negative or zero.

+
description + + + + string + + + + + + + + + + + <nullable>
+ +
+

Item description. Maximum 127 characters.

+
productCode + + + + string + + + + + + + + + + + <nullable>
+ +
+

Product or UPC code for the item. Maximum 127 characters.

+
url + + + + string + + + + + + + + + + + <nullable>
+ +
+

The URL to product information.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ planMetadata :Object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
billingCycles + + + + Array.<billingCycles> + + + + + + + + + <optional>
+ + + +
+

An array of billing cyles for this plan.

+
currencyIsoCode + + + + string + + + + + + + + + + + +

The ISO code for the currency, for example USD.

+
name + + + + string + + + + + + + + + + + +

The name of the plan.

+
productDescription + + + + string + + + + + + + + + + + +

A description of the product. (Accepts only one element)

+
productQuantity + + + + string + + + | + + + number + + + + + + + + + + + +

The quantity of the product. (Accepts only one element)

+
oneTimeFeeAmount + + + + string + + + | + + + number + + + + + + + + + + + +

The one-time fee amount.

+
shippingAmount + + + + string + + + | + + + number + + + + + + + + + + + +

The amount for shipping.

+
productPrice + + + + string + + + | + + + number + + + + + + + + + + + +

The price of the product.

+
taxAmount + + + + string + + + | + + + number + + + + + + + + + + + +

The amount of tax.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ pricingScheme :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
pricingModel + + + + string + + + + + + + +

The pricing model. Options are FIXED, VARIABLE, or AUTO_RELOAD.

+
price + + + + string + + + + + + + +

The price for the billing cycle.

+
reloadThresholdAmount + + + + string + + + + + + + +

The amount at which to reload on auto_reload plans.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ shippingOption :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + + + + string + + + + + + + +

A unique ID that identifies a payer-selected shipping option.

+
label + + + + string + + + + + + + +

A description that the payer sees, which helps them choose an appropriate shipping option. For example, Free Shipping, USPS Priority Shipping, Expédition prioritaire USPS, or USPS yōuxiān fā huò. Localize this description to the payer's locale.

+
selected + + + + boolean + + + + + + + +

If selected = true is specified as part of the API request it represents the shipping option that the payee/merchant expects to be pre-selected for the payer when they first view the shipping options within the PayPal checkout experience. As part of the response if a shipping option has selected = true it represents the shipping option that the payer selected during the course of checkout with PayPal. Only 1 shippingOption can be set to selected = true.

+
type + + + + string + + + + + + + +

The method by which the payer wants to get their items. The possible values are:

+
    +
  • SHIPPING - The payer intends to receive the items at a specified address.
  • +
  • PICKUP - The payer intends to pick up the items at a specified address. For example, a store address.
  • +
+
amount + + + + object + + + + + + + +

The shipping cost for the selected option.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
currency + + + + string + + + + + + + +

The three-character ISO-4217 currency code. PayPal does not support all currencies.

+
value + + + + string + + + + + + + +

The amount the shipping option will cost. Includes the specified number of digits after decimal separator for the ISO-4217 currency code.

+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ tokenizePayload :object +

+
+ + + + + +
+

PayPal Checkout tokenized payload. Returned in PayPalCheckout#tokenizePayment's callback as the second argument, data.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
nonce + + + + string + + + + + + + + + + + +

The payment method nonce.

+
type + + + + string + + + + + + + + + + + +

The payment method type, always PayPalAccount.

+
details + + + + object + + + + + + + + + + + +

Additional PayPal account details.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
email + + + + string + + + + + + + + + + + +

User's email address.

+
payerId + + + + string + + + + + + + + + + + +

User's payer ID, the unique identifier for each PayPal account.

+
firstName + + + + string + + + + + + + + + + + +

User's given name.

+
lastName + + + + string + + + + + + + + + + + +

User's surname.

+
countryCode + + + + string + + + + + + + + + + + <nullable>
+ +
+

User's 2 character country code.

+
phone + + + + string + + + + + + + + + + + <nullable>
+ +
+

User's phone number (e.g. 555-867-5309).

+
shippingAddress + + + + object + + + + + + + + + + + <nullable>
+ +
+

User's shipping address details, only available if shipping address is enabled.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
recipientName + + + + string + + + + + + + +

Recipient of postage.

+
line1 + + + + string + + + + + + + +

Street number and name.

+
line2 + + + + string + + + + + + + +

Extended address.

+
city + + + + string + + + + + + + +

City or locality.

+
state + + + + string + + + + + + + +

State or region.

+
postalCode + + + + string + + + + + + + +

Postal code.

+
countryCode + + + + string + + + + + + + +

2 character country code (e.g. US).

+
+ +
billingAddress + + + + object + + + + + + + + + + + <nullable>
+ +
+

User's billing address details. +Not available to all merchants; contact support for details on eligibility and enabling this feature. +Alternatively, see shippingAddress above as an available client option.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
line1 + + + + string + + + + + + + +

Street number and name.

+
line2 + + + + string + + + + + + + +

Extended address.

+
city + + + + string + + + + + + + +

City or locality.

+
state + + + + string + + + + + + + +

State or region.

+
postalCode + + + + string + + + + + + + +

Postal code.

+
countryCode + + + + string + + + + + + + +

2 character country code (e.g. US).

+
+ +
+ +
creditFinancingOffered + + + + object + + + + + + + + + + + <nullable>
+ +
+

This property will only be present when the customer pays with PayPal Credit.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
totalCost + + + + object + + + + + + + +

This is the estimated total payment amount including interest and fees the user will pay during the lifetime of the loan.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + + + string + + + + + + + +

An amount defined by ISO 4217 for the given currency.

+
currency + + + + string + + + + + + + +

3 letter currency code as defined by ISO 4217.

+
+ +
term + + + + number + + + + + + + +

Length of financing terms in months.

+
monthlyPayment + + + + object + + + + + + + +

This is the estimated amount per month that the customer will need to pay including fees and interest.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + + + string + + + + + + + +

An amount defined by ISO 4217 for the given currency.

+
currency + + + + string + + + + + + + +

3 letter currency code as defined by ISO 4217.

+
+ +
totalInterest + + + + object + + + + + + + +

Estimated interest or fees amount the payer will have to pay during the lifetime of the loan.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + + + + string + + + + + + + +

An amount defined by ISO 4217 for the given currency.

+
currency + + + + string + + + + + + + +

3 letter currency code as defined by ISO 4217.

+
+ +
payerAcceptance + + + + boolean + + + + + + + +

Status of whether the customer ultimately was approved for and chose to make the payment using the approved installment credit.

+
cartAmountImmutable + + + + boolean + + + + + + + +

Indicates whether the cart amount is editable after payer's acceptance on PayPal side.

+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/PaymentRequestComponent.html b/3.111.1/PaymentRequestComponent.html new file mode 100644 index 00000000..1203eb75 --- /dev/null +++ b/3.111.1/PaymentRequestComponent.html @@ -0,0 +1,3071 @@ + + + + + + + + + PaymentRequestComponent - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ PaymentRequestComponent +

+ + + + +
+
+ +

+ + PaymentRequestComponent + +

+ + +
+

This class represents a Payment Request component produced by braintree-web/payment-request.create. Instances of this class have methods for initializing a Payment Request.

+

Note: This component is currently in beta and the API may include breaking changes when upgrading. Please review the Changelog for upgrade steps whenever you upgrade the version of braintree-web.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new PaymentRequestComponent(options) +

+
+ + + + + +
+

Do not use this constructor directly. Use braintree-web.payment-request.create instead.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

The Payment Request Component create options.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ canMakePayment(configuration, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Check if the customer can make payments.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
configuration + + + + object + + + + + + + + + + + + + +

A paymentRequestConfiguration.

+ +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called on completion.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
var paymentDetails = {
+	 total: {
+    label: 'Total',
+    amount: {
+      currency: 'USD',
+      value: '10.00',
+    }
+  }
+};
+
+paymentRequestInstance.canMakePayment({
+  details: paymentDetails
+}).then(function (result) {
+  if (result) {
+    // set up payment request button
+  }
+});
+ + +
+ + + + + + + + + + + + + + +

+ createSupportedPaymentMethodsConfiguration(type, overridesopt) → {object} +

+
+ + + + + +
+

Create an object to pass into tokenize to specify a custom configuration. If no overrides are provided, the default configuration will be provided.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
type + + + + string + + + + + + + + + + + + + +

The supported payment method type. Possible values are basicCard and googlePay. +If no type is provided, the function will throw an error. If the type provided is not an enabled payment method for the merchant account , the function will throw an error.

+ +
overrides + + + + object + + + + + + + + + <optional>
+ + + + + +
+

The configuration overrides for the data property on the supported payment methods objects. If not passed in, the default configuration for the specified type will be provided. If a property is not provided, the value from the default configuration will be used.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ +

+ Getting the default configuration for a specified type +

+ + +
var configuration = paymentRequestInstance.createSupportedPaymentMethodsConfiguration('basicCard');
+
+configuration.supportedMethods; // 'basic-card'
+configuration.data.supportedNetworks; // ['visa', 'mastercard', 'amex'] <- whatever the supported card networks for the merchant account are
+ +

+ Specifying overrides +

+ + +
var configuration = paymentRequestInstance.createSupportedPaymentMethodsConfiguration('basicCard', {
+  supportedNetworks: ['visa'],
+  supportedTypes: ['credit', 'debit']
+});
+
+configuration.supportedMethods; // 'basic-card'
+configuration.data.supportedNetworks; // ['visa']
+configuration.data.supportedTypes; // ['credit', 'debit']
+ + +
+ + + + + + + + + + + + + + +

+ off(event, handler) → {void} +

+
+ + + + + +
+

Unsubscribes the handler function to a named event.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + + + + string + + + + + + + +

The name of the event to which you are unsubscribing.

+ +
handler + + + + function + + + + + + + +

The callback for the event you are unsubscribing from.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Subscribing and then unsubscribing from a Payment Request event, in this case 'shippingAddressChange' +

+ + +
braintree.paymentRequest.create({ ... }, function (createErr, paymentRequestInstance) {
+  var callback = function (event) {
+    console.log(event.target.shippingAddress);
+  };
+  paymentRequestInstance.on('shippingAddressChange', callback);
+
+  // later on
+  paymentRequestInstance.off('shippingAddressChange', callback);
+});
+ + +
+ + + + + + + + + + + + + + +

+ on(event, handler) → {void} +

+
+ + + + + +
+

Subscribes a handler function to a named event. event should be shippingAddressChange or shippingOptionChange. For convenience, you can also listen on shippingaddresschange or shippingoptionchange to match the event listeners in the Payment Request API documentation. Events will emit a shippingEventObject.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + + + + string + + + + + + + +

The name of the event to which you are subscribing.

+ +
handler + + + + function + + + + + + + +

A callback to handle the event.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Listening to a Payment Request event, in this case 'shippingAddressChange' +

+ + +
braintree.paymentRequest.create({ ... }, function (createErr, paymentRequestInstance) {
+  paymentRequestInstance.on('shippingAddressChange', function (event) {
+    console.log(event.target.shippingAddress);
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ teardown(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Cleanly remove anything set up by create.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called on completion.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
paymentRequestInstance.teardown();
+ +

+ With callback +

+ + +
paymentRequestInstance.teardown(function () {
+  // teardown is complete
+});
+ + +
+ + + + + + + + + + + + + + +

+ tokenize(configuration, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Tokenizes a Payment Request

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
configuration + + + + object + + + + + + + + + + + + + +

A paymentRequestConfiguration.

+ +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is a paymentPayload. If no callback is provided, tokenize returns a function that resolves with a tokenizePayload.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
paymentRequestInstance.tokenize({
+  details: {
+    total: {
+      label: 'Price',
+      amount: {
+        currency: 'USD',
+        value: '100.00'
+      }
+    }
+  }
+}).then(function (payload) {
+  // send payload.nonce to server
+
+  // examine the raw response (with card details removed for security) from the payment request
+  console.log(payload.details.rawPaymentResponse);
+}).catch(function (err) {
+  if (err.code === 'PAYMENT_REQUEST_CANCELED') {
+    // payment request was canceled by user
+  } else {
+    // an error occurred while processing
+  }
+});
+ +

+ Tokenize only Visa cards +

+ + +
var basicCardConfiguration = paymentRequestInstance.createSupportedPaymentMethodsConfiguration('basicCard', {
+  supportedNetworks: ['visa']
+};
+
+paymentRequestInstance.tokenize({
+  supportedPaymentMethods: [basicCardConfiguration],
+  details: {
+    total: {
+      label: 'Price',
+      amount: {
+        currency: 'USD',
+        value: '100.00'
+      }
+    }
+  }
+}).then(function (payload) {
+  // send payload.nonce to your server
+});
+ +

+ Include payment request options +

+ + +
paymentRequestInstance.tokenize({
+  details: {
+    total: {
+      label: 'Price',
+      amount: {
+        currency: 'USD',
+        value: '100.00'
+      }
+    }
+  },
+  options: {
+    requestPayerName: true,
+    requestPayerPhone: true,
+    requestPayerEmail: true
+  }
+}).then(function (payload) {
+  // send payload.nonce to your server
+  // collect additional info from the raw response
+  console.log(payload.details.rawPaymentResponse);
+});
+ +

+ Request Shipping Information +

+ + +
var shippingOptions = [
+  {
+    id: 'economy',
+    label: 'Economy Shipping (5-7 Days)',
+    amount: {
+      currency: 'USD',
+      value: '0',
+    },
+  }, {
+    id: 'express',
+    label: 'Express Shipping (2-3 Days)',
+    amount: {
+      currency: 'USD',
+      value: '5',
+    },
+  }, {
+    id: 'next-day',
+    label: 'Next Day Delivery',
+    amount: {
+      currency: 'USD',
+      value: '12',
+    },
+  },
+];
+var paymentDetails = {
+	 total: {
+    label: 'Total',
+    amount: {
+      currency: 'USD',
+      value: '10.00',
+    }
+  },
+  shippingOptions: shippingOptions
+};
+
+paymentRequestInstance.on('shippingAddressChange', function (event) {
+  // validate shipping address on event.target.shippingAddress
+  // make changes to the paymentDetails or shippingOptions if necessary
+
+  event.updateWith(paymentDetails)
+});
+
+paymentRequestInstance.on('shippingOptionChange', function (event) {
+  shippingOptions.forEach(function (option) {
+    option.selected = option.id === event.target.shippingOption;
+  });
+
+  event.updateWith(paymentDetails)
+});
+
+paymentRequestInstance.tokenize({
+  details: paymentDetails,
+  options: {
+    requestShipping: true
+  }
+}).then(function (payload) {
+  // send payload.nonce to your server
+  // collect shipping information from payload
+  console.log(payload.details.rawPaymentResponse.shippingAddress);
+});
+ + +
+ + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ paymentRequestConfiguration :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
configuration.details + + + + object + + + + + + + + + + + +

The payment details. For details on this object, see Google's PaymentRequest API documentation.

+
configuration.supportedPaymentMethods + + + + array + + + + + + + + + <optional>
+ + + +
+

The supported payment methods. If not passed in, the supported payment methods from the merchant account that generated the authorization for the client will be used. For details on this array, see Google's PaymentRequest API documentation.

+
configuration.options + + + + object + + + + + + + + + <optional>
+ + + +
+

Additional payment request options. For details on this object, see Google's PaymentRequest API documentation.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ shippingEventObject :object +

+
+ + + + + +
+

The event payload sent from on.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
target + + + + object + + + + + + + +

An object which contains data about the event.

+
updateWith + + + + function + + + + + + + +

A method to call with the updated Payment Request details.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ tokenizePayload :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nonce + + + + string + + + + + + + +

The payment method nonce.

+
details + + + + object + + + + + + + +

Additional account details.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
bin + + + + string + + + + + + + +

The BIN number of the card..

+
cardType + + + + string + + + + + + + +

Type of card, ex: Visa, MasterCard.

+
lastFour + + + + string + + + + + + + +

Last four digits of card number.

+
lastTwo + + + + string + + + + + + + +

Last two digits of card number.

+
rawPaymentResponse + + + + object + + + + + + + +

The raw payment response from the payment request, with sensitive card details removed.

+
+ +
description + + + + string + + + + + + + +

A human-readable description.

+
type + + + + string + + + + + + + +

The payment method type, CreditCard or AndroidPayCard.

+
binData + + + + object + + + + + + + +

Information about the card based on the bin.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
commercial + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
countryOfIssuance + + + + string + + + + + + + +

The country of issuance.

+
debit + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
durbinRegulated + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
healthcare + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
issuingBank + + + + string + + + + + + + +

The issuing bank.

+
payroll + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
prepaid + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
productId + + + + string + + + + + + + +

The product id.

+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +

Events

+ + + + + + + + + + + + + +

+ shippingAddressChange :PaymentRequestComponent~shippingEventObject +

+
+ + + + + +
+

This event is emitted when the customer selects a shipping address.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Listening to a shipping address change event +

+ + +
braintree.paymentRequest.create({ ... }, function (createErr, paymentRequestInstance) {
+  paymentRequestInstance.on('shippingAddressChange', function (event) {
+    // validate event.target.shippingAddress if needed
+
+    event.updateWith(paymentRequestDetails);
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ shippingOptionChange :PaymentRequestComponent~shippingEventObject +

+
+ + + + + +
+

This event is emitted when the customer selects a shipping option.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Listening to a shipping option change event +

+ + +
braintree.paymentRequest.create({ ... }, function (createErr, paymentRequestInstance) {
+  paymentRequestInstance.on('shippingOptionChange', function (event) {
+    // validate event.target.shippingOption if needed
+
+    paymentRequestDetails.shippingOptions.forEach(function (option) {
+      option.selected = option.id === event.target.shippingOption;
+    });
+
+    event.updateWith(paymentRequestDetails);
+  });
+});
+ + +
+ + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/SEPA.html b/3.111.1/SEPA.html new file mode 100644 index 00000000..82abf941 --- /dev/null +++ b/3.111.1/SEPA.html @@ -0,0 +1,1044 @@ + + + + + + + + + SEPA - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ SEPA +

+ + + + +
+
+ +

+ + SEPA + +

+ + +
+

This class represents a SEPA component produced by braintree-web.sepa.create. Instances provide methods for tokenizing SEPA payments.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new SEPA(options) +

+
+ + + + + +
+

Do not use this constructor directly. Use braintree-web.sepa.create instead.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

see sepa.create

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ tokenize(options, callbackopt) → {Promise.<(tokenizePayload|error)>} +

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

All options for intiating the SEPA payment flow.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
accountHolderName + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The account holder name.

+ +
customerId + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The customer's id.

+ +
iban + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The customer's International Bank Account Number.

+ +
mandateType + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Specify ONE_OFF or RECURRENT payment.

+ +
countryCode + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The customer's country code.

+ +
merchantAccountId + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The merchant's account id.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The first argument is an error object, where the second is a tokenizePayload

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
button.addEventListener('click', function () {
+  var tokenizeInputs = {
+    accountHolderName: "some-accnt-holder-name",
+    customerId: "a-customer-id",
+    iban: "a-full-iban",
+    mandateType: "ONE_OFF",
+    countryCode: "LI",
+    merchantAccountId: "a-merchant-account-id"
+  }
+  sepaInstance.tokenize(tokenizeInputs).then(function (payload) {
+     // Submit payload.nonce to your server
+  }).catch(function(tokenizationErr) {
+    // Handle errors in the flow
+  })
+})
+ + +
+ + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ tokenizePayload +

+
+ + + + + +
+

SEPA tokenize payload.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nonce + + + + string + + + + + + + +

The payment nonce.

+
ibanLastFour + + + + string + + + + + + + +

The last four digits of the customer's IBAN.

+
mandateType + + + + string + + + + + + + +

The specified mandateType used.

+
customerId + + + + string + + + + + + + +

The provided customer id.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/ThreeDSecure.html b/3.111.1/ThreeDSecure.html new file mode 100644 index 00000000..b49bb616 --- /dev/null +++ b/3.111.1/ThreeDSecure.html @@ -0,0 +1,8807 @@ + + + + + + + + + ThreeDSecure - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ThreeDSecure +

+ + + + +
+
+ +

+ + ThreeDSecure + +

+ + +
+

This class represents a ThreeDSecure component produced by braintree.threeDSecure.create. Instances of this class have a method for launching a 3D Secure authentication flow.

+

If you use the Braintree SDK from within an iframe, you must not use the sandbox attribute on your iframe or the 3D Secure modal will not function correctly.

+

Note: 3D Secure 2.0 is documented below and will become the default integration method in a future version of Braintree-web. Until then, version 1.0 will continue to be supported. To view 3D Secure 1.0 documentation, look at Braintree-web documentation from version 3.40.0 and earlier, or upgrade your integration by referring to the 3D Secure 2.0 adoption guide.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new ThreeDSecure(options) +

+
+ + + + + +
+

Do not use this constructor directly. Use braintree.threeDSecure.create instead.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

3D Secure create options

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ cancelVerifyCard(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Cancel the 3DS flow and return the verification payload if available. If using 3D Secure version 2, this will not close the UI of the authentication modal. It is recommended that this method only be used in the lookup-complete event or the onLookupComplete callback.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument is a verifyPayload. If there is no verifyPayload (the initial lookup did not complete), an error will be returned. If no callback is passed, cancelVerifyCard will return a promise.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ +

+ Cancel the verification in `lookup-complete` event +

+ + +
// set up listener after instantiation
+threeDSecure.on('lookup-complete', function (data, next) {
+  // determine if you want to call next to start the challenge,
+  // if not, call cancelVerifyCard
+  threeDSecure.cancelVerifyCard(function (err, verifyPayload) {
+    if (err) {
+      // Handle error
+      console.log(err.message); // No verification payload available
+      return;
+    }
+
+    verifyPayload.nonce; // The nonce returned from the 3ds lookup call
+    verifyPayload.liabilityShifted; // boolean
+    verifyPayload.liabilityShiftPossible; // boolean
+  });
+});
+
+// after tokenizing a credit card
+threeDSecure.verifyCard({
+  amount: '100.00',
+  nonce: nonceFromTokenizationPayload,
+  bin: binFromTokenizationPayload
+  // other fields such as billing address
+}, function (verifyError, payload) {
+  if (verifyError) {
+    if (verifyError.code === 'THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT ') {
+      // flow was canceled by merchant, 3ds info can be found in the payload
+      // for cancelVerifyCard
+    }
+  }
+});
+ +

+ Cancel the verification in onLookupComplete callback +

+ + +
threeDSecure.verifyCard({
+  amount: '100.00',
+  nonce: nonceFromTokenizationPayload,
+  bin: binFromTokenizationPayload,
+  // other fields such as billing address
+  onLookupComplete: function (data, next) {
+    // determine if you want to call next to start the challenge,
+    // if not, call cancelVerifyCard
+    threeDSecure.cancelVerifyCard(function (err, verifyPayload) {
+      if (err) {
+        // Handle error
+        console.log(err.message); // No verification payload available
+        return;
+      }
+
+      verifyPayload.nonce; // The nonce returned from the 3ds lookup call
+      verifyPayload.liabilityShifted; // boolean
+      verifyPayload.liabilityShiftPossible; // boolean
+    });
+  }
+}, function (verifyError, payload) {
+  if (verifyError) {
+    if (verifyError.code === 'THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT ') {
+      // flow was canceled by merchant, 3ds info can be found in the payload
+      // for cancelVerifyCard
+    }
+  }
+});
+ +

+ Cancel the verification in 3D Secure version 1 +

+ + +
// unlike with v2, this will not cause `verifyCard` to error, it will simply
+// never call the callback
+threeDSecure.cancelVerifyCard(function (err, verifyPayload) {
+  if (err) {
+    // Handle error
+    console.log(err.message); // No verification payload available
+    return;
+  }
+
+  verifyPayload.nonce; // The nonce returned from the 3ds lookup call
+  verifyPayload.liabilityShifted; // boolean
+  verifyPayload.liabilityShiftPossible; // boolean
+});
+ + +
+ + + + + + + + + + + + + + +

+ initializeChallengeWithLookupResponse(lookupResponse) → {Promise} +

+
+ + + + + +
+

Launch the iframe challenge using a 3D Secure lookup response from a server side lookup.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
lookupResponse + + + + object + + + | + + + string + + + + + + + +

The lookup response from the server side call to lookup the 3D Secure information. The raw string or a parsed object can be passed.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
var my3DSContainer;
+
+threeDSecure.initializeChallengeWithLookupResponse(lookupResponseFromServer).then(function (payload) {
+  if (payload.liabilityShifted) {
+    // Liability has shifted
+    submitNonceToServer(payload.nonce);
+  } else if (payload.liabilityShiftPossible) {
+    // Liability may still be shifted
+    // Decide if you want to submit the nonce
+  } else {
+    // Liability has not shifted and will not shift
+    // Decide if you want to submit the nonce
+  }
+});
+ + +
+ + + + + + + + + + + + + + +

+ off(event, handler) → {void} +

+
+ + + + + +
+

Unsubscribes the handler function to a named event.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + + + + string + + + + + + + +

The name of the event to which you are unsubscribing.

+ +
handler + + + + function + + + + + + + +

The callback for the event you are unsubscribing from.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Subscribing and then unsubscribing from a 3D Secure eld event +

+ + +
braintree.threeDSecure.create({ ... }, function (createErr, threeDSecureInstance) {
+  var lookupCallback = function (data, next) {
+    console.log(data);
+    next();
+  };
+  var cancelCallback = function () {
+    // log the cancelation
+    // or update UI
+  };
+
+  threeDSecureInstance.on('lookup-complete', lookupCallback);
+  threeDSecureInstance.on('customer-canceled', cancelCallback);
+
+  // later on
+  threeDSecureInstance.off('lookup-complete', lookupCallback);
+  threeDSecureInstance.off('customer-canceled', cancelCallback);
+});
+ + +
+ + + + + + + + + + + + + + +

+ on(event, handler) → {void} +

+
+ + + + + +
+

Subscribes a handler function to a named event. The following events are available:

+ +
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
event + + + + string + + + + + + + +

The name of the event to which you are subscribing.

+ +
handler + + + + function + + + + + + + +

A callback to handle the event.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Listening to a 3D Secure event +

+ + +
braintree.threeDSecure.create({ ... }, function (createErr, threeDSecureInstance) {
+  threeDSecureInstance.on('lookup-complete', function (data, next) {
+    console.log('data from the lookup', data);
+    next();
+  });
+  threeDSecureInstance.on('customer-canceled', function () {
+    console.log('log that the customer canceled');
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ prepareLookup(options, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Gather the data needed for a 3D Secure lookup call.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Options for 3D Secure lookup.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nonce + + + + string + + + + + + + +

The nonce representing the card from a tokenization payload. For example, this can be a tokenizePayload returned by Hosted Fields under payload.nonce.

+ +
bin + + + + string + + + + + + + +

The numeric Bank Identification Number (bin) of the card from a tokenization payload. For example, this can be a tokenizePayload returned by Hosted Fields under payload.details.bin.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is a prepareLookupPayload. If no callback is provided, it will return a promise that resolves prepareLookupPayload.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Preparing data for a 3D Secure lookup +

+ + +
threeDSecure.prepareLookup({
+  nonce: hostedFieldsTokenizationPayload.nonce,
+  bin: hostedFieldsTokenizationPayload.details.bin
+}, function (err, payload) {
+  if (err) {
+    console.error(err);
+    return;
+  }
+
+  // send payload to server to do server side lookup
+});
+ + +
+ + + + + + + + + + + + + + +

+ teardown(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Cleanly remove anything set up by create, with the exception that the Cardinal SDK, on window.Cardinal, will remain.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called on completion. If no callback is passed, teardown will return a promise.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
threeDSecure.teardown();
+ +

+ With callback +

+ + +
threeDSecure.teardown(function () {
+  // teardown is complete
+});
+ + +
+ + + + + + + + + + + + + + +

+ verifyCard(options, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Launch the 3D Secure login flow, returning a nonce payload.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Options for card verification.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
nonce + + + + string + + + + + + + + + + + + + +

The nonce representing the card from a tokenization payload. For example, this can be a tokenizePayload returned by Hosted Fields under payload.nonce.

+ +
bin + + + + string + + + + + + + + + + + + + +

The numeric Bank Identification Number (bin) of the card from a tokenization payload. For example, this can be a tokenizePayload returned by Hosted Fields under payload.details.bin.

+ +
amount + + + + string + + + + + + + + + + + + + +

The amount of the transaction in the current merchant account's currency. This must be expressed in numbers with an optional decimal (using .) and precision up to the hundredths place. For example, if you're processing a transaction for 1.234,56 € then amount should be 1234.56.

+ +
accountType + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The account type for the card (if known). Accepted values: credit or debit.

+ +
cardAddChallengeRequested + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+

If set to true, a card-add challenge will be requested from the issuer. If set to false, a card-add challenge will not be requested. If the param is missing, a card-add challenge will only be requested for $0 amount. An authentication created using this flag should only be used for vaulting operations (creation of customers' credit cards or payment methods) and not for creating transactions.

+ +
cardAdd + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+

Deprecated: Use cardAddChallengeRequested instead.

+ +
challengeRequested + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+

If set to true, an authentication challenge will be forced if possible.

+ +
dataOnlyRequested + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+

Indicates whether to use the data only flow. In this flow, frictionless 3DS is ensured for Mastercard cardholders as the card scheme provides a risk score for the issuer to determine whether to approve. If data only is not supported by the processor, a validation error will be raised. Non-Mastercard cardholders will fallback to a normal 3DS flow.

+ +
exemptionRequested + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+

Deprecated: Use requestedExemptionType instead.

+ +
requestVisaDAF + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+

Request to use VISA Digital Authentication Framework. If set to true, a Visa DAF authenticated payment credential will be created and/or used for authentication if the merchant is eligible.

+ +
merchantName + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Allows to override the merchant name that is shown in the challenge.

+ +
requestedExemptionType + + + + string + + + + + + + + + <optional>
+ + + + + +
+

If an exemption is requested and the exemption's conditions are satisfied, then it will be applied. The following supported exemptions are defined as per PSD2 regulation: low_value, transaction_risk_analysis

+ +
customFields + + + + object + + + + + + + + + <optional>
+ + + + + +
+

Object where each key is the name of a custom field which has been configured in the Control Panel. In the Control Panel you can configure 3D Secure Rules which trigger on certain values.

+ +
onLookupComplete + + + + function + + + + + + + + + <optional>
+ + + + + +
+

Deprecated: Use threeDSecureInstance.on('lookup-complete') instead. Function to execute when lookup completes. The first argument, data, is a verificationData object, and the second argument, next, is a callback. next must be called to continue.

+ +
email + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The email used for verification. (maximum length 255)

+ +
mobilePhoneNumber + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The mobile phone number used for verification. Only numbers; remove dashes, parenthesis and other characters. (maximum length 25)

+ +
billingAddress + + + + object + + + + + + + + + <optional>
+ + + + + +
+

An billingAddress object for verification.

+ +
additionalInformation + + + + object + + + + + + + + + <optional>
+ + + + + +
+

An additionalInformation object for verification.

+ +
collectDeviceData + + + + object + + + + + + + + + <optional>
+ + + + + +
+

If set to true, device data such as browser screen dimensions, language and time zone is submitted with lookup data.

+ +
customer + + + + object + + + + + + + + + <optional>
+ + + + + +
+

Deprecated Customer information for use in 3DS 1.0 verifications. Can contain any subset of a verifyCardCustomerObject. Only to be used for 3DS 1.0 integrations.

+ +
addFrame + + + + callback + + + + + + + + + + + + + +

Deprecated This addFrameCallback will be called when the bank frame needs to be added to your page. Only to be used for 3DS 1.0 integrations.

+ +
removeFrame + + + + callback + + + + + + + + + + + + + +

Deprecated For use in 3DS 1.0 Flows. This removeFrameCallback will be called when the bank frame needs to be removed from your page. Only to be used in 3DS 1.0 integrations.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is a verifyPayload. If no callback is provided, it will return a promise that resolves verifyPayload.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ +

+ Verifying a payment method nonce with 3DS 2.0 +

+ + +
var my3DSContainer;
+
+// set up listener after initialization
+threeDSecure.on(('lookup-complete', function (data, next) {
+  // use `data` here, then call `next()`
+  next();
+});
+
+// call verifyCard after tokenizing a card
+threeDSecure.verifyCard({
+  amount: '123.45',
+  nonce: hostedFieldsTokenizationPayload.nonce,
+  bin: hostedFieldsTokenizationPayload.details.bin,
+  email: 'test@example.com'
+  billingAddress: {
+    givenName: 'Jill',
+    surname: 'Doe',
+    phoneNumber: '8101234567',
+    streetAddress: '555 Smith St.',
+    extendedAddress: '#5',
+    locality: 'Oakland',
+    region: 'CA',
+    postalCode: '12345',
+    countryCodeAlpha2: 'US'
+  },
+  additionalInformation: {
+    workPhoneNumber: '5555555555',
+    shippingGivenName: 'Jill',
+    shippingSurname: 'Doe',
+    shippingAddress: {
+      streetAddress: '555 Smith st',
+      extendedAddress: '#5',
+      locality: 'Oakland',
+      region: 'CA',
+      postalCode: '12345',
+      countryCodeAlpha2: 'US'
+    }
+    shippingPhone: '8101234567'
+  }
+}, function (err, payload) {
+  if (err) {
+    console.error(err);
+    return;
+  }
+
+  if (payload.liabilityShifted) {
+    // Liability has shifted
+    submitNonceToServer(payload.nonce);
+  } else if (payload.liabilityShiftPossible) {
+    // Liability may still be shifted
+    // Decide if you want to submit the nonce
+  } else {
+    // Liability has not shifted and will not shift
+    // Decide if you want to submit the nonce
+  }
+});
+ +

+ Verifying a payment method nonce with 3DS 2.0 with onLookupComplete callback +

+ + +
var my3DSContainer;
+
+threeDSecure.verifyCard({
+  amount: '123.45',
+  nonce: hostedFieldsTokenizationPayload.nonce,
+  bin: hostedFieldsTokenizationPayload.details.bin,
+  email: 'test@example.com'
+  billingAddress: {
+    givenName: 'Jill',
+    surname: 'Doe',
+    phoneNumber: '8101234567',
+    streetAddress: '555 Smith St.',
+    extendedAddress: '#5',
+    locality: 'Oakland',
+    region: 'CA',
+    postalCode: '12345',
+    countryCodeAlpha2: 'US'
+  },
+  additionalInformation: {
+    workPhoneNumber: '5555555555',
+    shippingGivenName: 'Jill',
+    shippingSurname: 'Doe',
+    shippingAddress: {
+      streetAddress: '555 Smith st',
+      extendedAddress: '#5',
+      locality: 'Oakland',
+      region: 'CA',
+      postalCode: '12345',
+      countryCodeAlpha2: 'US'
+    }
+    shippingPhone: '8101234567'
+  },
+  onLookupComplete: function (data, next) {
+    // use `data` here, then call `next()`
+    next();
+  }
+}, function (err, payload) {
+  if (err) {
+    console.error(err);
+    return;
+  }
+
+  if (payload.liabilityShifted) {
+    // Liability has shifted
+    submitNonceToServer(payload.nonce);
+  } else if (payload.liabilityShiftPossible) {
+    // Liability may still be shifted
+    // Decide if you want to submit the nonce
+  } else {
+    // Liability has not shifted and will not shift
+    // Decide if you want to submit the nonce
+  }
+});
+ +

+ Handling 3DS lookup errors +

+ + +
var my3DSContainer;
+
+// set up listener after initialization
+threeDSecure.on(('lookup-complete', function (data, next) {
+  // use `data` here, then call `next()`
+  next();
+});
+
+// call verifyCard after tokenizing a card
+threeDSecure.verifyCard({
+  amount: '123.45',
+  nonce: hostedFieldsTokenizationPayload.nonce,
+  bin: hostedFieldsTokenizationPayload.details.bin,
+  email: 'test@example.com',
+  billingAddress: billingAddressFromCustomer,
+  additionalInformation: additionalInfoFromCustomer
+}, function (err, payload) {
+  if (err) {
+    if (err.code.indexOf('THREEDS_LOOKUP') === 0) {
+      // an error occurred during the initial lookup request
+
+      if (err.code === 'THREEDS_LOOKUP_TOKENIZED_CARD_NOT_FOUND_ERROR') {
+        // either the passed payment method nonce does not exist
+        // or it was already consumed before the lookup call was made
+      } else if (err.code.indexOf('THREEDS_LOOKUP_VALIDATION') === 0) {
+        // a validation error occurred
+        // likely some non-ascii characters were included in the billing
+        // address given name or surname fields, or the cardholdername field
+
+        // Instruct your user to check their data and try again
+      } else {
+        // an unknown lookup error occurred
+      }
+    } else {
+      // some other kind of error
+    }
+    return;
+  }
+
+  // handle success
+});
+ + +
+ + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ addFrameCallback(erropt, nullable, iframe) → {void} +

+
+ + + + + +
+

Deprecated The callback used for options.addFrame in 3DS 1.0's verifyCard.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
err + + + + BraintreeError + + + + + + + + + <optional>
+ + + + <nullable>
+ + + +
+

null or undefined if there was no error.

+ +
iframe + + + + HTMLIFrameElement + + + + + + + + + + + + + +

An iframe element containing the bank's authentication page that you must put on your page.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
+ +
+
    +
  • Yes
  • +
+
+ +
+ + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ additionalInformation :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
workPhoneNumber + + + + string + + + + + + + + + <optional>
+ + + +
+

The work phone number used for verification. Only numbers; remove dashes, parenthesis and other characters. (maximum length 25)

+
shippingGivenName + + + + string + + + + + + + + + <optional>
+ + + +
+

The first name associated with the shipping address. (maximum length 50, ASCII characters)

+
shippingSurname + + + + string + + + + + + + + + <optional>
+ + + +
+

The last name associated with the shipping address. (maximum length 50, ASCII characters)

+
shippingAddress + + + + object + + + + + + + + + <optional>
+ + + +
+ + +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
streetAddress + + + + string + + + + + + + + + <optional>
+ + + +
+

Line 1 of the shipping address (eg. number, street, etc). (maximum length 50)

+
extendedAddress + + + + string + + + + + + + + + <optional>
+ + + +
+

Line 2 of the shipping address (eg. suite, apt #, etc.). (maximum length 50)

+
line3 + + + + string + + + + + + + + + <optional>
+ + + +
+

Line 3 of the shipping address if needed (eg. suite, apt #, etc). (maximum length 50)

+
locality + + + + string + + + + + + + + + <optional>
+ + + +
+

The locality (city) name associated with the shipping address. (maximum length 50)

+
region + + + + string + + + + + + + + + <optional>
+ + + +
+

This field expects an ISO3166-2 subdivision code. The subdivision code is what follows the hyphen separator in the full ISO 3166-2 code. For example, the state of Ohio in the United States we expect "OH" as opposed to the full ISO 3166-2 code "US-OH".

+
postalCode + + + + string + + + + + + + + + <optional>
+ + + +
+

The zip code or equivalent for countries that have them. (maximum length 10)

+
countryCodeAlpha2 + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2 character country code. (maximum length 2)

+
+ +
shippingPhone + + + + string + + + + + + + + + <optional>
+ + + +
+

The phone number associated with the shipping address. Only numbers; remove dashes, parenthesis and other characters. (maximum length 20)

+
shippingMethod + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2-digit string indicating the name of the shipping method chosen for the transaction. (maximum length 50) Possible values:

+
    +
  • 01 Same Day
  • +
  • 02 Overnight / Expedited
  • +
  • 03 Priority (2-3 Days)
  • +
  • 04 Ground
  • +
  • 05 Electronic Delivery
  • +
  • 06 Ship to Store
  • +
+
shippingMethodIndicator + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2-digit string indicating the shipping method chosen for the transaction Possible values.

+
    +
  • 01 Ship to cardholder billing address
  • +
  • 02 Ship to another verified address on file with merchant
  • +
  • 03 Ship to address that is different from billing address
  • +
  • 04 Ship to store (store address should be populated on request)
  • +
  • 05 Digital goods
  • +
  • 06 Travel and event tickets, not shipped
  • +
  • 07 Other
  • +
+
productCode + + + + string + + + + + + + + + <optional>
+ + + +
+

The 3-letter string representing the merchant product code. Possible values:

+
    +
  • AIR Airline
  • +
  • GEN General Retail
  • +
  • DIG Digital Goods
  • +
  • SVC Services
  • +
  • RES Restaurant
  • +
  • TRA Travel
  • +
  • DSP Cash Dispensing
  • +
  • REN Car Rental
  • +
  • GAS Fuel
  • +
  • LUX Luxury Retail
  • +
  • ACC Accommodation Retail
  • +
  • TBD Other
  • +
+
deliveryTimeframe + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2-digit number indicating the delivery time frame. Possible values:

+
    +
  • 01 Electronic delivery
  • +
  • 02 Same day shipping
  • +
  • 03 Overnight shipping
  • +
  • 04 Two or more day shipping
  • +
+
deliveryEmail + + + + string + + + + + + + + + <optional>
+ + + +
+

For electronic delivery, email address to which the merchandise was delivered. (maximum length 254)

+
reorderindicator + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2-digit number indicating whether the cardholder is reordering previously purchased merchandise. possible values:

+
    +
  • 01 First time ordered
  • +
  • 02 Reordered
  • +
+
preorderIndicator + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2-digit number indicating whether cardholder is placing an order with a future availability or release date. possible values:

+
    +
  • 01 Merchandise available
  • +
  • 02 Future availability
  • +
+
preorderDate + + + + string + + + + + + + + + <optional>
+ + + +
+

The 8-digit number (format: YYYYMMDD) indicating expected date that a pre-ordered purchase will be available.

+
giftCardAmount + + + + string + + + + + + + + + <optional>
+ + + +
+

The purchase amount total for prepaid gift cards in major units. (maximum length 15)

+
giftCardCurrencyCode + + + + string + + + + + + + + + <optional>
+ + + +
+

ISO 4217 currency code for the gift card purchased. (maximum length 3)

+
giftCardCount + + + + string + + + + + + + + + <optional>
+ + + +
+

Total count of individual prepaid gift cards purchased. (maximum length 2)

+
accountAgeIndicator + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2-digit value representing the length of time cardholder has had account. Possible values:

+
    +
  • 01 No Account
  • +
  • 02 Created during transaction
  • +
  • 03 Less than 30 days
  • +
  • 04 30-60 days
  • +
  • 05 More than 60 days
  • +
+
accountCreateDate + + + + string + + + + + + + + + <optional>
+ + + +
+

The 8-digit number (format: YYYYMMDD) indicating the date the cardholder opened the account.

+
accountChangeIndicator + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2-digit value representing the length of time since the last change to the cardholder account. This includes shipping address, new payment account or new user added. Possible values:

+
    +
  • 01 Changed during transaction
  • +
  • 02 Less than 30 days
  • +
  • 03 30-60 days
  • +
  • 04 More than 60 days
  • +
+
accountChangeDate + + + + string + + + + + + + + + <optional>
+ + + +
+

The 8-digit number (format: YYYYMMDD) indicating the date the cardholder's account was last changed. This includes changes to the billing or shipping address, new payment accounts or new users added.

+
accountPwdChangeIndicator + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2-digit value representing the length of time since the cardholder changed or reset the password on the account. Possible values:

+
    +
  • 01 No change
  • +
  • 02 Changed during transaction
  • +
  • 03 Less than 30 days
  • +
  • 04 30-60 days
  • +
  • 05 More than 60 days
  • +
+
accountPwdChangeDate + + + + string + + + + + + + + + <optional>
+ + + +
+

The 8-digit number (format: YYYYMMDD) indicating the date the cardholder last changed or reset password on account.

+
shippingAddressUsageIndicator + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2-digit value indicating when the shipping address used for transaction was first used. Possible values:

+
    +
  • 01 This transaction
  • +
  • 02 Less than 30 days
  • +
  • 03 30-60 days
  • +
  • 04 More than 60 days
  • +
+
shippingAddressUsageDate + + + + string + + + + + + + + + <optional>
+ + + +
+

The 8-digit number (format: YYYYMMDD) indicating the date when the shipping address used for this transaction was first used.

+
transactionCountDay + + + + string + + + + + + + + + <optional>
+ + + +
+

Number of transactions (successful or abandoned) for this cardholder account within the last 24 hours. (maximum length 3)

+
transactionCountYear + + + + string + + + + + + + + + <optional>
+ + + +
+

Number of transactions (successful or abandoned) for this cardholder account within the last year. (maximum length 3)

+
addCardAttempts + + + + string + + + + + + + + + <optional>
+ + + +
+

Number of add card attempts in the last 24 hours. (maximum length 3)

+
accountPurchases + + + + string + + + + + + + + + <optional>
+ + + +
+

Number of purchases with this cardholder account during the previous six months.

+
fraudActivity + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2-digit value indicating whether the merchant experienced suspicious activity (including previous fraud) on the account. Possible values:

+
    +
  • 01 No suspicious activity
  • +
  • 02 Suspicious activity observed
  • +
+
shippingNameIndicator + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2-digit value indicating if the cardholder name on the account is identical to the shipping name used for the transaction. Possible values:

+
    +
  • 01 Account and shipping name identical
  • +
  • 02 Account and shipping name differ
  • +
+
paymentAccountIndicator + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2-digit value indicating the length of time that the payment account was enrolled in the merchant account. Possible values:

+
    +
  • 01 No account (guest checkout)
  • +
  • 02 During the transaction
  • +
  • 03 Less than 30 days
  • +
  • 04 30-60 days
  • +
  • 05 More than 60 days
  • +
+
paymentAccountAge + + + + string + + + + + + + + + <optional>
+ + + +
+

The 8-digit number (format: YYYYMMDD) indicating the date the payment account was added to the cardholder account.

+
acsWindowSize + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2-digit number to set the challenge window size to display to the end cardholder. The ACS will reply with content that is formatted appropriately to this window size to allow for the best user experience. The sizes are width x height in pixels of the window displayed in the cardholder browser window. Possible values:

+
    +
  • 01 250x400
  • +
  • 02 390x400
  • +
  • 03 500x600
  • +
  • 04 600x400
  • +
  • 05 Full page
  • +
+
sdkMaxTimeout + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2-digit number of minutes (minimum 05) to set the maximum amount of time for all 3DS 2.0 messages to be communicated between all components.

+
addressMatch + + + + string + + + + + + + + + <optional>
+ + + +
+

The 1-character value (Y/N) indicating whether cardholder billing and shipping addresses match.

+
accountId + + + + string + + + + + + + + + <optional>
+ + + +
+

Additional cardholder account information. (maximum length 64)

+
ipAddress + + + + string + + + + + + + + + <optional>
+ + + +
+

The IP address of the consumer. IPv4 and IPv6 are supported.

+
    +
  • only one IP address supported
  • +
  • only numbers, letters, period '.' chars, or colons ':' are acceptable
  • +
+
orderDescription + + + + string + + + + + + + + + <optional>
+ + + +
+

Brief description of items purchased. (maximum length 256)

+
taxAmount + + + + string + + + + + + + + + <optional>
+ + + +
+

Unformatted tax amount without any decimalization (ie. $123.67 = 12367). (maximum length 20)

+
userAgent + + + + string + + + + + + + + + <optional>
+ + + +
+

The exact content of the HTTP user agent header. (maximum length 500)

+
authenticationIndicator + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2-digit number indicating the type of authentication request. Possible values:

+
    +
  • 01 Payment
  • +
  • 02 Recurring transaction
  • +
  • 03 Installment
  • +
  • 04 Add card
  • +
  • 05 Maintain card
  • +
  • 06 Cardholder verification as part of EMV token ID&V
  • +
  • 08 Split Shipment
  • +
  • 09 Delayed Shipment
  • +
  • 85 Payment with multiple merchants
  • +
+
installment + + + + string + + + + + + + + + <optional>
+ + + +
+

An integer value greater than 1 indicating the maximum number of permitted authorizations for installment payments. (maximum length 3)

+
purchaseDate + + + + string + + + + + + + + + <optional>
+ + + +
+

The 14-digit number (format: YYYYMMDDHHMMSS) indicating the date in UTC of original purchase.

+
recurringEnd + + + + string + + + + + + + + + <optional>
+ + + +
+

The 8-digit number (format: YYYYMMDD) indicating the date after which no further recurring authorizations should be performed.

+
recurringFrequency + + + + string + + + + + + + + + <optional>
+ + + +
+

Integer value indicating the minimum number of days between recurring authorizations. A frequency of monthly is indicated by the value 28. Multiple of 28 days will be used to indicate months (ex. 6 months = 168). (maximum length 3)

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ billingAddress :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
givenName + + + + string + + + + + + + + + <optional>
+ + + +
+

The first name associated with the billing address. (maximum length 50, ASCII characters)

+
surname + + + + string + + + + + + + + + <optional>
+ + + +
+

The last name associated with the billing address. (maximum length 50, ASCII characters)

+
phoneNumber + + + + string + + + + + + + + + <optional>
+ + + +
+

The phone number associated with the billing address. Only numbers; remove dashes, parenthesis and other characters.

+
streetAddress + + + + string + + + + + + + + + <optional>
+ + + +
+

Line 1 of the billing address (eg. number, street, etc). (maximum length 50)

+
extendedAddress + + + + string + + + + + + + + + <optional>
+ + + +
+

Line 2 of the billing address (eg. suite, apt #, etc.). (maximum length 50)

+
line3 + + + + string + + + + + + + + + <optional>
+ + + +
+

Line 3 of the billing address if needed (eg. suite, apt #, etc). (maximum length 50)

+
locality + + + + string + + + + + + + + + <optional>
+ + + +
+

The locality (city) name associated with the billing address.

+
region + + + + string + + + + + + + + + <optional>
+ + + +
+

This field expects an ISO3166-2 subdivision code. The subdivision code is what follows the hyphen separator in the full ISO 3166-2 code. For example, the state of Ohio in the United States we expect "OH" as opposed to the full ISO 3166-2 code "US-OH".

+
postalCode + + + + string + + + + + + + + + <optional>
+ + + +
+

The zip code or equivalent for countries that have them.

+
countryCodeAlpha2 + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2 character country code.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ prepareLookupPayload :string +

+
+ + + + + +
+

The client data to pass on when doing a server side lookup call.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ removeFrameCallback() → {void} +

+
+ + + + + +
+

Deprecated The callback used for options.removeFrame in 3DS 1.0's verifyCard.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
+ +
+
    +
  • Yes
  • +
+
+ +
+ + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ verificationData :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
requiresUserAuthentication + + + + boolean + + + + + + + +

When true, the user will be presented with a 3D Secure challenge when calling next in the lookup-complete event.

+
threeDSecureInfo + + + + object + + + + + + + +

Contains liability shift details.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
liabilityShiftPossible + + + + boolean + + + + + + + +

Indicates whether the card was eligible for 3D Secure.

+
liabilityShifted + + + + boolean + + + + + + + +

Indicates whether the liability for fraud has been shifted away from the merchant.

+
+ +
paymentMethod + + + + object + + + + + + + +

A verifyPayload object.

+
lookup + + + + object + + + + + + + +

Details about the 3D Secure lookup.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
threeDSecureVersion + + + + string + + + + + + + +

The version of 3D Secure that will be used for the 3D Secure challenge.

+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ verifyCardCustomerObject :object +

+
+ + + + + +
+

Deprecated Optional customer information to be passed to 3DS 1.0 for verification.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
customer.mobilePhoneNumber + + + + string + + + + + + + + + <optional>
+ + + +
+

The mobile phone number used for verification. Only numbers; remove dashes, parenthesis and other characters.

+
customer.email + + + + string + + + + + + + + + <optional>
+ + + +
+

The email used for verification.

+
customer.shippingMethod + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2-digit string indicating the shipping method chosen for the transaction.

+
customer.billingAddress.firstName + + + + string + + + + + + + + + <optional>
+ + + +
+

The first name associated with the address.

+
customer.billingAddress.lastName + + + + string + + + + + + + + + <optional>
+ + + +
+

The last name associated with the address.

+
customer.billingAddress.streetAddress + + + + string + + + + + + + + + <optional>
+ + + +
+

Line 1 of the Address (eg. number, street, etc).

+
customer.billingAddress.extendedAddress + + + + string + + + + + + + + + <optional>
+ + + +
+

Line 2 of the Address (eg. suite, apt #, etc.).

+
customer.billingAddress.locality + + + + string + + + + + + + + + <optional>
+ + + +
+

The locality (city) name associated with the address.

+
customer.billingAddress.region + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2 letter code for US states or an ISO-3166-2 country subdivision code of up to three letters.

+
customer.billingAddress.postalCode + + + + string + + + + + + + + + <optional>
+ + + +
+

The zip code or equivalent for countries that have them.

+
customer.billingAddress.countryCodeAlpha2 + + + + string + + + + + + + + + <optional>
+ + + +
+

The 2 character country code.

+
customer.billingAddress.phoneNumber + + + + string + + + + + + + + + <optional>
+ + + +
+

The phone number associated with the address. Only numbers; remove dashes, parenthesis and other characters.

+
+ + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
+ +
+
    +
  • Yes
  • +
+
+ +
+ + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ verifyPayload :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nonce + + + + string + + + + + + + +

The new payment method nonce produced by the 3D Secure lookup. The original nonce passed into verifyCard was consumed. This new nonce should be used to transact on your server.

+
type + + + + string + + + + + + + +

The payment method type.

+
details + + + + object + + + + + + + +

Additional account details.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
cardType + + + + string + + + + + + + +

Type of card, ex: Visa, MasterCard.

+
lastFour + + + + string + + + + + + + +

Last four digits of card number.

+
lastTwo + + + + string + + + + + + + +

Last two digits of card number.

+
+ +
description + + + + string + + + + + + + +

A human-readable description.

+
binData + + + + object + + + + + + + +

Information about the card based on the bin.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
commercial + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
countryOfIssuance + + + + string + + + + + + + +

The country of issuance.

+
debit + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
durbinRegulated + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
healthcare + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
issuingBank + + + + string + + + + + + + +

The issuing bank.

+
payroll + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
prepaid + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
productId + + + + string + + + + + + + +

The product id.

+
+ +
liabilityShiftPossible + + + + boolean + + + + + + + +

Deprecated: Use threeDSecureInfo.liabilityShiftPossible instead.

+
liabilityShifted + + + + boolean + + + + + + + +

Deprecated: Use threeDSecureInfo.liabilityShifted instead.

+
threeDSecureInfo + + + + object + + + + + + + +

3DS information about the card. Note: This information should be verified on the server by using the payment method nonce find method. The values provided here are merely for convenience. Only values looked up on the server should determine the logic about how to process a transaction.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
acsTransactionId + + + + string + + + + + + + +

The transaction identifier from the issuing bank.

+
cavv + + + + string + + + + + + + +

Cardholder authentication verification value or CAVV. The main encrypted message issuers and card networks use to verify authentication has occurred. Mastercard uses an AVV message and American Express uses an AEVV message, each of which should also be passed in the cavv parameter.

+
dsTransactionId + + + + string + + + + + + + +

Transaction identifier resulting from 3D Secure 2 authentication.

+
eciFlag + + + + string + + + + + + + +

The value of the electronic commerce indicator (ECI) flag, which indicates the outcome of the 3DS authentication. This will be a two-digit value.

+
enrolled + + + + boolean + + + + + + + +

Indicates the status of 3D Secure authentication eligibility with the card issuer.

+
liabilityShifted + + + + boolean + + + + + + + +

Indicates whether the liability for fraud has been shifted away from the merchant.

+
liabilityShiftPossible + + + + boolean + + + + + + + +

Indicates whether liability shift is still possible on a retry.

+
paresStatus + + + + string + + + + + + + +

Transaction status result identifier.

+
status + + + + string + + + + + + + +

Indicates the outcome of the 3D Secure event.

+
threeDSecureAuthenticationId + + + + string + + + + + + + +

ID of the 3D Secure authentication performed for this transaction. Do not provide this field as a transaction sale parameter if you are using the returned payment method nonce from the payload.

+
threeDSecureServerTransactionId + + + + string + + + + + + + +

Transaction identifier provided by the issuing bank who recieved the 3D Secure event.

+
threeDSecureVersion + + + + string + + + + + + + +

The version of 3D Secure authentication used for the transaction.

+
xid + + + + string + + + + + + + +

Transaction identifier resulting from 3D Secure authentication. Uniquely identifies the transaction and sometimes required in the authorization message. This is a base64-encoded value. This field will no longer be used in 3D Secure 2 authentications for Visa and Mastercard, however it will be supported by American Express.

+
lookup.transStatus + + + + string + + + + + + + +

Error code returned from the 3D Secure MPI provider.

+
lookup.transStatusReason + + + + string + + + + + + + +

Description correlating to the transStatus error code.

+
authentication.transStatus + + + + string + + + + + + + +

Error code returned from the 3D Secure MPI provider.

+
authentication.transStatusReason + + + + string + + + + + + + +

Description correlating to the transStatus error code.

+
+ +
rawCardinalSDKVerificationData + + + + object + + + + + + + +

The response back from the Cardinal SDK after verification has completed. See Cardinal's Documentation for more information. If the customer was not required to do a 3D Secure challenge, this object will not be available.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +

Events

+ + + + + + + + + + + + + +

+ authentication-iframe-available +

+
+ + + + + +
+

This event is emitted when the 2-inline-iframe version is specified when creating the 3D Secure instance and the authentication iframe becomes available.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Listening for the authentication iframe to be available +

+ + +
  threeDSecureInstance.on('authentication-iframe-available', function (event, next) {
+    document.body.appendChild(event.element); // add iframe element to page
+
+    next(); // let the SDK know the iframe is ready
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ authentication-modal-close +

+
+ + + + + +
+

This event is emitted when using the 3D Secure 2.0 flow and the authentication modal closes, either because the authentication was completed or because the customer canceled the process.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
braintree.threeDSecure.create({
+  client: clientInstance,
+  version: '2'
+}, function (createErr, threeDSecureInstance) {
+  threeDSecureInstance.on('authentication-modal-close', function () {
+    // the modal was closed
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ authentication-modal-render +

+
+ + + + + +
+

This event is emitted when using the 3D Secure 2.0 flow and the authentication modal is rendered.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
braintree.threeDSecure.create({
+  client: clientInstance,
+  version: '2'
+}, function (createErr, threeDSecureInstance) {
+  threeDSecureInstance.on('authentication-modal-render', function () {
+    // the modal was rendered, presenting the authentication form to the customer
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ customer-canceled +

+
+ + + + + +
+

This event is emitted when using the 3D Secure 2.0 flow and the customer cancels the 3D Secure challenge.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Listening for when the customer cancels the 3D Secure challenge +

+ + +
braintree.threeDSecure.create({
+  client: clientInstance,
+  version: '2'
+}, function (createErr, threeDSecureInstance) {
+  threeDSecureInstance.on('customer-canceled', function () {
+    // the customer canceled the 3D Secure challenge
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ lookup-complete +

+
+ + + + + +
+

This event is emitted when using the 3D Secure 2.0 flow and the initial lookup request completes. If this is not used, a onLookupComplete callback must be passed into the verifyCard method.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Listening for when the lookup request is complete +

+ + +
braintree.threeDSecure.create({
+  client: clientInstance,
+  version: '2'
+}, function (createErr, threeDSecureInstance) {
+  threeDSecureInstance.on('lookup-complete', function (data, next) {
+    // inspect the data
+
+    // call next when ready to proceed with the challenge
+    next();
+  });
+});
+ + +
+ + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/USBankAccount.html b/3.111.1/USBankAccount.html new file mode 100644 index 00000000..28c9b652 --- /dev/null +++ b/3.111.1/USBankAccount.html @@ -0,0 +1,2176 @@ + + + + + + + + + USBankAccount - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ USBankAccount +

+ + + + +
+
+ +

+ + USBankAccount + +

+ + +
+

This class represents a US Bank Account component. Instances of this class can tokenize raw bank details or present a bank login. You cannot use this constructor directly. Use braintree.us-bank-account.create instead.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new USBankAccount(options) +

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

See us-bank-account.create.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ teardown(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Cleanly tear down anything set up by create.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called once teardown is complete. No data is returned if teardown completes successfully.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
usBankAccountInstance.teardown();
+ +

+ With callback +

+ + +
usBankAccountInstance.teardown(function () {
+  // teardown is complete
+});
+ + +
+ + + + + + + + + + + + + + +

+ tokenize(options, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Tokenizes bank information to return a payment method nonce. You can tokenize bank details by providing information like account and routing numbers. You can also tokenize with a bank login UI that prompts the customer to log into their bank account.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

All tokenization options for the US Bank Account component.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
mandateText + + + + string + + + + + + + + + + + + + +

A string for proof of customer authorization. For example, 'I authorize Braintree to debit my bank account on behalf of My Online Store.'.

+ +
bankDetails + + + + object + + + + + + + + + <optional>
+ + + + + +
+

Bank detail information (such as account and routing numbers). bankDetails or bankLogin option must be provided.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
routingNumber + + + + string + + + + + + + + + + + + + +

The customer's bank routing number, such as '307075259'.

+ +
accountNumber + + + + string + + + + + + + + + + + + + +

The customer's bank account number, such as '999999999'.

+ +
accountType + + + + string + + + + + + + + + + + + + +

The customer's bank account type. Must be 'checking' or 'savings'.

+ +
ownershipType + + + + string + + + + + + + + + + + + + +

The customer's bank account ownership type. Must be 'personal' or 'business'.

+ +
firstName + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The customer's first name. Required when account ownership type is personal.

+ +
lastName + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The customer's last name. Required when account ownership type is personal.

+ +
businessName + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The customer's business name. Required when account ownership type is business.

+ +
billingAddress + + + + object + + + + + + + + + + + + + +

The customer's billing address.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
streetAddress + + + + string + + + + + + + + + + + + + +

The street address for the customer's billing address, such as '123 Fake St'.

+ +
extendedAddress + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The extended street address for the customer's billing address, such as 'Apartment B'.

+ +
locality + + + + string + + + + + + + + + + + + + +

The locality for the customer's billing address. This is typically a city, such as 'San Francisco'.

+ +
region + + + + string + + + + + + + + + + + + + +

The region for the customer's billing address. This is typically a state, such as 'CA'.

+ +
postalCode + + + + string + + + + + + + + + + + + + +

The postal code for the customer's billing address. This is typically a ZIP code, such as '94119'.

+ +
+ + +
+ + +
bankLogin + + + + object + + + + + + + + + <optional>
+ + + + + +
+

Bank login information. bankLogin or bankDetails option must be provided.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
displayName + + + + string + + + + + + + + + + + + + +

Display name for the bank login UI, such as 'My Store'.

+ +
ownershipType + + + + string + + + + + + + + + + + + + +

The customer's bank account ownership type. Must be 'personal' or 'business'.

+ +
firstName + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The customer's first name. Required when account ownership type is personal.

+ +
lastName + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The customer's last name. Required when account ownership type is personal.

+ +
businessName + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The customer's business name. Required when account ownership type is business.

+ +
billingAddress + + + + object + + + + + + + + + + + + + +

The customer's billing address.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
streetAddress + + + + string + + + + + + + + + + + + + +

The street address for the customer's billing address, such as '123 Fake St'.

+ +
extendedAddress + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The extended street address for the customer's billing address, such as 'Apartment B'.

+ +
locality + + + + string + + + + + + + + + + + + + +

The locality for the customer's billing address. This is typically a city, such as 'San Francisco'.

+ +
region + + + + string + + + + + + + + + + + + + +

The region for the customer's billing address. This is typically a state, such as 'CA'.

+ +
postalCode + + + + string + + + + + + + + + + + + + +

The postal code for the customer's billing address. This is typically a ZIP code, such as '94119'.

+ +
+ + +
+ + +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is a tokenizePayload. If no callback is provided, tokenize returns a promise that resolves with tokenizePayload.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ +

+ Tokenizing raw bank details +

+ + +
var routingNumberInput = document.querySelector('input[name="routing-number"]');
+var accountNumberInput = document.querySelector('input[name="account-number"]');
+var accountTypeInput = document.querySelector('input[name="account-type"]:checked');
+var ownershipTypeInput = document.querySelector('input[name="ownership-type"]:checked');
+var firstNameInput = document.querySelector('input[name="first-name"]');
+var lastNameInput = document.querySelector('input[name="last-name"]');
+var businessNameInput = document.querySelector('input[name="business-name"]');
+var billingAddressStreetInput = document.querySelector('input[name="street-address"]');
+var billingAddressExtendedInput = document.querySelector('input[name="extended-address"]');
+var billingAddressLocalityInput = document.querySelector('input[name="locality"]');
+var billingAddressRegionSelect = document.querySelector('select[name="region"]');
+var billingAddressPostalInput = document.querySelector('input[name="postal-code"]');
+
+submitButton.addEventListener('click', function (event) {
+  var bankDetails = {
+    routingNumber: routingNumberInput.value,
+    accountNumber: accountNumberInput.value,
+    accountType: accountTypeInput.value,
+    ownershipType: ownershipTypeInput.value,
+    billingAddress: {
+      streetAddress: billingAddressStreetInput.value,
+      extendedAddress: billingAddressExtendedInput.value,
+      locality: billingAddressLocalityInput.value,
+      region: billingAddressRegionSelect.value,
+      postalCode: billingAddressPostalInput.value
+    }
+  };
+
+  if (bankDetails.ownershipType === 'personal') {
+    bankDetails.firstName = firstNameInput.value;
+    bankDetails.lastName = lastNameInput.value;
+  } else {
+    bankDetails.businessName = businessNameInput.value;
+  }
+
+  event.preventDefault();
+
+  usBankAccountInstance.tokenize({
+    bankDetails: bankDetails,
+    mandateText: 'I authorize Braintree to debit my bank account on behalf of My Online Store.'
+  }, function (tokenizeErr, tokenizedPayload) {
+    if (tokenizeErr) {
+      console.error('There was an error tokenizing the bank details.');
+      return;
+    }
+
+    // Send tokenizePayload.nonce to your server here!
+  });
+});
+ +

+ Tokenizing with bank login UI +

+ + +
var ownershipTypeInput = document.querySelector('input[name="ownership-type"]:checked');
+var firstNameInput = document.querySelector('input[name="first-name"]');
+var lastNameInput = document.querySelector('input[name="last-name"]');
+var businessNameInput = document.querySelector('input[name="business-name"]');
+var billingAddressStreetInput = document.querySelector('input[name="street-address"]');
+var billingAddressExtendedInput = document.querySelector('input[name="extended-address"]');
+var billingAddressLocalityInput = document.querySelector('input[name="locality"]');
+var billingAddressRegionSelect = document.querySelector('select[name="region"]');
+var billingAddressPostalInput = document.querySelector('input[name="postal-code"]');
+
+bankLoginButton.addEventListener('click', function (event) {
+  var bankLogin = {
+    displayName: 'My Online Store',
+    ownershipType: ownershipTypeInput.value,
+    billingAddress: {
+      streetAddress: billingAddressStreetInput.value,
+      extendedAddress: billingAddressExtendedInput.value,
+      locality: billingAddressLocalityInput.value,
+      region: billingAddressRegionSelect.value,
+      postalCode: billingAddressPostalInput.value
+    }
+  }
+  event.preventDefault();
+
+  if (bankLogin.ownershipType === 'personal') {
+    bankLogin.firstName = firstNameInput.value;
+    bankLogin.lastName = lastNameInput.value;
+  } else {
+    bankLogin.businessName = businessNameInput.value;
+  }
+
+  usBankAccountInstance.tokenize({
+    bankLogin: bankLogin,
+    mandateText: 'I authorize Braintree to debit my bank account on behalf of My Online Store.'
+  }, function (tokenizeErr, tokenizedPayload) {
+    if (tokenizeErr) {
+      console.error('There was an error tokenizing the bank details.');
+      return;
+    }
+
+    // Send tokenizePayload.nonce to your server here!
+  });
+});
+ + +
+ + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ tokenizePayload :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nonce + + + + string + + + + + + + +

The payment method nonce.

+
type + + + + string + + + + + + + +

The payment method type, always us_bank_account.

+
details + + + + object + + + + + + + +

Additional account details. Currently empty.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/VaultManager.html b/3.111.1/VaultManager.html new file mode 100644 index 00000000..bd087c9e --- /dev/null +++ b/3.111.1/VaultManager.html @@ -0,0 +1,1403 @@ + + + + + + + + + VaultManager - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ VaultManager +

+ + + + +
+
+ +

+ + VaultManager + +

+ + +
+

This class allows you to manage a customer's payment methods on the client.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new VaultManager(options) +

+
+ + + + + +
+

You cannot use this constructor directly. Use braintree.vault-manager.create instead.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

Options

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ deletePaymentMethod(paymentMethodNonce, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Deletes a payment method owned by the customer whose id was used to generate the client token used to create the client.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
paymentMethodNonce + + + + string + + + + + + + + + + + + + +

The payment method nonce that references a vaulted payment method.

+ +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

No data is returned if the operation is successful.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
vaultManagerInstance.deletePaymentMethod('nonce-to-delete', function (err) {
+  // handle err if it exists
+});
+ + +
+ + + + + + + + + + + + + + +

+ fetchPaymentMethods(optionsopt, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Fetches payment methods owned by the customer whose id was used to generate the client token used to create the client.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + <optional>
+ + + + + +
+

Options for fetching payment methods.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
defaultFirst + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + false + + +

If true, the payment methods will be returned with the default payment method for the customer first. Otherwise, order is not guaranteed.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument is a fetchPaymentMethodsPayload. This is also what is resolved by the promise if no callback is provided.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
vaultManagerInstance.fetchPaymentMethods(function (err, paymentMethods) {
+  paymentMethods.forEach(function (paymentMethod) {
+    // add payment method to UI
+    // paymentMethod.nonce <- transactable nonce associated with payment method
+    // paymentMethod.details <- object with additional information about payment method
+    // paymentMethod.type <- a constant signifying the type
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ teardown(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Cleanly tear down anything set up by create.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called once teardown is complete. No data is returned if teardown completes successfully.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
vaultManagerInstance.teardown();
+ +

+ With callback +

+ + +
vaultManagerInstance.teardown(function () {
+  // teardown is complete
+});
+ + +
+ + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ fetchPaymentMethodsPayload :array +

+
+ + + + + +
+

The customer's payment methods.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
paymentMethod + + + + object + + + + + + + +

The payment method object.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
nonce + + + + string + + + + + + + + + + + +

A nonce that can be sent to your server to transact on the payment method.

+
default + + + + boolean + + + + + + + + + + + +

Whether or not this is the default payment method for the customer.

+
details + + + + object + + + + + + + + + + + +

Any additional details about the payment method. Varies depending on the type of payment method.

+
type + + + + string + + + + + + + + + + + +

A constant indicating the type of payment method.

+
description + + + + string + + + + + + + + + + + <nullable>
+ +
+

Additional description about the payment method.

+
binData + + + + object + + + + + + + + + + + <nullable>
+ +
+

Bin data about the payment method.

+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/Venmo.html b/3.111.1/Venmo.html new file mode 100644 index 00000000..33df7686 --- /dev/null +++ b/3.111.1/Venmo.html @@ -0,0 +1,1826 @@ + + + + + + + + + Venmo - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ Venmo +

+ + + + +
+
+ +

+ + Venmo + +

+ + +
+

This class represents a Venmo component produced by braintree-web/venmo.create. Instances of this class have methods for tokenizing Venmo payments.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new Venmo(options) +

+
+ + + + + +
+

Do not use this constructor directly. Use braintree-web.venmo.create instead.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

The Venmo create options.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ hasTokenizationResult() → {boolean} +

+
+ + + + + +
+

Returns a boolean indicating whether a Venmo tokenization result is ready to be processed immediately.

+

This method should be called after initialization to see if the result of Venmo authorization is available. If it returns true, call tokenize immediately to process the results.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ isBrowserSupported() → {boolean} +

+
+ + + + + +
+

Returns a boolean indicating whether the current browser supports Venmo as a payment method. Please note that iOS Chrome is not supported when the Venmo button is rendered in an iFrame.

+

If options.allowNewBrowserTab is false when calling venmo.create, this method will return true only for browsers known to support returning from the Venmo app to the same browser tab. Currently, this is limited to iOS Safari and Android Chrome. +If options.allowWebviews is false when calling venmo.create, this method will return true only for mobile browsers that are not webviews.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ teardown(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Cleanly tear down anything set up by create.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called once teardown is complete. No data is returned if teardown completes successfully.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
venmoInstance.teardown();
+ +

+ With callback +

+ + +
venmoInstance.teardown(function () {
+  // teardown is complete
+});
+ + +
+ + + + + + + + + + + + + + +

+ tokenize(optionsopt, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Launches the Venmo flow and returns a nonce payload.

+

If hasTokenizationResult returns true, calling tokenize will immediately process and return the results without initiating the Venmo payment authorization flow.

+

Only one Venmo flow can be active at a time. One way to achieve this is to disable your Venmo button while the flow is open.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + <optional>
+ + + + + +
+

Options for tokenization.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
processResultsDelay + + + + number + + + + + + + + + <optional>
+ + + + + +
+ + 500 + + +

The amount of time in milliseconds to delay processing the results. In most cases, this value should be left as the default.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is a tokenizePayload. If no callback is provided, the method will return a Promise that resolves with a tokenizePayload.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
button.addEventListener('click', function () {
+  // Disable the button so that we don't attempt to open multiple popups.
+  button.setAttribute('disabled', 'disabled');
+
+  // Because tokenize opens a new window, this must be called
+  // as a result of a user action, such as a button click.
+  venmoInstance.tokenize().then(function (payload) {
+    // Submit payload.nonce to your server
+    // Use payload.username to get the Venmo username and display any UI
+  }).catch(function (tokenizeError) {
+    // Handle flow errors or premature flow closure
+    switch (tokenizeErr.code) {
+      case 'VENMO_APP_CANCELED':
+        console.log('User canceled Venmo flow.');
+        break;
+      case 'VENMO_CANCELED':
+        console.log('User canceled Venmo, or Venmo app is not available.');
+        break;
+      default:
+        console.error('Error!', tokenizeErr);
+    }
+  }).then(function () {
+    button.removeAttribute('disabled');
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ (inner) cancelTokenization() → {Promise|void} +

+
+ + + + + +
+

Cancels the venmo tokenization process

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
venmoTokenizeButton.addEventListener('click', function () {
+  venmoInstance.tokenize().then(function (payload) {
+    // handle payload
+  }).catch(function (err) {
+    if (err.code === 'VENMO_TOKENIZATION_CANCELED_BY_MERCHANT') {
+      // tokenization was canceled by calling cancelTokenization
+    }
+  });
+});
+
+venmoCancelButton.addEventListener('click', function () {
+  // Hide the button when the venmo flow is not in progress
+  venmoCancelButton.style.display = "none";
+
+  venmoInstance.cancelTokenization().then(function () {
+    // done canceling the flow
+  }).catch(function (err) {
+    // should only get here if there is no tokenization in progress
+  });
+});
+ + +
+ + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ lineItem :object +

+
+ + + + + + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
quantity + + + + number + + + + + + + + + + + +

Number of units of the item purchased. This value must be a whole number and can't be negative or zero.

+
unitAmount + + + + string + + + + + + + + + + + +

Per-unit price of the item. Can include up to 2 decimal places. This value can't be negative or zero.

+
name + + + + string + + + + + + + + + + + +

Item name. Maximum 127 characters.

+
kind + + + + string + + + + + + + + + + + +

Indicates whether the line item is a debit (sale) or credit (refund) to the customer. Accepted values: debit and credit.

+
unitTaxAmount + + + + string + + + + + + + + + + + <nullable>
+ +
+

Per-unit tax price of the item. Can include up to 2 decimal places. This value can't be negative or zero.

+
description + + + + string + + + + + + + + + + + <nullable>
+ +
+

Item description. Maximum 127 characters.

+
productCode + + + + string + + + + + + + + + + + <nullable>
+ +
+

Product or UPC code for the item. Maximum 127 characters.

+
url + + + + string + + + + + + + + + + + <nullable>
+ +
+

The URL to product information.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ tokenizePayload :object +

+
+ + + + + +
+

Venmo tokenize payload.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nonce + + + + string + + + + + + + +

The payment method nonce.

+
type + + + + string + + + + + + + +

The payment method type, always VenmoAccount.

+
details + + + + object + + + + + + + +

Additional Venmo account details.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
username + + + + string + + + + + + + +

The username of the Venmo account.

+
paymentContextId + + + + string + + + + + + + +

The context ID of the Venmo payment. Only available when used with paymentMethodUsage.

+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/VisaCheckout.html b/3.111.1/VisaCheckout.html new file mode 100644 index 00000000..0b4ba804 --- /dev/null +++ b/3.111.1/VisaCheckout.html @@ -0,0 +1,2685 @@ + + + + + + + + + VisaCheckout - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ VisaCheckout +

+ + + + +
+
+ +

+ + VisaCheckout + +

+ + +
+

This class represents a Visa Checkout component produced by braintree-web/visa-checkout.create. Instances of this class have methods for interacting with Visa Checkout's JavaScript library.

+
+ + +
+ +
+
+ + + + + +

Constructor

+ + + + + + + + +

+ new VisaCheckout(options) +

+
+ + + + + +
+

Do not use this constructor directly. Use braintree-web.visa-checkout.create instead.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

The Visa Checkout create options.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ createInitOptions(options) → {object} +

+
+ + + + + +
+

Creates an initOptions object from the passed options, applying properties that Braintree needs to transact Visa Checkout.

+

Braintree will apply these properties if they do not exist on the given options:

+
    +
  • apikey
  • +
  • externalClientId
  • +
  • settings.payment.cardBrands
  • +
+

Braintree will overwrite settings.dataLevel = 'FULL' to access the full payment method.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

The base initOptions that will be used to init Visa Checkout.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
apikey + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The API key used to initialize Visa Checkout. When not supplied, Braintree will set this property.

+ +
externalClientId + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The external client ID key used to initialize Visa Checkout. When not supplied, Braintree will set this property.

+ +
settings + + + + object + + + + + + + + + <optional>
+ + + + + +
+

The settings object used to initialize Visa Checkout.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
dataLevel + + + + string + + + + + + + + + <optional>
+ + + + + +
+

The data level used to initialize Visa Checkout. Braintree will overwrite this property to 'FULL'.

+ +
payment + + + + object + + + + + + + + + <optional>
+ + + + + +
+

The payment object used to initialize Visa Checkout.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
cardBrands + + + + Array.<string> + + + + + + + + + <optional>
+ + + + + +
+

The card brands that Visa Checkout will allow the customer to pay with. When not supplied, Braintree will set this property.

+ +
+ + +
+ + +
+ + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ teardown(callbackopt) → {Promise|void} +

+
+ + + + + +
+

Cleanly tear down anything set up by create.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

Called once teardown is complete. No data is returned if teardown completes successfully.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
visaCheckoutInstance.teardown();
+ +

+ With callback +

+ + +
visaCheckoutInstance.teardown(function () {
+  // teardown is complete
+});
+ + +
+ + + + + + + + + + + + + + +

+ tokenize(payment, callbackopt) → {Promise|void} +

+
+ + + + + +
+

Tokenizes the Visa Checkout payload, returning a payment method nonce.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
payment + + + + object + + + + + + + + + + + + + +

The object that Visa Checkout supplies on payment.success.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
callid + + + + string + + + + + + + +

Visa Checkout transaction ID associated with this payment.

+ +
encKey + + + + string + + + + + + + +

The encrypted key used to decrypt the payment data.

+ +
encPaymentData + + + + string + + + + + + + +

The encrypted payment data.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, tokenizePayload is a tokenizePayload. If no callback is provided, tokenize returns a promise that resolves with the tokenizePayload.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ Address :object +

+
+ + + + + +
+

Visa Checkout Address object.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
countryCode + + + + string + + + + + + + +

The customer's country code.

+
extendedAddress + + + + string + + + + + + + +

The customer's extended address.

+
firstName + + + + string + + + + + + + +

The customer's first name.

+
lastName + + + + string + + + + + + + +

The customer's last name.

+
locality + + + + string + + + + + + + +

The customer's locality.

+
postalCode + + + + string + + + + + + + +

The customer's postal code.

+
region + + + + string + + + + + + + +

The customer's region.

+
streetAddress + + + + string + + + + + + + +

The customer's street address.

+
phoneNumber + + + + string + + + + + + + +

The customer's phone number.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ tokenizePayload :object +

+
+ + + + + +
+

Visa Checkout tokenize payload.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nonce + + + + string + + + + + + + +

The payment method nonce.

+
details + + + + object + + + + + + + +

Additional account details.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
cardType + + + + string + + + + + + + +

Type of card, ex: Visa, MasterCard.

+
lastFour + + + + string + + + + + + + +

Last four digits of card number.

+
lastTwo + + + + string + + + + + + + +

Last two digits of card number.

+
+ +
description + + + + string + + + + + + + +

A human-readable description.

+
type + + + + string + + + + + + + +

The payment method type, always VisaCheckoutCard.

+
billingAddress + + + + VisaCheckout~Address + + + + + + + +

The customer's billing address.

+
shippingAddress + + + + VisaCheckout~Address + + + + + + + +

The customer's shipping address.

+
userData + + + + VisaCheckout~UserData + + + + + + + +

Information about the customer.

+
binData + + + + object + + + + + + + +

Information about the card based on the bin.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
commercial + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
countryOfIssuance + + + + string + + + + + + + +

The country of issuance.

+
debit + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
durbinRegulated + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
healthcare + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
issuingBank + + + + string + + + + + + + +

The issuing bank.

+
payroll + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
prepaid + + + + string + + + + + + + +

Possible values: 'Yes', 'No', 'Unknown'.

+
productId + + + + string + + + + + + + +

The product id.

+
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ UserData :object +

+
+ + + + + +
+

Visa Checkout UserData object.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
userEmail + + + + string + + + + + + + +

The customer's email address.

+
userFirstName + + + + string + + + + + + + +

The customer's first name.

+
userLastName + + + + string + + + + + + + +

The customer's last name.

+
userFullName + + + + string + + + + + + + +

The customer's full name.

+
userName + + + + string + + + + + + + +

The customer's username.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/american-express_american-express.js.html b/3.111.1/american-express_american-express.js.html new file mode 100644 index 00000000..8a2cab8e --- /dev/null +++ b/3.111.1/american-express_american-express.js.html @@ -0,0 +1,301 @@ + + + + + + + + + + + american-express/american-express.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ american-express/american-express.js +

+ + + + + +
+
+
"use strict";
+
+var BraintreeError = require("../lib/braintree-error");
+var errors = require("./errors");
+var assign = require("../lib/assign").assign;
+var methods = require("../lib/methods");
+var convertMethodsToError = require("../lib/convert-methods-to-error");
+var wrapPromise = require("@braintree/wrap-promise");
+
+/**
+ * @class
+ * @param {object} options Options
+ * @description <strong>You cannot use this constructor directly. Use {@link module:braintree-web/american-express.create|braintree.american-express.create} instead.</strong>
+ * @classdesc This class allows you use a nonce to interact with American Express Checkout. To accept American Express cards, use Hosted Fields.
+ */
+function AmericanExpress(options) {
+  this._client = options.client;
+}
+
+/**
+ * Gets the rewards balance associated with a Braintree nonce.
+ * @public
+ * @param {object} options Request options
+ * @param {string} options.nonce An existing Braintree nonce.
+ * @param {callback} [callback] The second argument, <code>data</code>, is the returned server data. If no callback is provided, `getRewardsBalance` returns a promise that resolves with the server data.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * var americanExpress = require('braintree-web/american-express');
+ *
+ * americanExpress.create({client: clientInstance}, function (createErr, americanExpressInstance) {
+ *   var options = {nonce: existingBraintreeNonce};
+ *   americanExpressInstance.getRewardsBalance(options, function (getErr, payload) {
+ *     if (getErr || payload.error) {
+ *       // Handle error
+ *       return;
+ *     }
+ *
+ *     console.log('Rewards amount: ' + payload.rewardsAmount);
+ *   });
+ * });
+ */
+AmericanExpress.prototype.getRewardsBalance = function (options) {
+  var nonce = options.nonce;
+  var data;
+
+  if (!nonce) {
+    return Promise.reject(
+      new BraintreeError({
+        type: errors.AMEX_NONCE_REQUIRED.type,
+        code: errors.AMEX_NONCE_REQUIRED.code,
+        message: "getRewardsBalance must be called with a nonce.",
+      })
+    );
+  }
+
+  data = assign(
+    {
+      _meta: { source: "american-express" },
+      paymentMethodNonce: nonce,
+    },
+    options
+  );
+
+  delete data.nonce;
+
+  return this._client
+    .request({
+      method: "get",
+      endpoint: "payment_methods/amex_rewards_balance",
+      data: data,
+    })
+    .catch(function (err) {
+      return Promise.reject(
+        new BraintreeError({
+          type: errors.AMEX_NETWORK_ERROR.type,
+          code: errors.AMEX_NETWORK_ERROR.code,
+          message:
+            "A network error occurred when getting the American Express rewards balance.",
+          details: {
+            originalError: err,
+          },
+        })
+      );
+    });
+};
+
+/**
+ * Gets the Express Checkout nonce profile given a nonce from American Express.
+ * @public
+ * @param {object} options Request options
+ * @param {string} options.nonce An existing nonce from American Express (note that this is <em>not</em> a nonce from Braintree).
+ * @param {callback} [callback] The second argument, <code>data</code>, is the returned server data. If no callback is provided, `getExpressCheckoutProfile` returns a promise that resolves with the server data.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * var americanExpress = require('braintree-web/american-express');
+ *
+ * americanExpress.create({client: clientInstance}, function (createErr, americanExpressInstance) {
+ *   var options = {nonce: existingAmericanExpressNonce};
+ *   americanExpressInstance.getExpressCheckoutProfile(options, function (getErr, payload) {
+ *     if (getErr) {
+ *       // Handle error
+ *       return;
+ *     }
+ *
+ *     console.log('Number of cards: ' + payload.amexExpressCheckoutCards.length);
+ *   });
+ * });
+ */
+AmericanExpress.prototype.getExpressCheckoutProfile = function (options) {
+  if (!options.nonce) {
+    return Promise.reject(
+      new BraintreeError({
+        type: errors.AMEX_NONCE_REQUIRED.type,
+        code: errors.AMEX_NONCE_REQUIRED.code,
+        message: "getExpressCheckoutProfile must be called with a nonce.",
+      })
+    );
+  }
+
+  return this._client
+    .request({
+      method: "get",
+      endpoint: "payment_methods/amex_express_checkout_cards/" + options.nonce,
+      data: {
+        _meta: { source: "american-express" },
+        paymentMethodNonce: options.nonce,
+      },
+    })
+    .catch(function (err) {
+      return Promise.reject(
+        new BraintreeError({
+          type: errors.AMEX_NETWORK_ERROR.type,
+          code: errors.AMEX_NETWORK_ERROR.code,
+          message:
+            "A network error occurred when getting the American Express Checkout nonce profile.",
+          details: {
+            originalError: err,
+          },
+        })
+      );
+    });
+};
+
+/**
+ * Cleanly tear down anything set up by {@link module:braintree-web/american-express.create|create}.
+ * @public
+ * @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
+ * @example
+ * americanExpressInstance.teardown();
+ * @example <caption>With callback</caption>
+ * americanExpressInstance.teardown(function () {
+ *   // teardown is complete
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+AmericanExpress.prototype.teardown = function () {
+  convertMethodsToError(this, methods(AmericanExpress.prototype));
+
+  return Promise.resolve();
+};
+
+module.exports = wrapPromise.wrapPrototype(AmericanExpress);
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/american-express_errors.js.html b/3.111.1/american-express_errors.js.html new file mode 100644 index 00000000..1985b00c --- /dev/null +++ b/3.111.1/american-express_errors.js.html @@ -0,0 +1,167 @@ + + + + + + + + + + + american-express/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ american-express/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.American Express - getRewardsBalance Error Codes
+ * @description Errors that occur when creating components.
+ * @property {MERCHANT} AMEX_NONCE_REQUIRED Occurs when a nonce is not provided to method.
+ * @property {NETWORK} AMEX_NETWORK_ERROR Occurs when there is an error communicating with the Braintree gateway.
+ */
+
+/**
+ * @name BraintreeError.American Express - getExpressCheckoutProfile Error Codes
+ * @description Errors that occur when creating components.
+ * @property {MERCHANT} AMEX_NONCE_REQUIRED Occurs when a nonce is not provided to method.
+ * @property {NETWORK} AMEX_NETWORK_ERROR Occurs when there is an error communicating with the Braintree gateway.
+ */
+
+var BraintreeError = require("../lib/braintree-error");
+
+module.exports = {
+  AMEX_NONCE_REQUIRED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "AMEX_NONCE_REQUIRED",
+  },
+  AMEX_NETWORK_ERROR: {
+    type: BraintreeError.types.NETWORK,
+    code: "AMEX_NETWORK_ERROR",
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/american-express_index.js.html b/3.111.1/american-express_index.js.html new file mode 100644 index 00000000..46ad1015 --- /dev/null +++ b/3.111.1/american-express_index.js.html @@ -0,0 +1,194 @@ + + + + + + + + + + + american-express/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ american-express/index.js +

+ + + + + +
+
+
"use strict";
+/**
+ * @module braintree-web/american-express
+ * @description This module is for use with Amex Express Checkout. To accept American Express cards, use Hosted Fields.
+ */
+
+var AmericanExpress = require("./american-express");
+var basicComponentVerification = require("../lib/basic-component-verification");
+var createDeferredClient = require("../lib/create-deferred-client");
+var createAssetsUrl = require("../lib/create-assets-url");
+var VERSION = process.env.npm_package_version;
+var wrapPromise = require("@braintree/wrap-promise");
+
+/**
+ * @static
+ * @function create
+ * @param {object} options Creation options:
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {callback} [callback] The second argument, `data`, is the {@link AmericanExpress} instance. If no callback is provided, `create` returns a promise that resolves with the {@link AmericanExpress} instance.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+function create(options) {
+  var name = "American Express";
+
+  return basicComponentVerification
+    .verify({
+      name: name,
+      client: options.client,
+      authorization: options.authorization,
+    })
+    .then(function () {
+      return createDeferredClient.create({
+        authorization: options.authorization,
+        client: options.client,
+        debug: options.debug,
+        assetsUrl: createAssetsUrl.create(options.authorization),
+        name: name,
+      });
+    })
+    .then(function (client) {
+      options.client = client;
+
+      return new AmericanExpress(options);
+    });
+}
+
+module.exports = {
+  create: wrapPromise(create),
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/apple-pay_apple-pay.js.html b/3.111.1/apple-pay_apple-pay.js.html new file mode 100644 index 00000000..1d01d346 --- /dev/null +++ b/3.111.1/apple-pay_apple-pay.js.html @@ -0,0 +1,535 @@ + + + + + + + + + + + apple-pay/apple-pay.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ apple-pay/apple-pay.js +

+ + + + + +
+
+
"use strict";
+
+var BraintreeError = require("../lib/braintree-error");
+var analytics = require("../lib/analytics");
+var errors = require("./errors");
+var methods = require("../lib/methods");
+var convertMethodsToError = require("../lib/convert-methods-to-error");
+var wrapPromise = require("@braintree/wrap-promise");
+
+/**
+ * @typedef {object} ApplePay~tokenizePayload
+ * @property {string} nonce The payment method nonce.
+ * @property {object} details Additional details.
+ * @property {string} details.cardType Type of card, ex: Visa, MasterCard.
+ * @property {string} details.cardHolderName The name of the card holder.
+ * @property {string} details.dpanLastTwo Last two digits of card number.
+ * @property {string} description A human-readable description.
+ * @property {string} type The payment method type, always `ApplePayCard`.
+ * @property {object} binData Information about the card based on the bin.
+ * @property {string} binData.commercial Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.countryOfIssuance The country of issuance.
+ * @property {string} binData.debit Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.durbinRegulated Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.healthcare Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.issuingBank The issuing bank.
+ * @property {string} binData.payroll Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.prepaid Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.productId The product id.
+ */
+
+/**
+ * An Apple Pay Payment Authorization Event object.
+ * @typedef {object} ApplePayPaymentAuthorizedEvent
+ * @external ApplePayPaymentAuthorizedEvent
+ * @see {@link https://developer.apple.com/reference/applepayjs/applepaypaymentauthorizedevent ApplePayPaymentAuthorizedEvent}
+ */
+
+/**
+ * An Apple Pay Payment Request object.
+ * @typedef {object} ApplePayPaymentRequest
+ * @external ApplePayPaymentRequest
+ * @see {@link https://developer.apple.com/reference/applepayjs/1916082-applepay_js_data_types/paymentrequest PaymentRequest}
+ */
+
+/**
+ * @class
+ * @param {object} options Options
+ * @description <strong>You cannot use this constructor directly. Use {@link module:braintree-web/apple-pay.create|braintree.applePay.create} instead.</strong>
+ * @classdesc This class represents an Apple Pay component. Instances of this class have methods for validating the merchant server and tokenizing payments.
+ */
+function ApplePay(options) {
+  this._instantiatedWithClient = Boolean(!options.useDeferredClient);
+  this._client = options.client;
+  this._createPromise = options.createPromise;
+
+  if (this._client) {
+    this._setMerchantIdentifier();
+  }
+}
+
+ApplePay.prototype._waitForClient = function () {
+  if (this._client) {
+    return Promise.resolve();
+  }
+
+  return this._createPromise.then(
+    function (client) {
+      this._client = client;
+
+      this._setMerchantIdentifier();
+    }.bind(this)
+  );
+};
+
+ApplePay.prototype._setMerchantIdentifier = function () {
+  var applePayConfig =
+    this._client.getConfiguration().gatewayConfiguration.applePayWeb;
+
+  if (!applePayConfig) {
+    return;
+  }
+  /**
+   * @name ApplePay#merchantIdentifier
+   * @description A special merchant ID which represents the merchant association with Braintree. Required when using `ApplePaySession.canMakePaymentsWithActiveCard`.
+   * @example
+   * var promise = ApplePaySession.canMakePaymentsWithActiveCard(applePayInstance.merchantIdentifier);
+   * promise.then(function (canMakePaymentsWithActiveCard) {
+   *   if (canMakePaymentsWithActiveCard) {
+   *     // Set up Apple Pay buttons
+   *   }
+   * });
+   */
+  Object.defineProperty(this, "merchantIdentifier", {
+    value: applePayConfig.merchantIdentifier,
+    configurable: false,
+    writable: false,
+  });
+};
+
+/**
+ * Merges a payment request with Braintree defaults to return an {external:ApplePayPaymentRequest}.
+ *
+ * The following properties are assigned to `paymentRequest` if not already defined. Their default values come from the Braintree gateway.
+ * - `countryCode`
+ * - `currencyCode`
+ * - `merchantCapabilities`
+ * - `supportedNetworks`
+ * @public
+ * @param {external:ApplePayPaymentRequest} paymentRequest The payment request details to apply on top of those from Braintree.
+ * @returns {external:ApplePayPaymentRequest|Promise} The decorated `paymentRequest` object. If `useDeferredClient` is used along with an `authorization`, this method will return a promise that resolves with the `paymentRequest` object.
+ * @example
+ * var applePay = require('braintree-web/apple-pay');
+ *
+ * applePay.create({client: clientInstance}, function (applePayErr, applePayInstance) {
+ *   if (applePayErr) {
+ *     // Handle error here
+ *     return;
+ *   }
+ *
+ *   var paymentRequest = applePayInstance.createPaymentRequest({
+ *     total: {
+ *       label: 'My Company',
+ *       amount: '19.99'
+ *     }
+ *   });
+ *
+ *   var session = new ApplePaySession(3, paymentRequest);
+ *
+ *   // ...
+ * @example <caption>With deferred client</caption>
+ * var applePay = require('braintree-web/apple-pay');
+ *
+ * applePay.create({
+ *   authorization: 'client-token-or-tokenization-key',
+ *   useDeferredClient: true
+ * }, function (applePayErr, applePayInstance) {
+ *   if (applePayErr) {
+ *     // Handle error here
+ *     return;
+ *   }
+ *
+ *   applePayInstance.createPaymentRequest({
+ *     total: {
+ *       label: 'My Company',
+ *       amount: '19.99'
+ *     }
+ *   }).then(function (paymentRequest) {
+ *     var session = new ApplePaySession(3, paymentRequest);
+ *
+ *     // ...
+ *   });
+ */
+ApplePay.prototype.createPaymentRequest = function (paymentRequest) {
+  if (this._instantiatedWithClient) {
+    return this._createPaymentRequestSynchronously(paymentRequest);
+  }
+
+  return this._waitForClient().then(
+    function () {
+      return this._createPaymentRequestSynchronously(paymentRequest);
+    }.bind(this)
+  );
+};
+
+ApplePay.prototype._createPaymentRequestSynchronously = function (
+  paymentRequest
+) {
+  var applePay =
+    this._client.getConfiguration().gatewayConfiguration.applePayWeb;
+  var defaults = {
+    countryCode: applePay.countryCode,
+    currencyCode: applePay.currencyCode,
+    merchantCapabilities: applePay.merchantCapabilities || ["supports3DS"],
+    supportedNetworks: applePay.supportedNetworks.map(function (network) {
+      return network === "mastercard" ? "masterCard" : network;
+    }),
+  };
+
+  return Object.assign({}, defaults, paymentRequest);
+};
+
+/**
+ * Validates your merchant website, as required by `ApplePaySession` before payment can be authorized.
+ * @public
+ * @param {object} options Options
+ * @param {string} options.validationURL The validationURL from an `ApplePayValidateMerchantEvent`.
+ * @param {string} options.displayName The canonical name for your store. Use a non-localized name. This parameter should be a UTF-8 string that is a maximum of 64 characters. The system may display this name to the user.
+ * @param {callback} [callback] The second argument, <code>data</code>, is the Apple Pay merchant session object. If no callback is provided, `performValidation` returns a promise.
+ * Pass the merchant session to your Apple Pay session's `completeMerchantValidation` method.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * var applePay = require('braintree-web/apple-pay');
+ *
+ * applePay.create({client: clientInstance}, function (applePayErr, applePayInstance) {
+ *   if (applePayErr) {
+ *     // Handle error here
+ *     return;
+ *   }
+ *
+ *   var paymentRequest = applePayInstance.createPaymentRequest({
+ *     total: {
+ *       label: 'My Company',
+ *       amount: '19.99'
+ *     }
+ *   });
+ *   var session = new ApplePaySession(3, paymentRequest);
+ *
+ *   session.onvalidatemerchant = function (event) {
+ *     applePayInstance.performValidation({
+ *       validationURL: event.validationURL,
+ *       displayName: 'My Great Store'
+ *     }, function (validationErr, validationData) {
+ *       if (validationErr) {
+ *         console.error(validationErr);
+ *         session.abort();
+ *         return;
+ *       }
+ *
+ *       session.completeMerchantValidation(validationData);
+ *     });
+ *   };
+ * });
+ */
+ApplePay.prototype.performValidation = function (options) {
+  var self = this;
+
+  if (!options || !options.validationURL) {
+    return Promise.reject(
+      new BraintreeError(errors.APPLE_PAY_VALIDATION_URL_REQUIRED)
+    );
+  }
+
+  return this._waitForClient()
+    .then(function () {
+      var applePayWebSession = {
+        validationUrl: options.validationURL,
+        domainName: options.domainName || window.location.hostname,
+        merchantIdentifier:
+          options.merchantIdentifier || self.merchantIdentifier,
+      };
+
+      if (options.displayName != null) {
+        applePayWebSession.displayName = options.displayName;
+      }
+
+      return self._client.request({
+        method: "post",
+        endpoint: "apple_pay_web/sessions",
+        data: {
+          _meta: { source: "apple-pay" },
+          applePayWebSession: applePayWebSession,
+        },
+      });
+    })
+    .then(function (response) {
+      analytics.sendEvent(self._client, "applepay.performValidation.succeeded");
+
+      return Promise.resolve(response);
+    })
+    .catch(function (err) {
+      analytics.sendEvent(self._client, "applepay.performValidation.failed");
+
+      if (err.code === "CLIENT_REQUEST_ERROR") {
+        return Promise.reject(
+          new BraintreeError({
+            type: errors.APPLE_PAY_MERCHANT_VALIDATION_FAILED.type,
+            code: errors.APPLE_PAY_MERCHANT_VALIDATION_FAILED.code,
+            message: errors.APPLE_PAY_MERCHANT_VALIDATION_FAILED.message,
+            details: {
+              originalError: err.details.originalError,
+            },
+          })
+        );
+      }
+
+      return Promise.reject(
+        new BraintreeError({
+          type: errors.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.type,
+          code: errors.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.code,
+          message: errors.APPLE_PAY_MERCHANT_VALIDATION_NETWORK.message,
+          details: {
+            originalError: err,
+          },
+        })
+      );
+    });
+};
+
+/**
+ * Tokenizes an Apple Pay payment. This will likely be called in your `ApplePaySession`'s `onpaymentauthorized` callback.
+ * @public
+ * @param {object} options Options
+ * @param {object} options.token The `payment.token` property of an {@link external:ApplePayPaymentAuthorizedEvent}.
+ * @param {callback} [callback] The second argument, <code>data</code>, is a {@link ApplePay~tokenizePayload|tokenizePayload}. If no callback is provided, `tokenize` returns a promise that resolves with a {@link ApplePay~tokenizePayload|tokenizePayload}.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * var applePay = require('braintree-web/apple-pay');
+ *
+ * applePay.create({client: clientInstance}, function (applePayErr, applePayInstance) {
+ *   if (applePayErr) {
+ *     // Handle error here
+ *     return;
+ *   }
+ *
+ *   var paymentRequest = applePayInstance.createPaymentRequest({
+ *     total: {
+ *       label: 'My Company',
+ *       amount: '19.99'
+ *     }
+ *   });
+ *   var session = new ApplePaySession(3, paymentRequest);
+ *
+ *   session.onpaymentauthorized = function (event) {
+ *     applePayInstance.tokenize({
+ *       token: event.payment.token
+ *     }, function (tokenizeErr, tokenizedPayload) {
+ *       if (tokenizeErr) {
+ *         session.completePayment(ApplePaySession.STATUS_FAILURE);
+ *         return;
+ *       }
+ *       // Send the tokenizedPayload to your server here!
+ *
+ *       // Once the transaction is complete, call completePayment
+ *       // to close the Apple Pay sheet
+ *       session.completePayment(ApplePaySession.STATUS_SUCCESS);
+ *     });
+ *   };
+ *
+ *   // ...
+ * });
+ */
+ApplePay.prototype.tokenize = function (options) {
+  var self = this;
+
+  if (!options.token) {
+    return Promise.reject(
+      new BraintreeError(errors.APPLE_PAY_PAYMENT_TOKEN_REQUIRED)
+    );
+  }
+
+  return this._waitForClient()
+    .then(function () {
+      return self._client.request({
+        method: "post",
+        endpoint: "payment_methods/apple_payment_tokens",
+        data: {
+          _meta: {
+            source: "apple-pay",
+          },
+          applePaymentToken: Object.assign({}, options.token, {
+            // The gateway requires this key to be base64-encoded.
+            paymentData: btoa(JSON.stringify(options.token.paymentData)),
+          }),
+        },
+      });
+    })
+    .then(function (response) {
+      analytics.sendEvent(self._client, "applepay.tokenize.succeeded");
+
+      return Promise.resolve(response.applePayCards[0]);
+    })
+    .catch(function (err) {
+      analytics.sendEvent(self._client, "applepay.tokenize.failed");
+
+      return Promise.reject(
+        new BraintreeError({
+          type: errors.APPLE_PAY_TOKENIZATION.type,
+          code: errors.APPLE_PAY_TOKENIZATION.code,
+          message: errors.APPLE_PAY_TOKENIZATION.message,
+          details: {
+            originalError: err,
+          },
+        })
+      );
+    });
+};
+
+/**
+ * Cleanly tear down anything set up by {@link module:braintree-web/apple-pay.create|create}.
+ * @public
+ * @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
+ * @example
+ * applePayInstance.teardown();
+ * @example <caption>With callback</caption>
+ * applePayInstance.teardown(function () {
+ *   // teardown is complete
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+ApplePay.prototype.teardown = function () {
+  convertMethodsToError(this, methods(ApplePay.prototype));
+
+  return Promise.resolve();
+};
+
+module.exports = wrapPromise.wrapPrototype(ApplePay);
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/apple-pay_errors.js.html b/3.111.1/apple-pay_errors.js.html new file mode 100644 index 00000000..e1c803b1 --- /dev/null +++ b/3.111.1/apple-pay_errors.js.html @@ -0,0 +1,197 @@ + + + + + + + + + + + apple-pay/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ apple-pay/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.Apple Pay - Creation Error Codes
+ * @description Errors that occur when [creating the Apple Pay component](./module-braintree-web_apple-pay.html#.create).
+ * @property {MERCHANT} APPLE_PAY_NOT_ENABLED Occurs when the authorization used is not authorized to process Apple Pay.
+ */
+
+/**
+ * @name BraintreeError.Apple Pay - performValidation Error Codes
+ * @description Errors that occur when [validating](./ApplePay.html#performValidation).
+ * @property {MERCHANT} APPLE_PAY_VALIDATION_URL_REQUIRED Occurs when the `validationURL` option is not passed in.
+ * @property {MERCHANT} APPLE_PAY_MERCHANT_VALIDATION_FAILED Occurs when the website domain has not been registered in the Braintree control panel.
+ * @property {NETWORK} APPLE_PAY_MERCHANT_VALIDATION_NETWORK Occurs when an unknown network error occurs.
+ */
+
+/**
+ * @name BraintreeError.Apple Pay - tokenize Error Codes
+ * @description Errors that occur when [tokenizing](./ApplePay.html#tokenize).
+ * @property {MERCHANT} APPLE_PAY_PAYMENT_TOKEN_REQUIRED Occurs when the `token` option is not passed in.
+ * @property {NETWORK} APPLE_PAY_TOKENIZATION Occurs when an unknown network error occurs.
+ */
+
+var BraintreeError = require("../lib/braintree-error");
+
+module.exports = {
+  APPLE_PAY_NOT_ENABLED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "APPLE_PAY_NOT_ENABLED",
+    message: "Apple Pay is not enabled for this merchant.",
+  },
+  APPLE_PAY_VALIDATION_URL_REQUIRED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "APPLE_PAY_VALIDATION_URL_REQUIRED",
+    message: "performValidation must be called with a validationURL.",
+  },
+  APPLE_PAY_MERCHANT_VALIDATION_NETWORK: {
+    type: BraintreeError.types.NETWORK,
+    code: "APPLE_PAY_MERCHANT_VALIDATION_NETWORK",
+    message: "A network error occurred when validating the Apple Pay merchant.",
+  },
+  APPLE_PAY_MERCHANT_VALIDATION_FAILED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "APPLE_PAY_MERCHANT_VALIDATION_FAILED",
+    message:
+      "Make sure you have registered your domain name in the Braintree Control Panel.",
+  },
+  APPLE_PAY_PAYMENT_TOKEN_REQUIRED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "APPLE_PAY_PAYMENT_TOKEN_REQUIRED",
+    message: "tokenize must be called with a payment token.",
+  },
+  APPLE_PAY_TOKENIZATION: {
+    type: BraintreeError.types.NETWORK,
+    code: "APPLE_PAY_TOKENIZATION",
+    message: "A network error occurred when processing the Apple Pay payment.",
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/apple-pay_index.js.html b/3.111.1/apple-pay_index.js.html new file mode 100644 index 00000000..58d2badf --- /dev/null +++ b/3.111.1/apple-pay_index.js.html @@ -0,0 +1,220 @@ + + + + + + + + + + + apple-pay/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ apple-pay/index.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @module braintree-web/apple-pay
+ * @description Accept Apple Pay on the Web. *This component is currently in beta and is subject to change.*
+ */
+
+var ApplePay = require("./apple-pay");
+var analytics = require("../lib/analytics");
+var BraintreeError = require("../lib/braintree-error");
+var basicComponentVerification = require("../lib/basic-component-verification");
+var createAssetsUrl = require("../lib/create-assets-url");
+var createDeferredClient = require("../lib/create-deferred-client");
+var errors = require("./errors");
+var VERSION = process.env.npm_package_version;
+var wrapPromise = require("@braintree/wrap-promise");
+
+/**
+ * @static
+ * @function create
+ * @param {object} options Creation options:
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {boolean} [options.useDeferredClient] Used in conjunction with `authorization`, allows the Apple Pay instance to be available right away by fetching the client configuration in the background. When this option is used, {@link ApplePay#createPaymentRequest} will return a promise that resolves with the configuration instead of returning synchronously.
+ * @param {callback} [callback] The second argument, `data`, is the {@link ApplePay} instance. If no callback is provided, `create` returns a promise that resolves with the {@link ApplePay} instance.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+function create(options) {
+  var name = "Apple Pay";
+
+  return basicComponentVerification
+    .verify({
+      name: name,
+      client: options.client,
+      authorization: options.authorization,
+    })
+    .then(function () {
+      var applePayInstance;
+      var createPromise = createDeferredClient
+        .create({
+          authorization: options.authorization,
+          client: options.client,
+          debug: options.debug,
+          assetsUrl: createAssetsUrl.create(options.authorization),
+          name: name,
+        })
+        .then(function (client) {
+          if (!client.getConfiguration().gatewayConfiguration.applePayWeb) {
+            return Promise.reject(
+              new BraintreeError(errors.APPLE_PAY_NOT_ENABLED)
+            );
+          }
+
+          analytics.sendEvent(client, "applepay.initialized");
+
+          return client;
+        });
+
+      options.createPromise = createPromise;
+      applePayInstance = new ApplePay(options);
+
+      if (!options.useDeferredClient) {
+        return createPromise.then(function (client) {
+          applePayInstance._client = client;
+
+          return applePayInstance;
+        });
+      }
+
+      return applePayInstance;
+    });
+}
+
+module.exports = {
+  create: wrapPromise(create),
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/client_client.js.html b/3.111.1/client_client.js.html new file mode 100644 index 00000000..1654e5ee --- /dev/null +++ b/3.111.1/client_client.js.html @@ -0,0 +1,644 @@ + + + + + + + + + + + client/client.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ client/client.js +

+ + + + + +
+
+
"use strict";
+
+var BRAINTREE_VERSION = require("./constants").BRAINTREE_VERSION;
+
+var GraphQL = require("./request/graphql");
+var request = require("./request");
+var isVerifiedDomain = require("../lib/is-verified-domain");
+var BraintreeError = require("../lib/braintree-error");
+var convertToBraintreeError = require("../lib/convert-to-braintree-error");
+var getGatewayConfiguration = require("./get-configuration").getConfiguration;
+var createAuthorizationData = require("../lib/create-authorization-data");
+var metadata = require("../lib/add-metadata");
+var wrapPromise = require("@braintree/wrap-promise");
+var once = require("../lib/once");
+var deferred = require("../lib/deferred");
+var assign = require("../lib/assign").assign;
+var analytics = require("../lib/analytics");
+var errors = require("./errors");
+var VERSION = require("../lib/constants").VERSION;
+var GRAPHQL_URLS = require("../lib/constants").GRAPHQL_URLS;
+var methods = require("../lib/methods");
+var convertMethodsToError = require("../lib/convert-methods-to-error");
+var assets = require("../lib/assets");
+var FRAUDNET_FNCLS = require("../lib/constants").FRAUDNET_FNCLS;
+var FRAUDNET_SOURCE = require("../lib/constants").FRAUDNET_SOURCE;
+var FRAUDNET_URL = require("../lib/constants").FRAUDNET_URL;
+
+var cachedClients = {};
+
+/**
+ * This object is returned by {@link Client#getConfiguration|getConfiguration}. This information is used extensively by other Braintree modules to properly configure themselves.
+ * @typedef {object} Client~configuration
+ * @property {object} client The braintree-web/client parameters.
+ * @property {string} client.authorization A tokenizationKey or clientToken.
+ * @property {object} gatewayConfiguration Gateway-supplied configuration.
+ * @property {object} analyticsMetadata Analytics-specific data.
+ * @property {string} analyticsMetadata.sessionId Uniquely identifies a browsing session.
+ * @property {string} analyticsMetadata.sdkVersion The braintree.js version.
+ * @property {string} analyticsMetadata.merchantAppId Identifies the merchant's web app.
+ */
+
+/**
+ * @class
+ * @param {Client~configuration} configuration Options
+ * @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/client.create|braintree.client.create} instead.</strong>
+ * @classdesc This class is required by many other Braintree components. It serves as the base API layer that communicates with our servers. It is also capable of being used to formulate direct calls to our servers, such as direct credit card tokenization. See {@link Client#request}.
+ */
+function Client(configuration) {
+  var configurationJSON, gatewayConfiguration;
+
+  configuration = configuration || {};
+
+  configurationJSON = JSON.stringify(configuration);
+  gatewayConfiguration = configuration.gatewayConfiguration;
+
+  if (!gatewayConfiguration) {
+    throw new BraintreeError(errors.CLIENT_MISSING_GATEWAY_CONFIGURATION);
+  }
+
+  ["assetsUrl", "clientApiUrl", "configUrl"].forEach(function (property) {
+    if (
+      property in gatewayConfiguration &&
+      !isVerifiedDomain(gatewayConfiguration[property])
+    ) {
+      throw new BraintreeError({
+        type: errors.CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN.type,
+        code: errors.CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN.code,
+        message: property + " property is on an invalid domain.",
+      });
+    }
+  });
+
+  /**
+   * Returns a copy of the configuration values.
+   * @public
+   * @returns {Client~configuration} configuration
+   */
+  this.getConfiguration = function () {
+    return JSON.parse(configurationJSON);
+  };
+
+  this._request = request;
+  this._configuration = this.getConfiguration();
+
+  this._clientApiBaseUrl = gatewayConfiguration.clientApiUrl + "/v1/";
+
+  if (gatewayConfiguration.graphQL) {
+    if (!isVerifiedDomain(gatewayConfiguration.graphQL.url)) {
+      throw new BraintreeError({
+        type: errors.CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN.type,
+        code: errors.CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN.code,
+        message: "graphQL.url property is on an invalid domain.",
+      });
+    }
+
+    this._graphQL = new GraphQL({
+      graphQL: gatewayConfiguration.graphQL,
+    });
+  }
+}
+
+Client.initialize = function (options) {
+  var clientInstance, authData;
+  var promise = cachedClients[options.authorization];
+
+  if (promise) {
+    analytics.sendEvent(promise, "custom.client.load.cached");
+
+    return promise;
+  }
+
+  try {
+    authData = createAuthorizationData(options.authorization);
+  } catch (err) {
+    return Promise.reject(
+      new BraintreeError(errors.CLIENT_INVALID_AUTHORIZATION)
+    );
+  }
+
+  promise = getGatewayConfiguration(authData, options.sessionId).then(function (
+    configuration
+  ) {
+    if (options.debug) {
+      configuration.isDebug = true;
+    }
+
+    configuration.authorization = options.authorization;
+
+    clientInstance = new Client(configuration);
+
+    return clientInstance;
+  });
+
+  cachedClients[options.authorization] = promise;
+
+  analytics.sendEvent(promise, "custom.client.load.initialized");
+
+  return promise
+    .then(function (client) {
+      analytics.sendEvent(clientInstance, "custom.client.load.succeeded");
+
+      return client;
+    })
+    .catch(function (err) {
+      delete cachedClients[options.authorization];
+
+      return Promise.reject(err);
+    });
+};
+
+// Primarily used for testing the client initalization call
+Client.clearCache = function () {
+  cachedClients = {};
+};
+
+Client.prototype._findOrCreateFraudnetJSON = function (clientMetadataId) {
+  var el = document.querySelector('script[fncls="' + FRAUDNET_FNCLS + '"]');
+  var config, additionalData, authorizationFingerprint, parameters;
+
+  if (!el) {
+    el = document.body.appendChild(document.createElement("script"));
+    el.type = "application/json";
+    el.setAttribute("fncls", FRAUDNET_FNCLS);
+  }
+
+  config = this.getConfiguration();
+  additionalData = {
+    rda_tenant: "bt_card", // eslint-disable-line camelcase
+    mid: config.gatewayConfiguration.merchantId,
+  };
+  authorizationFingerprint = config.authorizationFingerprint;
+
+  if (authorizationFingerprint) {
+    authorizationFingerprint.split("&").forEach(function (pieces) {
+      var component = pieces.split("=");
+
+      if (component[0] === "customer_id" && component.length > 1) {
+        additionalData.cid = component[1];
+      }
+    });
+  }
+
+  parameters = {
+    f: clientMetadataId.substr(0, 32),
+    fp: additionalData,
+    bu: false,
+    s: FRAUDNET_SOURCE,
+  };
+  el.text = JSON.stringify(parameters);
+};
+
+/**
+ * Used by other modules to formulate all network requests to the Braintree gateway. It is also capable of being used directly from your own form to tokenize credit card information. However, be sure to satisfy PCI compliance if you use direct card tokenization.
+ * @public
+ * @param {object} options Request options:
+ * @param {string} options.method HTTP method, e.g. "get" or "post".
+ * @param {string} options.endpoint Endpoint path, e.g. "payment_methods".
+ * @param {object} options.data Data to send with the request.
+ * @param {number} [options.timeout=60000] Set a timeout (in milliseconds) for the request.
+ * @param {callback} [callback] The second argument, <code>data</code>, is the returned server data.
+ * @example
+ * <caption>Direct Credit Card Tokenization</caption>
+ * var createClient = require('braintree-web/client').create;
+ *
+ * createClient({
+ *   authorization: CLIENT_AUTHORIZATION
+ * }, function (createErr, clientInstance) {
+ *   var form = document.getElementById('my-form-id');
+ *   var data = {
+ *     creditCard: {
+ *       number: form['cc-number'].value,
+ *       cvv: form['cc-cvv'].value,
+ *       expirationDate: form['cc-expiration-date'].value,
+ *       billingAddress: {
+ *         postalCode: form['cc-postal-code'].value
+ *       },
+ *       options: {
+ *         validate: false
+ *       }
+ *     }
+ *   };
+ *
+ *   // Warning: For a merchant to be eligible for the easiest level of PCI compliance (SAQ A),
+ *   // payment fields cannot be hosted on your checkout page.
+ *   // For an alternative to the following, use Hosted Fields.
+ *   clientInstance.request({
+ *     endpoint: 'payment_methods/credit_cards',
+ *     method: 'post',
+ *     data: data
+ *   }, function (requestErr, response) {
+ *     // More detailed example of handling API errors: https://codepen.io/braintree/pen/MbwjdM
+ *     if (requestErr) { throw new Error(requestErr); }
+ *
+ *     console.log('Got nonce:', response.creditCards[0].nonce);
+ *   });
+ * });
+ * @example
+ * <caption>Tokenizing Fields for AVS Checks</caption>
+ * var createClient = require('braintree-web/client').create;
+ *
+ * createClient({
+ *   authorization: CLIENT_AUTHORIZATION
+ * }, function (createErr, clientInstance) {
+ *   var form = document.getElementById('my-form-id');
+ *   var data = {
+ *     creditCard: {
+ *       number: form['cc-number'].value,
+ *       cvv: form['cc-cvv'].value,
+ *       expirationDate: form['cc-date'].value,
+ *       // The billing address can be checked with AVS rules.
+ *       // See: https://articles.braintreepayments.com/support/guides/fraud-tools/basic/avs-cvv-rules
+ *       billingAddress: {
+ *         postalCode: form['cc-postal-code'].value,
+ *         streetAddress: form['cc-street-address'].value,
+ *         countryName: form['cc-country-name'].value,
+ *         countryCodeAlpha2: form['cc-country-alpha2'].value,
+ *         countryCodeAlpha3: form['cc-country-alpha3'].value,
+ *         countryCodeNumeric: form['cc-country-numeric'].value
+ *       },
+ *       options: {
+ *         validate: false
+ *       }
+ *     }
+ *   };
+ *
+ *   // Warning: For a merchant to be eligible for the easiest level of PCI compliance (SAQ A),
+ *   // payment fields cannot be hosted on your checkout page.
+ *   // For an alternative to the following, use Hosted Fields.
+ *   clientInstance.request({
+ *     endpoint: 'payment_methods/credit_cards',
+ *     method: 'post',
+ *     data: data
+ *   }, function (requestErr, response) {
+ *     // More detailed example of handling API errors: https://codepen.io/braintree/pen/MbwjdM
+ *     if (requestErr) { throw new Error(requestErr); }
+ *
+ *     console.log('Got nonce:', response.creditCards[0].nonce);
+ *   });
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+Client.prototype.request = function (options, callback) {
+  var self = this; // eslint-disable-line no-invalid-this
+  var requestPromise = new Promise(function (resolve, reject) {
+    var optionName, api, baseUrl, requestOptions;
+    var shouldCollectData = Boolean(
+      options.endpoint === "payment_methods/credit_cards" &&
+        self.getConfiguration().gatewayConfiguration.creditCards
+          .collectDeviceData
+    );
+
+    if (options.api !== "graphQLApi") {
+      if (!options.method) {
+        optionName = "options.method";
+      } else if (!options.endpoint) {
+        optionName = "options.endpoint";
+      }
+    }
+
+    if (optionName) {
+      throw new BraintreeError({
+        type: errors.CLIENT_OPTION_REQUIRED.type,
+        code: errors.CLIENT_OPTION_REQUIRED.code,
+        message: optionName + " is required when making a request.",
+      });
+    }
+
+    if ("api" in options) {
+      api = options.api;
+    } else {
+      api = "clientApi";
+    }
+
+    requestOptions = {
+      method: options.method,
+      graphQL: self._graphQL,
+      timeout: options.timeout,
+      metadata: self._configuration.analyticsMetadata,
+    };
+
+    if (api === "clientApi") {
+      baseUrl = self._clientApiBaseUrl;
+
+      requestOptions.data = metadata.addMetadata(
+        self._configuration,
+        options.data
+      );
+    } else if (api === "graphQLApi") {
+      baseUrl =
+        GRAPHQL_URLS[self._configuration.gatewayConfiguration.environment];
+      options.endpoint = "";
+      requestOptions.method = "post";
+      requestOptions.data = assign(
+        {
+          clientSdkMetadata: {
+            platform: self._configuration.analyticsMetadata.platform,
+            source: self._configuration.analyticsMetadata.source,
+            integration: self._configuration.analyticsMetadata.integration,
+            sessionId: self._configuration.analyticsMetadata.sessionId,
+            version: VERSION,
+          },
+        },
+        options.data
+      );
+
+      requestOptions.headers = getAuthorizationHeadersForGraphQL(
+        self._configuration
+      );
+    } else {
+      throw new BraintreeError({
+        type: errors.CLIENT_OPTION_INVALID.type,
+        code: errors.CLIENT_OPTION_INVALID.code,
+        message: "options.api is invalid.",
+      });
+    }
+
+    requestOptions.url = baseUrl + options.endpoint;
+    requestOptions.sendAnalyticsEvent = function (kind) {
+      analytics.sendEvent(self, kind);
+    };
+
+    self._request(requestOptions, function (err, data, status) {
+      var resolvedData, requestError;
+
+      requestError = formatRequestError(status, err);
+
+      if (requestError) {
+        reject(requestError);
+
+        return;
+      }
+
+      if (api === "graphQLApi" && data.errors) {
+        reject(
+          convertToBraintreeError(data.errors, {
+            type: errors.CLIENT_GRAPHQL_REQUEST_ERROR.type,
+            code: errors.CLIENT_GRAPHQL_REQUEST_ERROR.code,
+            message: errors.CLIENT_GRAPHQL_REQUEST_ERROR.message,
+          })
+        );
+
+        return;
+      }
+
+      resolvedData = assign({ _httpStatus: status }, data);
+
+      if (
+        shouldCollectData &&
+        resolvedData.creditCards &&
+        resolvedData.creditCards.length > 0
+      ) {
+        self._findOrCreateFraudnetJSON(resolvedData.creditCards[0].nonce);
+
+        assets.loadScript({
+          src: FRAUDNET_URL,
+          forceScriptReload: true,
+        });
+      }
+      resolve(resolvedData);
+    });
+  });
+
+  if (typeof callback === "function") {
+    callback = once(deferred(callback));
+
+    requestPromise
+      .then(function (response) {
+        callback(null, response, response._httpStatus);
+      })
+      .catch(function (err) {
+        var status = err && err.details && err.details.httpStatus;
+
+        callback(err, null, status);
+      });
+
+    return;
+  }
+
+  return requestPromise; // eslint-disable-line consistent-return
+};
+
+// eslint-disable-next-line consistent-return
+function formatRequestError(status, err) {
+  var requestError;
+
+  if (status === -1) {
+    requestError = new BraintreeError(errors.CLIENT_REQUEST_TIMEOUT);
+  } else if (status === 401) {
+    requestError = new BraintreeError(errors.CLIENT_AUTHORIZATION_INVALID);
+  } else if (status === 403) {
+    requestError = new BraintreeError(errors.CLIENT_AUTHORIZATION_INSUFFICIENT);
+  } else if (status === 429) {
+    requestError = new BraintreeError(errors.CLIENT_RATE_LIMITED);
+  } else if (status >= 500) {
+    requestError = new BraintreeError(errors.CLIENT_GATEWAY_NETWORK);
+  } else if (status < 200 || status >= 400) {
+    requestError = convertToBraintreeError(err, {
+      type: errors.CLIENT_REQUEST_ERROR.type,
+      code: errors.CLIENT_REQUEST_ERROR.code,
+      message: errors.CLIENT_REQUEST_ERROR.message,
+    });
+  }
+
+  if (requestError) {
+    requestError.details = requestError.details || {};
+    requestError.details.httpStatus = status;
+
+    return requestError;
+  }
+}
+
+Client.prototype.toJSON = function () {
+  return this.getConfiguration();
+};
+
+/**
+ * Returns the Client version.
+ * @public
+ * @returns {String} The created client's version.
+ * @example
+ * var createClient = require('braintree-web/client').create;
+ *
+ * createClient({
+ *   authorization: CLIENT_AUTHORIZATION
+ * }, function (createErr, clientInstance) {
+ *   console.log(clientInstance.getVersion()); // Ex: 1.0.0
+ * });
+ * @returns {void}
+ */
+Client.prototype.getVersion = function () {
+  return VERSION;
+};
+
+/**
+ * Cleanly tear down anything set up by {@link module:braintree-web/client.create|create}.
+ * @public
+ * @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
+ * @example
+ * clientInstance.teardown();
+ * @example <caption>With callback</caption>
+ * clientInstance.teardown(function () {
+ *   // teardown is complete
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+Client.prototype.teardown = wrapPromise(function () {
+  var self = this; // eslint-disable-line no-invalid-this
+
+  delete cachedClients[self.getConfiguration().authorization];
+  convertMethodsToError(self, methods(Client.prototype));
+
+  return Promise.resolve();
+});
+
+function getAuthorizationHeadersForGraphQL(configuration) {
+  var token =
+    configuration.authorizationFingerprint || configuration.authorization;
+
+  return {
+    Authorization: "Bearer " + token,
+    "Braintree-Version": BRAINTREE_VERSION,
+  };
+}
+
+module.exports = Client;
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/client_errors.js.html b/3.111.1/client_errors.js.html new file mode 100644 index 00000000..81cd7128 --- /dev/null +++ b/3.111.1/client_errors.js.html @@ -0,0 +1,232 @@ + + + + + + + + + + + client/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ client/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.Client - Internal Error Codes
+ * @ignore
+ * @description These codes should never be experienced by the merchant directly.
+ * @property {MERCHANT} CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN An error to prevent client creation for domains that are not allowed in the JS.
+ * @property {INTERNAL} CLIENT_MISSING_GATEWAY_CONFIGURATION Occurs when the client is created without a gateway configuration. Should never happen.
+ */
+
+/**
+ * @name BraintreeError.Client - Create Error Codes
+ * @description Errors that may occur when [creating the client](./module-braintree-web_client.html#.create)
+ * @property {MERCHANT} CLIENT_INVALID_AUTHORIZATION Occurs when client token cannot be parsed.
+ */
+
+/**
+ * @name BraintreeError.Client - Request Error Codes
+ * @description Errors that may occur when [using the request method](./Client.html#request)
+ * @property {MERCHANT} CLIENT_OPTION_REQUIRED An option required in the request method was not provided. Usually `options.method` or `options.endpoint`
+ * @property {MERCHANT} CLIENT_OPTION_INVALID The request option provided is invalid.
+ * @property {MERCHANT} CLIENT_GATEWAY_NETWORK The Braintree gateway could not be contacted.
+ * @property {NETWORK} CLIENT_REQUEST_TIMEOUT The request took too long to complete and timed out.
+ * @property {NETWORK} CLIENT_REQUEST_ERROR The response from a request had status 400 or greater.
+ * @property {NETWORK} CLIENT_GRAPHQL_REQUEST_ERROR The response from a request to GraphQL contained an error.
+ * @property {MERCHANT} CLIENT_RATE_LIMITED The response from a request had a status of 429, indicating rate limiting.
+ * @property {MERCHANT} CLIENT_AUTHORIZATION_INSUFFICIENT The user associated with the client token or tokenization key does not have permissions to make the request.
+ * @property {MERCHANT} CLIENT_AUTHORIZATION_INVALID The provided authorization could not be found. Either the client token has expired and a new client token must be generated or the tokenization key used is set to be inactive or has been deleted.
+ */
+
+var BraintreeError = require("../lib/braintree-error");
+
+module.exports = {
+  CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN: {
+    type: BraintreeError.types.MERCHANT,
+    code: "CLIENT_GATEWAY_CONFIGURATION_INVALID_DOMAIN",
+  },
+  CLIENT_OPTION_REQUIRED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "CLIENT_OPTION_REQUIRED",
+  },
+  CLIENT_OPTION_INVALID: {
+    type: BraintreeError.types.MERCHANT,
+    code: "CLIENT_OPTION_INVALID",
+  },
+  CLIENT_MISSING_GATEWAY_CONFIGURATION: {
+    type: BraintreeError.types.INTERNAL,
+    code: "CLIENT_MISSING_GATEWAY_CONFIGURATION",
+    message: "Missing gatewayConfiguration.",
+  },
+  CLIENT_INVALID_AUTHORIZATION: {
+    type: BraintreeError.types.MERCHANT,
+    code: "CLIENT_INVALID_AUTHORIZATION",
+    message:
+      "Authorization is invalid. Make sure your client token or tokenization key is valid.",
+  },
+  CLIENT_GATEWAY_NETWORK: {
+    type: BraintreeError.types.NETWORK,
+    code: "CLIENT_GATEWAY_NETWORK",
+    message: "Cannot contact the gateway at this time.",
+  },
+  CLIENT_REQUEST_TIMEOUT: {
+    type: BraintreeError.types.NETWORK,
+    code: "CLIENT_REQUEST_TIMEOUT",
+    message: "Request timed out waiting for a reply.",
+  },
+  CLIENT_REQUEST_ERROR: {
+    type: BraintreeError.types.NETWORK,
+    code: "CLIENT_REQUEST_ERROR",
+    message: "There was a problem with your request.",
+  },
+  CLIENT_GRAPHQL_REQUEST_ERROR: {
+    type: BraintreeError.types.NETWORK,
+    code: "CLIENT_GRAPHQL_REQUEST_ERROR",
+    message: "There was a problem with your request.",
+  },
+  CLIENT_RATE_LIMITED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "CLIENT_RATE_LIMITED",
+    message: "You are being rate-limited; please try again in a few minutes.",
+  },
+  CLIENT_AUTHORIZATION_INSUFFICIENT: {
+    type: BraintreeError.types.MERCHANT,
+    code: "CLIENT_AUTHORIZATION_INSUFFICIENT",
+    message: "The authorization used has insufficient privileges.",
+  },
+  CLIENT_AUTHORIZATION_INVALID: {
+    type: BraintreeError.types.MERCHANT,
+    code: "CLIENT_AUTHORIZATION_INVALID",
+    message:
+      "Either the client token has expired and a new one should be generated or the tokenization key has been deactivated or deleted.",
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/client_index.js.html b/3.111.1/client_index.js.html new file mode 100644 index 00000000..e4700e18 --- /dev/null +++ b/3.111.1/client_index.js.html @@ -0,0 +1,199 @@ + + + + + + + + + + + client/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ client/index.js +

+ + + + + +
+
+
"use strict";
+
+var BraintreeError = require("../lib/braintree-error");
+var Client = require("./client");
+var VERSION = process.env.npm_package_version;
+var wrapPromise = require("@braintree/wrap-promise");
+var sharedErrors = require("../lib/errors");
+
+/** @module braintree-web/client */
+
+/**
+ * @function create
+ * @description This function is the entry point for the <code>braintree.client</code> module. It is used for creating {@link Client} instances that service communication to Braintree servers.
+ * @param {object} options Object containing all {@link Client} options:
+ * @param {string} options.authorization A tokenizationKey or clientToken.
+ * @param {callback} [callback] The second argument, <code>data</code>, is the {@link Client} instance.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * var createClient = require('braintree-web/client').create;
+ *
+ * createClient({
+ *   authorization: CLIENT_AUTHORIZATION
+ * }, function (createErr, clientInstance) {
+ *   if (createErr) {
+ *     if (createErr.code === 'CLIENT_AUTHORIZATION_INVALID') {
+ *       // either the client token has expired, and a new one should be generated
+ *       // or the tokenization key was deactivated or deleted
+ *     } else {
+ *       console.log('something went wrong creating the client instance', createErr);
+ *     }
+ *     return;
+ *   }
+ *
+ *  // set up other components
+ * });
+ * @static
+ */
+function create(options) {
+  if (!options.authorization) {
+    return Promise.reject(
+      new BraintreeError({
+        type: sharedErrors.INSTANTIATION_OPTION_REQUIRED.type,
+        code: sharedErrors.INSTANTIATION_OPTION_REQUIRED.code,
+        message:
+          "options.authorization is required when instantiating a client.",
+      })
+    );
+  }
+
+  return Client.initialize(options);
+}
+
+module.exports = {
+  create: wrapPromise(create),
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/data-collector_errors.js.html b/3.111.1/data-collector_errors.js.html new file mode 100644 index 00000000..f83f467d --- /dev/null +++ b/3.111.1/data-collector_errors.js.html @@ -0,0 +1,167 @@ + + + + + + + + + + + data-collector/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ data-collector/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.Data Collector - Creation Error Codes
+ * @description Errors that occur when [creating the Data Collector component](./module-braintree-web_data-collector.html#.create).
+ * @property {MERCHANT} DATA_COLLECTOR_KOUNT_NOT_ENABLED Occurs when Kount is enabled in creation options but is not enabled on the Braintree control panel.
+ * @property {MERCHANT} DATA_COLLECTOR_KOUNT_ERROR Occurs when Kount errors while setting up.
+ * @property {MERCHANT} DATA_COLLECTOR_REQUIRES_CREATE_OPTIONS Occurs when Kount or PayPal Fraudnet could not be enabled.
+ */
+
+var BraintreeError = require("../lib/braintree-error");
+
+module.exports = {
+  DATA_COLLECTOR_KOUNT_NOT_ENABLED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "DATA_COLLECTOR_KOUNT_NOT_ENABLED",
+    message: "Kount is not enabled for this merchant.",
+  },
+  DATA_COLLECTOR_KOUNT_ERROR: {
+    type: BraintreeError.types.MERCHANT,
+    code: "DATA_COLLECTOR_KOUNT_ERROR",
+  },
+  DATA_COLLECTOR_REQUIRES_CREATE_OPTIONS: {
+    type: BraintreeError.types.MERCHANT,
+    code: "DATA_COLLECTOR_REQUIRES_CREATE_OPTIONS",
+    message: "Data Collector must be created with Kount and/or PayPal.",
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/data-collector_index.js.html b/3.111.1/data-collector_index.js.html new file mode 100644 index 00000000..9e685efa --- /dev/null +++ b/3.111.1/data-collector_index.js.html @@ -0,0 +1,374 @@ + + + + + + + + + + + data-collector/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ data-collector/index.js +

+ + + + + +
+
+
"use strict";
+/** @module braintree-web/data-collector */
+
+var kount = require("./kount");
+var fraudnet = require("./fraudnet");
+var BraintreeError = require("../lib/braintree-error");
+var basicComponentVerification = require("../lib/basic-component-verification");
+var createDeferredClient = require("../lib/create-deferred-client");
+var createAssetsUrl = require("../lib/create-assets-url");
+var methods = require("../lib/methods");
+var convertMethodsToError = require("../lib/convert-methods-to-error");
+var VERSION = process.env.npm_package_version;
+var wrapPromise = require("@braintree/wrap-promise");
+var errors = require("./errors");
+
+/**
+ * @class
+ * @global
+ * @name DataCollector
+ * @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/data-collector.create|braintree-web.data-collector.create} instead.</strong>
+ * @classdesc This class is used for fraud integration with PayPal and Kount. Instances of this class have {@link DataCollector#deviceData|deviceData} which is used to correlate user sessions with server transactions.
+ */
+
+/**
+ * @memberof DataCollector
+ * @name deviceData
+ * @type string
+ * @description JSON string to pass with server transactions.
+ * @instance
+ */
+
+/**
+ * @memberof DataCollector
+ * @name rawDeviceData
+ * @type object
+ * @description The device data as an object instead of a string.
+ * @instance
+ */
+
+/**
+ * @memberof DataCollector
+ * @name teardown
+ * @function
+ * @description Cleanly remove anything set up by {@link module:braintree-web/data-collector.create|create}.
+ * @param {callback} [callback] Called on completion. If no callback is provided, `teardown` returns a promise.
+ * @instance
+ * @example
+ * dataCollectorInstance.teardown();
+ * @example <caption>With callback</caption>
+ * dataCollectorInstance.teardown(function () {
+ *   // teardown is complete
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+
+/**
+ * @memberof DataCollector
+ * @name getDeviceData
+ * @function
+ * @description Resolves with device data once it is ready.
+ * @param {object} [options] Options for how device data is resolved.
+ * @param {boolean} [options.raw=false] When set to true, the device data will resolve as an object instead of a JSON string.
+ * @param {callback} [callback] Called on completion. If no callback is provided, `getDeviceData` returns a promise.
+ * @instance
+ * @example
+ * dataCollectorInstance.getDeviceData();
+ * @example <caption>Without options</caption>
+ * dataCollectorInstance.getDeviceData().then(function (deviceData) {
+ *   // typeof deviceData === 'string'
+ *   // pass onto your server with the payment method nonce
+ * });
+ * @example <caption>With options</caption>
+ * dataCollectorInstance.getDeviceData({
+ *   raw: true
+ * }).then(function (deviceData) {
+ *   // typeof deviceData === 'object'
+ *   // for if you'd like to parse the data before sending it to your server
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+
+/**
+ * @static
+ * @function create
+ * @description Creates a DataCollector instance and collects device data based on your merchant configuration. We recommend that you call this method as early as possible, e.g. as soon as your website loads. If that's too early, call it at the beginning of customer checkout.
+ * **Note:** To use your own Kount ID, contact our support team ([support@braintreepayments.com](mailto:support@braintreepayments.com) or [877.434.2894](tel:877.434.2894)).
+ * @param {object} options Creation options:
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {boolean} [options.useDeferredClient] Used in conjunction with `authorization`, allows the Data Collector instance to be available right away by fetching the client configuration in the background. When this option is used, {@link GooglePayment#getDeviceData} must be used to collect the device data.
+ * @param {boolean} [options.kount] Kount fraud data collection will occur if the merchant configuration has it enabled.
+ * **Note:** the data sent to Kount is asynchronous and may not have completed by the time the data collector create call is complete. In most cases, this will not matter, but if you create the data collector instance and immediately navigate away from the page, the device information may fail to be sent to Kount.
+ * @param {boolean} [options.paypal] *Deprecated:* PayPal fraud data collection will occur when the DataCollector instance is created.
+ * @param {string} [options.riskCorrelationId] Pass a custom risk correlation id when creating the data collector.
+ * @param {string} [options.clientMetadataId] Deprecated. Use `options.riskCorrelationId` instead.
+ * @param {string} [options.correlationId] Deprecated. Use `options.riskCorrelationId` instead.
+ * @param {callback} [callback] The second argument, `data`, is the {@link DataCollector} instance.
+ * @returns {(Promise|void)} Returns a promise that resolves the {@link DataCollector} instance if no callback is provided.
+ */
+function create(options) {
+  var name = "Data Collector";
+  var result = {
+    _instances: [],
+  };
+  var data;
+
+  return basicComponentVerification
+    .verify({
+      name: name,
+      client: options.client,
+      authorization: options.authorization,
+    })
+    .then(function () {
+      result._instantiatedWithAClient = !options.useDeferredClient;
+      result._createPromise = createDeferredClient
+        .create({
+          authorization: options.authorization,
+          client: options.client,
+          debug: options.debug,
+          assetsUrl: createAssetsUrl.create(options.authorization),
+          name: name,
+        })
+        .then(function (client) {
+          var kountInstance;
+          var config = client.getConfiguration();
+
+          if (options.kount === true && config.gatewayConfiguration.kount) {
+            try {
+              kountInstance = kount.setup({
+                environment: config.gatewayConfiguration.environment,
+                merchantId: config.gatewayConfiguration.kount.kountMerchantId,
+              });
+            } catch (err) {
+              return Promise.reject(
+                new BraintreeError({
+                  type: errors.DATA_COLLECTOR_KOUNT_ERROR.type,
+                  code: errors.DATA_COLLECTOR_KOUNT_ERROR.code,
+                  message: err.message,
+                })
+              );
+            }
+
+            data = kountInstance.deviceData;
+            result._instances.push(kountInstance);
+          } else {
+            data = {};
+          }
+
+          return Promise.resolve(client);
+        })
+        .then(function (client) {
+          var clientConfiguration = client.getConfiguration();
+
+          return fraudnet
+            .setup({
+              sessionId:
+                options.riskCorrelationId ||
+                options.clientMetadataId ||
+                options.correlationId,
+              clientSessionId: clientConfiguration.analyticsMetadata.sessionId,
+              environment: clientConfiguration.gatewayConfiguration.environment,
+            })
+            .then(function (fraudnetInstance) {
+              if (fraudnetInstance) {
+                data.correlation_id = fraudnetInstance.sessionId; // eslint-disable-line camelcase
+                result._instances.push(fraudnetInstance);
+              }
+            });
+        })
+        .then(function () {
+          if (result._instances.length === 0) {
+            // NEXT_MAJOR_VERSION either this should error with a specific error that
+            // no data collector instances could be set up, or we should just swallow
+            // the error and document that no device data will be returned if
+            // data collector cannot be instantiated. We can't change the error code here
+            // without possibly breaking merchant integrations relying on this inccorrect
+            // behavior.
+            return Promise.reject(
+              new BraintreeError(errors.DATA_COLLECTOR_REQUIRES_CREATE_OPTIONS)
+            );
+          }
+
+          result.deviceData = JSON.stringify(data);
+          result.rawDeviceData = data;
+
+          return result;
+        });
+
+      result.teardown = createTeardownMethod(result);
+      result.getDeviceData = createGetDeviceDataMethod(result);
+
+      if (result._instantiatedWithAClient) {
+        return result._createPromise;
+      }
+
+      return result;
+    });
+}
+
+function createTeardownMethod(result) {
+  return wrapPromise(function teardown() {
+    return result._createPromise.then(function () {
+      result._instances.forEach(function (instance) {
+        if (instance) {
+          instance.teardown();
+        }
+      });
+
+      convertMethodsToError(result, methods(result));
+    });
+  });
+}
+
+function createGetDeviceDataMethod(result) {
+  return wrapPromise(function getDeviceData(options) {
+    options = options || {};
+
+    return result._createPromise.then(function () {
+      if (options.raw) {
+        return Promise.resolve(result.rawDeviceData);
+      }
+
+      return Promise.resolve(result.deviceData);
+    });
+  });
+}
+
+module.exports = {
+  create: wrapPromise(create),
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/external-ApplePayPaymentAuthorizedEvent.html b/3.111.1/external-ApplePayPaymentAuthorizedEvent.html new file mode 100644 index 00000000..7bf7cb7d --- /dev/null +++ b/3.111.1/external-ApplePayPaymentAuthorizedEvent.html @@ -0,0 +1,234 @@ + + + + + + + + + ApplePayPaymentAuthorizedEvent - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ApplePayPaymentAuthorizedEvent +

+ + + + +
+
+ +

+ + ApplePayPaymentAuthorizedEvent + +

+ + + +
+ +
+
+ + +
+

An Apple Pay Payment Authorization Event object.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/external-ApplePayPaymentRequest.html b/3.111.1/external-ApplePayPaymentRequest.html new file mode 100644 index 00000000..dff3af33 --- /dev/null +++ b/3.111.1/external-ApplePayPaymentRequest.html @@ -0,0 +1,234 @@ + + + + + + + + + ApplePayPaymentRequest - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ ApplePayPaymentRequest +

+ + + + +
+
+ +

+ + ApplePayPaymentRequest + +

+ + + +
+ +
+
+ + +
+

An Apple Pay Payment Request object.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + +
See:
+
+ +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/fastlane_index.js.html b/3.111.1/fastlane_index.js.html new file mode 100644 index 00000000..4cf14bc2 --- /dev/null +++ b/3.111.1/fastlane_index.js.html @@ -0,0 +1,218 @@ + + + + + + + + + + + fastlane/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ fastlane/index.js +

+ + + + + +
+
+
"use strict";
+
+/** @module braintree-web/fastlane */
+
+var basicComponentVerification = require("../lib/basic-component-verification");
+var fastlane = require("./fastlane");
+var createAssetsUrl = require("../lib/create-assets-url");
+var createDeferredClient = require("../lib/create-deferred-client");
+var wrapPromise = require("@braintree/wrap-promise");
+var VERSION = process.env.npm_package_version;
+var assign = require("../lib/assign").assign;
+
+/**
+ * @static
+ * @function create
+ * @param {object} options Creation options:
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {string} [options.deviceData] A {@link DataCollector} instance.
+ * @example
+ * braintree.fastlane.create({
+ *   client: clientInstance,
+ *   deviceData: dataCollectorInstance
+ * }).then(function (fastlaneInstance) {
+ *   // fastlaneInstance is ready to create an identity instance.
+ *     identity = fastlaneInstance.identity
+ * }).catch(function (createErr) {
+ *   console.error('Error creating fastlane instance', createErr);
+ * });
+ * @example <caption>Creating a fastlane component</caption>
+ * braintree.fastlane.create({
+ *   client: clientInstance,
+ *   deviceData: dataCollectorInstance
+ * }).then(function (fastlaneInstance) {
+ *   // fastlaneInstance is ready to create an identity instance.
+ *     identity = fastlaneInstance.identity
+ * }).catch(function (createErr) {
+ *   console.error('Error creating fastlane instance', createErr);
+ * });
+ * @returns {(Promise|void)} Returns the fastlane instance.
+ */
+
+function create(options) {
+  var name = "fastlane";
+
+  return basicComponentVerification
+    .verify({
+      name: name,
+      client: options.client,
+      authorization: options.authorization,
+    })
+    .then(function () {
+      return createDeferredClient.create({
+        authorization: options.authorization,
+        client: options.client,
+        assetsUrl: createAssetsUrl.create(options.authorization),
+        name: name,
+      });
+    })
+    .then(function (client) {
+      return fastlane(
+        assign(
+          {
+            client: client,
+            deviceData: options.deviceData,
+          },
+          options
+        )
+      );
+    });
+}
+module.exports = {
+  create: wrapPromise(create),
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/fonts/OpenSans-Bold-webfont.eot b/3.111.1/fonts/OpenSans-Bold-webfont.eot new file mode 100644 index 00000000..5d20d916 Binary files /dev/null and b/3.111.1/fonts/OpenSans-Bold-webfont.eot differ diff --git a/3.111.1/fonts/OpenSans-Bold-webfont.svg b/3.111.1/fonts/OpenSans-Bold-webfont.svg new file mode 100644 index 00000000..3ed7be4b --- /dev/null +++ b/3.111.1/fonts/OpenSans-Bold-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/fonts/OpenSans-Bold-webfont.woff b/3.111.1/fonts/OpenSans-Bold-webfont.woff new file mode 100644 index 00000000..1205787b Binary files /dev/null and b/3.111.1/fonts/OpenSans-Bold-webfont.woff differ diff --git a/3.111.1/fonts/OpenSans-BoldItalic-webfont.eot b/3.111.1/fonts/OpenSans-BoldItalic-webfont.eot new file mode 100644 index 00000000..1f639a15 Binary files /dev/null and b/3.111.1/fonts/OpenSans-BoldItalic-webfont.eot differ diff --git a/3.111.1/fonts/OpenSans-BoldItalic-webfont.svg b/3.111.1/fonts/OpenSans-BoldItalic-webfont.svg new file mode 100644 index 00000000..6a2607b9 --- /dev/null +++ b/3.111.1/fonts/OpenSans-BoldItalic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/fonts/OpenSans-BoldItalic-webfont.woff b/3.111.1/fonts/OpenSans-BoldItalic-webfont.woff new file mode 100644 index 00000000..ed760c06 Binary files /dev/null and b/3.111.1/fonts/OpenSans-BoldItalic-webfont.woff differ diff --git a/3.111.1/fonts/OpenSans-Italic-webfont.eot b/3.111.1/fonts/OpenSans-Italic-webfont.eot new file mode 100644 index 00000000..0c8a0ae0 Binary files /dev/null and b/3.111.1/fonts/OpenSans-Italic-webfont.eot differ diff --git a/3.111.1/fonts/OpenSans-Italic-webfont.svg b/3.111.1/fonts/OpenSans-Italic-webfont.svg new file mode 100644 index 00000000..e1075dcc --- /dev/null +++ b/3.111.1/fonts/OpenSans-Italic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/fonts/OpenSans-Italic-webfont.woff b/3.111.1/fonts/OpenSans-Italic-webfont.woff new file mode 100644 index 00000000..ff652e64 Binary files /dev/null and b/3.111.1/fonts/OpenSans-Italic-webfont.woff differ diff --git a/3.111.1/fonts/OpenSans-Light-webfont.eot b/3.111.1/fonts/OpenSans-Light-webfont.eot new file mode 100644 index 00000000..14868406 Binary files /dev/null and b/3.111.1/fonts/OpenSans-Light-webfont.eot differ diff --git a/3.111.1/fonts/OpenSans-Light-webfont.svg b/3.111.1/fonts/OpenSans-Light-webfont.svg new file mode 100644 index 00000000..11a472ca --- /dev/null +++ b/3.111.1/fonts/OpenSans-Light-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/fonts/OpenSans-Light-webfont.woff b/3.111.1/fonts/OpenSans-Light-webfont.woff new file mode 100644 index 00000000..e7860748 Binary files /dev/null and b/3.111.1/fonts/OpenSans-Light-webfont.woff differ diff --git a/3.111.1/fonts/OpenSans-LightItalic-webfont.eot b/3.111.1/fonts/OpenSans-LightItalic-webfont.eot new file mode 100644 index 00000000..8f445929 Binary files /dev/null and b/3.111.1/fonts/OpenSans-LightItalic-webfont.eot differ diff --git a/3.111.1/fonts/OpenSans-LightItalic-webfont.svg b/3.111.1/fonts/OpenSans-LightItalic-webfont.svg new file mode 100644 index 00000000..431d7e35 --- /dev/null +++ b/3.111.1/fonts/OpenSans-LightItalic-webfont.svg @@ -0,0 +1,1835 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/fonts/OpenSans-LightItalic-webfont.woff b/3.111.1/fonts/OpenSans-LightItalic-webfont.woff new file mode 100644 index 00000000..43e8b9e6 Binary files /dev/null and b/3.111.1/fonts/OpenSans-LightItalic-webfont.woff differ diff --git a/3.111.1/fonts/OpenSans-Regular-webfont.eot b/3.111.1/fonts/OpenSans-Regular-webfont.eot new file mode 100644 index 00000000..6bbc3cf5 Binary files /dev/null and b/3.111.1/fonts/OpenSans-Regular-webfont.eot differ diff --git a/3.111.1/fonts/OpenSans-Regular-webfont.svg b/3.111.1/fonts/OpenSans-Regular-webfont.svg new file mode 100644 index 00000000..25a39523 --- /dev/null +++ b/3.111.1/fonts/OpenSans-Regular-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/fonts/OpenSans-Regular-webfont.woff b/3.111.1/fonts/OpenSans-Regular-webfont.woff new file mode 100644 index 00000000..e231183d Binary files /dev/null and b/3.111.1/fonts/OpenSans-Regular-webfont.woff differ diff --git a/3.111.1/fonts/OpenSans-Semibold-webfont.eot b/3.111.1/fonts/OpenSans-Semibold-webfont.eot new file mode 100755 index 00000000..d8375dd0 Binary files /dev/null and b/3.111.1/fonts/OpenSans-Semibold-webfont.eot differ diff --git a/3.111.1/fonts/OpenSans-Semibold-webfont.svg b/3.111.1/fonts/OpenSans-Semibold-webfont.svg new file mode 100755 index 00000000..eec4db8b --- /dev/null +++ b/3.111.1/fonts/OpenSans-Semibold-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/fonts/OpenSans-Semibold-webfont.ttf b/3.111.1/fonts/OpenSans-Semibold-webfont.ttf new file mode 100755 index 00000000..b3290843 Binary files /dev/null and b/3.111.1/fonts/OpenSans-Semibold-webfont.ttf differ diff --git a/3.111.1/fonts/OpenSans-Semibold-webfont.woff b/3.111.1/fonts/OpenSans-Semibold-webfont.woff new file mode 100755 index 00000000..28d6adee Binary files /dev/null and b/3.111.1/fonts/OpenSans-Semibold-webfont.woff differ diff --git a/3.111.1/fonts/OpenSans-SemiboldItalic-webfont.eot b/3.111.1/fonts/OpenSans-SemiboldItalic-webfont.eot new file mode 100755 index 00000000..0ab1db22 Binary files /dev/null and b/3.111.1/fonts/OpenSans-SemiboldItalic-webfont.eot differ diff --git a/3.111.1/fonts/OpenSans-SemiboldItalic-webfont.svg b/3.111.1/fonts/OpenSans-SemiboldItalic-webfont.svg new file mode 100755 index 00000000..7166ec1b --- /dev/null +++ b/3.111.1/fonts/OpenSans-SemiboldItalic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/fonts/OpenSans-SemiboldItalic-webfont.ttf b/3.111.1/fonts/OpenSans-SemiboldItalic-webfont.ttf new file mode 100755 index 00000000..d2d6318f Binary files /dev/null and b/3.111.1/fonts/OpenSans-SemiboldItalic-webfont.ttf differ diff --git a/3.111.1/fonts/OpenSans-SemiboldItalic-webfont.woff b/3.111.1/fonts/OpenSans-SemiboldItalic-webfont.woff new file mode 100755 index 00000000..d4dfca40 Binary files /dev/null and b/3.111.1/fonts/OpenSans-SemiboldItalic-webfont.woff differ diff --git a/3.111.1/global.html b/3.111.1/global.html new file mode 100644 index 00000000..06a8f86b --- /dev/null +++ b/3.111.1/global.html @@ -0,0 +1,510 @@ + + + + + + + + + Global - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ Global +

+ + + + +
+
+ +

+ + + +

+ + + +
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + + + + + + + + +
+

We should not ever really use the Modal. Modals are like popups, but the key difference is that the customer can't actually verify it's app domain and thus secure/valid. Old PP sdk (./src/paypal) uses this +to get info from webviews (e.g. facebook).

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ callback(erropt, nullable, dataopt, nullable) → {void} +

+
+ + + + + +
+

The Node.js-style callback pattern used throughout the SDK.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
err + + + + BraintreeError + + + + + + + + + <optional>
+ + + + <nullable>
+ + + +
+

null or undefined if there was no error.

+ +
data + + + + any + + + + + + + + + <optional>
+ + + + <nullable>
+ + + +
+

The successful result of the asynchronous function call (if data exists).

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/google-payment_errors.js.html b/3.111.1/google-payment_errors.js.html new file mode 100644 index 00000000..4f01208c --- /dev/null +++ b/3.111.1/google-payment_errors.js.html @@ -0,0 +1,173 @@ + + + + + + + + + + + google-payment/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ google-payment/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.Google Payment - Creation Error Codes
+ * @description Errors that occur when [creating the Google Payment component](./module-braintree-web_google-payment.html#.create).
+ * @property {MERCHANT} GOOGLE_PAYMENT_NOT_ENABLED Occurs when Google Pay is not enabled on the Braintree control panel.
+ * @property {MERCHANT} GOOGLE_PAYMENT_UNSUPPORTED_VERSION Occurs when a Google Pay version is used that is not supported by the Braintree SDK.
+ */
+
+/**
+ * @name BraintreeError.Google Payment - parseResponse Error Codes
+ * @description Errors that occur when [parsing the response from Google](./GooglePayment.html#parseResponse).
+ * @property {UNKNOWN} GOOGLE_PAYMENT_GATEWAY_ERROR Occurs when Google Pay could not be tokenized.
+ */
+
+var BraintreeError = require("../lib/braintree-error");
+
+module.exports = {
+  GOOGLE_PAYMENT_NOT_ENABLED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "GOOGLE_PAYMENT_NOT_ENABLED",
+    message: "Google Pay is not enabled for this merchant.",
+  },
+  GOOGLE_PAYMENT_GATEWAY_ERROR: {
+    code: "GOOGLE_PAYMENT_GATEWAY_ERROR",
+    message:
+      "There was an error when tokenizing the Google Pay payment method.",
+    type: BraintreeError.types.UNKNOWN,
+  },
+  GOOGLE_PAYMENT_UNSUPPORTED_VERSION: {
+    code: "GOOGLE_PAYMENT_UNSUPPORTED_VERSION",
+    type: BraintreeError.types.MERCHANT,
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/google-payment_google-payment.js.html b/3.111.1/google-payment_google-payment.js.html new file mode 100644 index 00000000..38e56c99 --- /dev/null +++ b/3.111.1/google-payment_google-payment.js.html @@ -0,0 +1,531 @@ + + + + + + + + + + + google-payment/google-payment.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ google-payment/google-payment.js +

+ + + + + +
+
+
"use strict";
+
+var analytics = require("../lib/analytics");
+var assign = require("../lib/assign").assign;
+var convertMethodsToError = require("../lib/convert-methods-to-error");
+var find = require("../lib/find");
+var generateGooglePayConfiguration = require("../lib/generate-google-pay-configuration");
+var BraintreeError = require("../lib/braintree-error");
+var errors = require("./errors");
+var methods = require("../lib/methods");
+var wrapPromise = require("@braintree/wrap-promise");
+
+var CREATE_PAYMENT_DATA_REQUEST_METHODS = {
+  1: "_createV1PaymentDataRequest",
+  2: "_createV2PaymentDataRequest",
+};
+
+/**
+ * @typedef {object} GooglePayment~tokenizePayload
+ * @property {string} nonce The payment method nonce.
+ * @property {object} details Additional account details.
+ * @property {string} details.cardType Type of card, ex: Visa, MasterCard.
+ * @property {string} details.lastFour Last four digits of card number.
+ * @property {string} details.lastTwo Last two digits of card number.
+ * @property {boolean} details.isNetworkTokenized True if the card is network tokenized.
+ * @property {string} details.bin First six digits of card number.
+ * @property {string} description A human-readable description.
+ * @property {string} type The payment method type, `CreditCard` or `AndroidPayCard`.
+ * @property {object} binData Information about the card based on the bin.
+ * @property {string} binData.commercial Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.countryOfIssuance The country of issuance.
+ * @property {string} binData.debit Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.durbinRegulated Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.healthcare Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.issuingBank The issuing bank.
+ * @property {string} binData.payroll Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.prepaid Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.productId The product id.
+ */
+
+/**
+ * @class GooglePayment
+ * @param {object} options Google Payment {@link module:braintree-web/google-payment.create create} options.
+ * @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/google-payment.create|braintree-web.google-payment.create} instead.</strong>
+ * @classdesc This class represents a Google Payment component produced by {@link module:braintree-web/google-payment.create|braintree-web/google-payment.create}. Instances of this class have methods for initializing the Google Pay flow.
+ */
+function GooglePayment(options) {
+  this._createPromise = options.createPromise;
+  this._client = options.client;
+  this._useDeferredClient = options.useDeferredClient;
+  // NEXT_MAJOR_VERSION this should be updated to 2 (or whatever the current latest version is)
+  this._googlePayVersion = options.googlePayVersion || 1;
+  this._googleMerchantId = options.googleMerchantId;
+
+  if (this._isUnsupportedGooglePayAPIVersion()) {
+    throw new BraintreeError({
+      code: errors.GOOGLE_PAYMENT_UNSUPPORTED_VERSION.code,
+      message:
+        "The Braintree SDK does not support Google Pay version " +
+        this._googlePayVersion +
+        ". Please upgrade the version of your Braintree SDK and contact support if this error persists.",
+      type: errors.GOOGLE_PAYMENT_UNSUPPORTED_VERSION.type,
+    });
+  }
+}
+
+GooglePayment.prototype._waitForClient = function () {
+  if (this._client) {
+    return Promise.resolve();
+  }
+
+  return this._createPromise.then(
+    function (client) {
+      this._client = client;
+    }.bind(this)
+  );
+};
+
+GooglePayment.prototype._isUnsupportedGooglePayAPIVersion = function () {
+  // if we don't have createPaymentDatqRequest method for the specific
+  // API version, then the version is not supported
+  return !(this._googlePayVersion in CREATE_PAYMENT_DATA_REQUEST_METHODS);
+};
+
+GooglePayment.prototype._getDefaultConfig = function () {
+  if (!this._defaultConfig) {
+    this._defaultConfig = generateGooglePayConfiguration(
+      this._client.getConfiguration(),
+      this._googlePayVersion,
+      this._googleMerchantId
+    );
+  }
+
+  return this._defaultConfig;
+};
+
+GooglePayment.prototype._createV1PaymentDataRequest = function (
+  paymentDataRequest
+) {
+  var defaultConfig = this._getDefaultConfig();
+  var overrideCardNetworks =
+    paymentDataRequest.cardRequirements &&
+    paymentDataRequest.cardRequirements.allowedCardNetworks;
+  var defaultConfigCardNetworks =
+    defaultConfig.cardRequirements.allowedCardNetworks;
+  var allowedCardNetworks = overrideCardNetworks || defaultConfigCardNetworks;
+
+  paymentDataRequest = assign({}, defaultConfig, paymentDataRequest);
+
+  // this way we can preserve allowedCardNetworks from default integration
+  // if merchant did not pass any in `cardRequirements`
+  paymentDataRequest.cardRequirements.allowedCardNetworks = allowedCardNetworks;
+
+  return paymentDataRequest;
+};
+
+GooglePayment.prototype._createV2PaymentDataRequest = function (
+  paymentDataRequest
+) {
+  var defaultConfig = this._getDefaultConfig();
+
+  if (paymentDataRequest.allowedPaymentMethods) {
+    paymentDataRequest.allowedPaymentMethods.forEach(function (paymentMethod) {
+      var defaultPaymentMethod = find(
+        defaultConfig.allowedPaymentMethods,
+        "type",
+        paymentMethod.type
+      );
+
+      if (defaultPaymentMethod) {
+        applyDefaultsToPaymentMethodConfiguration(
+          paymentMethod,
+          defaultPaymentMethod
+        );
+      }
+    });
+  }
+
+  paymentDataRequest = assign({}, defaultConfig, paymentDataRequest);
+
+  return paymentDataRequest;
+};
+
+/**
+ * Create a configuration object for use in the `loadPaymentData` method.
+ *
+ * **Note**: Version 1 of the Google Pay Api is deprecated and will become unsupported in a future version. Until then, version 1 will continue to be used by default, and version 1 schema parameters and overrides will remain functional on existing integrations. However, new integrations and all following examples will be presented in the GooglePay version 2 schema. See [Google Pay's upgrade guide](https://developers.google.com/pay/api/web/guides/resources/update-to-latest-version) to see how to update your integration.
+ *
+ * If `options.googlePayVersion === 2` was set during the initial {@link module:braintree-web/google-payment.create|create} call, overrides must match the Google Pay v2 schema to be valid.
+ *
+ * @public
+ * @param {object} overrides The supplied parameters for creating the PaymentDataRequest object. Required parameters are:
+ *  @param {object} overrides.transactionInfo Object according to the [Google Pay Transaction Info](https://developers.google.com/pay/api/web/reference/object#TransactionInfo) spec.
+ *  Optionally, any of the parameters in the [PaymentDataRequest](https://developers.google.com/pay/api/web/reference/object#PaymentDataRequest) parameters can be overridden, but note that it is recommended only to override top level parameters to avoid squashing deeply nested configuration objects. An example can be found below showing how to safely edit these deeply nested objects.
+ * @example
+ * var paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
+ *   merchantInfo: {
+ *     merchantId: 'my-merchant-id-from-google'
+ *   },
+ *   transactionInfo: {
+ *     currencyCode: 'USD',
+ *     totalPriceStatus: 'FINAL',
+ *     totalPrice: '100.00'
+ *   }
+ * });
+ *
+ * // Update card payment methods to require billing address
+ * var cardPaymentMethod = paymentDataRequest.allowedPaymentMethods;
+ * cardPaymentMethod.parameters.billingAddressRequired = true;
+ * cardPaymentMethod.parameters.billingAddressParameters = {
+ *   format: 'FULL',
+ *   phoneNumberRequired: true
+ * };
+ *
+ * var paymentsClient = new google.payments.api.PaymentsClient({
+ *   environment: 'TEST' // or 'PRODUCTION'
+ * })
+ *
+ * paymentsClient.loadPaymentData(paymentDataRequest).then(function (response) {
+ *   // handle response with googlePaymentInstance.parseResponse
+ *   // (see below)
+ * });
+ * @example <caption>With deferred client</caption>
+ * googlePaymentInstance.createPaymentDataRequest({
+ *   merchantInfo: {
+ *     merchantId: 'my-merchant-id-from-google'
+ *   },
+ *   transactionInfo: {
+ *     currencyCode: 'USD',
+ *     totalPriceStatus: 'FINAL',
+ *     totalPrice: '100.00'
+ *   }
+ * }).then(function (paymentDataRequest) {
+ *   // Update card payment methods to require billing address
+ *   var cardPaymentMethod = paymentDataRequest.allowedPaymentMethods;
+ *   cardPaymentMethod.parameters.billingAddressRequired = true;
+ *   cardPaymentMethod.parameters.billingAddressParameters = {
+ *     format: 'FULL',
+ *     phoneNumberRequired: true
+ *   };
+ *
+ *   var paymentsClient = new google.payments.api.PaymentsClient({
+ *     environment: 'TEST' // or 'PRODUCTION'
+ *   })
+ *
+ *   return paymentsClient.loadPaymentData(paymentDataRequest);
+ * }).then(function (response) {
+ *   // handle response with googlePaymentInstance.parseResponse
+ *   // (see below)
+ * });
+ * @returns {object|Promise} Returns a configuration object for Google PaymentDataRequest. If instantiated with `useDeferredClient` and an `authorization` it will return a promise that resolves with the configuration.
+ */
+GooglePayment.prototype.createPaymentDataRequest = function (overrides) {
+  if (!this._useDeferredClient) {
+    return this._createPaymentDataRequestSyncronously(overrides);
+  }
+
+  return this._waitForClient().then(
+    function () {
+      return this._createPaymentDataRequestSyncronously(overrides);
+    }.bind(this)
+  );
+};
+
+GooglePayment.prototype._createPaymentDataRequestSyncronously = function (
+  overrides
+) {
+  var paymentDataRequest = assign({}, overrides);
+  var version = this._googlePayVersion;
+  var createPaymentDataRequestMethod =
+    CREATE_PAYMENT_DATA_REQUEST_METHODS[version];
+
+  if (
+    paymentDataRequest.transactionInfo &&
+    paymentDataRequest.transactionInfo.totalPrice
+  ) {
+    paymentDataRequest.transactionInfo.totalPrice =
+      paymentDataRequest.transactionInfo.totalPrice.toString();
+  }
+
+  analytics.sendEvent(
+    this._createPromise,
+    "google-payment.v" + version + ".createPaymentDataRequest"
+  );
+
+  return this[createPaymentDataRequestMethod](paymentDataRequest);
+};
+
+/**
+ * Parse the response from the tokenization.
+ * @public
+ * @param {object} response The response back from the Google Pay tokenization.
+ * @param {callback} [callback] The second argument, <code>data</code>, is a {@link GooglePay~tokenizePayload|tokenizePayload}. If no callback is provided, `parseResponse` returns a promise that resolves with a {@link GooglePayment~tokenizePayload|tokenizePayload}.
+ * @example with callback
+ * var paymentsClient = new google.payments.api.PaymentsClient({
+ *   environment: 'TEST' // or 'PRODUCTION'
+ * })
+ *
+ * paymentsClient.loadPaymentData(paymentDataRequestFromCreatePaymentDataRequest).then(function (response) {
+ *   googlePaymentInstance.parseResponse(response, function (err, data) {
+ *     if (err) {
+ *       // handle errors
+ *     }
+ *     // send parsedResponse.nonce to your server
+ *   });
+ * });
+ * @example with promise
+ * var paymentsClient = new google.payments.api.PaymentsClient({
+ *   environment: 'TEST' // or 'PRODUCTION'
+ * })
+ *
+ * paymentsClient.loadPaymentData(paymentDataRequestFromCreatePaymentDataRequest).then(function (response) {
+ *   return googlePaymentInstance.parseResponse(response);
+ * }).then(function (parsedResponse) {
+ *   // send parsedResponse.nonce to your server
+ * }).catch(function (err) {
+ *   // handle errors
+ * });
+ * @returns {(Promise|void)} Returns a promise that resolves the parsed response if no callback is provided.
+ */
+GooglePayment.prototype.parseResponse = function (response) {
+  var self = this;
+
+  return Promise.resolve()
+    .then(function () {
+      var payload;
+      var rawResponse =
+        response.apiVersion === 2
+          ? response.paymentMethodData.tokenizationData.token
+          : response.paymentMethodToken.token;
+      var parsedResponse = JSON.parse(rawResponse);
+      var error = parsedResponse.error;
+
+      if (error) {
+        return Promise.reject(error);
+      }
+
+      analytics.sendEvent(
+        self._createPromise,
+        "google-payment.parseResponse.succeeded"
+      );
+
+      if (parsedResponse.paypalAccounts) {
+        payload = parsedResponse.paypalAccounts[0];
+        analytics.sendEvent(
+          self._createPromise,
+          "google-payment.parseResponse.succeeded.paypal"
+        );
+
+        return Promise.resolve({
+          nonce: payload.nonce,
+          type: payload.type,
+          description: payload.description,
+        });
+      }
+      payload = parsedResponse.androidPayCards[0];
+      analytics.sendEvent(
+        self._createPromise,
+        "google-payment.parseResponse.succeeded.google-payment"
+      );
+
+      return Promise.resolve({
+        nonce: payload.nonce,
+        type: payload.type,
+        description: payload.description,
+        details: {
+          cardType: payload.details.cardType,
+          lastFour: payload.details.lastFour,
+          lastTwo: payload.details.lastTwo,
+          isNetworkTokenized: payload.details.isNetworkTokenized,
+          bin: payload.details.bin,
+        },
+        binData: payload.binData,
+      });
+    })
+    .catch(function (error) {
+      analytics.sendEvent(
+        self._createPromise,
+        "google-payment.parseResponse.failed"
+      );
+
+      return Promise.reject(
+        new BraintreeError({
+          code: errors.GOOGLE_PAYMENT_GATEWAY_ERROR.code,
+          message: errors.GOOGLE_PAYMENT_GATEWAY_ERROR.message,
+          type: errors.GOOGLE_PAYMENT_GATEWAY_ERROR.type,
+          details: {
+            originalError: error,
+          },
+        })
+      );
+    });
+};
+
+/**
+ * Cleanly tear down anything set up by {@link module:braintree-web/google-payment.create|create}.
+ * @public
+ * @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
+ * @example
+ * googlePaymentInstance.teardown();
+ * @example <caption>With callback</caption>
+ * googlePaymentInstance.teardown(function () {
+ *   // teardown is complete
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+GooglePayment.prototype.teardown = function () {
+  convertMethodsToError(this, methods(GooglePayment.prototype));
+
+  return Promise.resolve();
+};
+
+function applyDefaultsToPaymentMethodConfiguration(
+  merchantSubmittedPaymentMethod,
+  defaultPaymentMethod
+) {
+  Object.keys(defaultPaymentMethod).forEach(function (parameter) {
+    if (typeof defaultPaymentMethod[parameter] === "object") {
+      merchantSubmittedPaymentMethod[parameter] = assign(
+        {},
+        defaultPaymentMethod[parameter],
+        merchantSubmittedPaymentMethod[parameter]
+      );
+    } else {
+      merchantSubmittedPaymentMethod[parameter] =
+        merchantSubmittedPaymentMethod[parameter] ||
+        defaultPaymentMethod[parameter];
+    }
+  });
+}
+
+module.exports = wrapPromise.wrapPrototype(GooglePayment);
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/google-payment_index.js.html b/3.111.1/google-payment_index.js.html new file mode 100644 index 00000000..556ca5e3 --- /dev/null +++ b/3.111.1/google-payment_index.js.html @@ -0,0 +1,322 @@ + + + + + + + + + + + google-payment/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ google-payment/index.js +

+ + + + + +
+
+
"use strict";
+/**
+ * @module braintree-web/google-payment
+ * @description A component to integrate with Google Pay. The majority of the integration uses [Google's pay.js JavaScript file](https://pay.google.com/gp/p/js/pay.js). The Braintree component generates the configuration object necessary for Google Pay to initiate the Payment Request and parse the returned data to retrieve the payment method nonce which is used to process the transaction on the server.
+ */
+
+var GooglePayment = require("./google-payment");
+var BraintreeError = require("../lib/braintree-error");
+var createAssetsUrl = require("../lib/create-assets-url");
+var createDeferredClient = require("../lib/create-deferred-client");
+var basicComponentVerification = require("../lib/basic-component-verification");
+var wrapPromise = require("@braintree/wrap-promise");
+var VERSION = process.env.npm_package_version;
+var errors = require("./errors");
+
+/**
+ * @static
+ * @function create
+ * @param {object} options Creation options:
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {boolean} [options.useDeferredClient] Used in conjunction with `authorization`, allows the Google Payment instance to be available right away by fetching the client configuration in the background. When this option is used, {@link GooglePayment#createPaymentDataRequest} will return a promise that resolves with the configuration instead of returning synchronously.
+ * @param {number} [options.googlePayVersion] The version of the Google Pay API to use. Value of 2 is required to accept parameters documented [by Google](https://developers.google.com/pay/api/web/reference/object). Omit this parameter to use the deprecated Google Pay Version 1.
+ * @param {string} [options.googleMerchantId] A Google merchant identifier issued after your website is approved by Google. Required when PaymentsClient is initialized with an environment property of PRODUCTION, but may be omitted in TEST environment.
+ * @param {callback} [callback] The second argument, `data`, is the {@link GooglePayment} instance. If no callback is provided, `create` returns a promise that resolves with the {@link GooglePayment} instance.
+ * @example <caption>Simple Example</caption>
+ * // include https://pay.google.com/gp/p/js/pay.js in a script tag
+ * // on your page to load the `google.payments.api.PaymentsClient` global object.
+ *
+ * var paymentButton = document.querySelector('#google-pay-button');
+ * var paymentsClient = new google.payments.api.PaymentsClient({
+ *   environment: 'TEST' // or 'PRODUCTION'
+ * });
+ *
+ * braintree.client.create({
+ *   authorization: 'tokenization-key-or-client-token'
+ * }).then(function (clientInstance) {
+ *   return braintree.googlePayment.create({
+ *     client: clientInstance,
+ *      googlePayVersion: 2,
+ *      googleMerchantId: 'your-merchant-id-from-google'
+ *   });
+ * }).then(function (googlePaymentInstance) {
+ *   paymentButton.addEventListener('click', function (event) {
+ *     var paymentDataRequest;
+ *
+ *     event.preventDefault();
+ *
+ *     paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
+ *       transactionInfo: {
+ *         currencyCode: 'USD',
+ *         totalPriceStatus: 'FINAL',
+ *         totalPrice: '100.00'
+ *       }
+ *     });
+ *
+ *     paymentsClient.loadPaymentData(paymentDataRequest).then(function (paymentData) {
+ *       return googlePaymentInstance.parseResponse(paymentData);
+ *     }).then(function (result) {
+ *       // send result.nonce to your server
+ *     }).catch(function (err) {
+ *       // handle err
+ *     });
+ *   });
+ * });
+ * @example <caption>Check Browser and Customer Compatibility</caption>
+ * var paymentsClient = new google.payments.api.PaymentsClient({
+ *   environment: 'TEST' // or 'PRODUCTION'
+ * });
+ *
+ * function setupGooglePayButton(googlePaymentInstance) {
+ *   var button = document.createElement('button');
+ *
+ *   button.id = 'google-pay';
+ *   button.appendChild(document.createTextNode('Google Pay'));
+ *   button.addEventListener('click', function (event) {
+ *     var paymentRequestData;
+ *
+ *     event.preventDefault();
+ *
+ *     paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
+ *       transactionInfo: {
+ *         currencyCode: 'USD',
+ *         totalPriceStatus: 'FINAL',
+ *         totalPrice: '100.00' // your amount
+ *       }
+ *     });
+ *
+ *     paymentsClient.loadPaymentData(paymentDataRequest).then(function (paymentData) {
+ *       return googlePaymentInstance.parseResponse(paymentData);
+ *       }).then(function (result) {
+ *       // send result.nonce to your server
+ *     }).catch(function (err) {
+ *       // handle errors
+ *     });
+ *   });
+ *
+ *   document.getElementById('container').appendChild(button);
+ * }
+ *
+ * braintree.client.create({
+ *   authorization: 'tokenization-key-or-client-token'
+ * }).then(function (clientInstance) {
+ *   return braintree.googlePayment.create({
+ *     client: clientInstance,
+ *     googlePayVersion: 2,
+ *     googleMerchantId: 'your-merchant-id-from-google'
+ *   });
+ * }).then(function (googlePaymentInstance) {
+ *
+ *   return paymentsClient.isReadyToPay({
+ *     // see https://developers.google.com/pay/api/web/reference/object#IsReadyToPayRequest for all options
+ *     apiVersion: 2,
+ *     apiVersionMinor: 0,
+ *     allowedPaymentMethods: googlePaymentInstance.createPaymentDataRequest().allowedPaymentMethods,
+ *     existingPaymentMethodRequired: true
+ *   });
+ * }).then(function (response) {
+ *   if (response.result) {
+ *     setupGooglePayButton(googlePaymentInstance);
+ *   }
+ * }).catch(function (err) {
+ *   // handle setup errors
+ * });
+ *
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+function create(options) {
+  var name = "Google Pay";
+
+  return basicComponentVerification
+    .verify({
+      name: name,
+      client: options.client,
+      authorization: options.authorization,
+    })
+    .then(function () {
+      var createPromise, instance;
+
+      createPromise = createDeferredClient
+        .create({
+          authorization: options.authorization,
+          client: options.client,
+          debug: options.debug,
+          assetsUrl: createAssetsUrl.create(options.authorization),
+          name: name,
+        })
+        .then(function (client) {
+          var configuration = client.getConfiguration();
+
+          options.client = client;
+          if (!configuration.gatewayConfiguration.androidPay) {
+            return Promise.reject(
+              new BraintreeError(errors.GOOGLE_PAYMENT_NOT_ENABLED)
+            );
+          }
+
+          return client;
+        });
+
+      options.createPromise = createPromise;
+      instance = new GooglePayment(options);
+
+      if (!options.useDeferredClient) {
+        return createPromise.then(function (client) {
+          instance._client = client;
+
+          return instance;
+        });
+      }
+
+      return instance;
+    });
+}
+
+module.exports = {
+  create: wrapPromise(create),
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/hosted-fields_external_hosted-fields.js.html b/3.111.1/hosted-fields_external_hosted-fields.js.html new file mode 100644 index 00000000..957ac8dc --- /dev/null +++ b/3.111.1/hosted-fields_external_hosted-fields.js.html @@ -0,0 +1,1649 @@ + + + + + + + + + + + hosted-fields/external/hosted-fields.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ hosted-fields/external/hosted-fields.js +

+ + + + + +
+
+
"use strict";
+
+var assign = require("../../lib/assign").assign;
+var createAssetsUrl = require("../../lib/create-assets-url");
+var isVerifiedDomain = require("../../lib/is-verified-domain");
+var Destructor = require("../../lib/destructor");
+var iFramer = require("@braintree/iframer");
+var Bus = require("framebus");
+var createDeferredClient = require("../../lib/create-deferred-client");
+var BraintreeError = require("../../lib/braintree-error");
+var composeUrl = require("./compose-url");
+var getStylesFromClass = require("./get-styles-from-class");
+var constants = require("../shared/constants");
+var errors = require("../shared/errors");
+var INTEGRATION_TIMEOUT_MS =
+  require("../../lib/constants").INTEGRATION_TIMEOUT_MS;
+var uuid = require("@braintree/uuid");
+var findParentTags = require("../shared/find-parent-tags");
+var browserDetection = require("../shared/browser-detection");
+var events = constants.events;
+var EventEmitter = require("@braintree/event-emitter");
+var injectFrame = require("./inject-frame");
+var analytics = require("../../lib/analytics");
+var allowedFields = constants.allowedFields;
+var methods = require("../../lib/methods");
+var shadow = require("../../lib/shadow");
+var findRootNode = require("../../lib/find-root-node");
+var convertMethodsToError = require("../../lib/convert-methods-to-error");
+var sharedErrors = require("../../lib/errors");
+var getCardTypes = require("../shared/get-card-types");
+var attributeValidationError = require("./attribute-validation-error");
+var wrapPromise = require("@braintree/wrap-promise");
+var focusChange = require("./focus-change");
+var destroyFocusIntercept = require("../shared/focus-intercept").destroy;
+
+var SAFARI_FOCUS_TIMEOUT = 5;
+
+/**
+ * @typedef {object} HostedFields~tokenizePayload
+ * @property {string} nonce The payment method nonce.
+ * @property {object} authenticationInsight Info about the [regulatory environment](https://developer.paypal.com/braintree/docs/guides/3d-secure/advanced-options/javascript/v3#authentication-insight) of the tokenized card. Only available if `authenticationInsight.merchantAccountId` is passed in the `tokenize` method options.
+ * @property {string} authenticationInsight.regulationEnvironment The [regulation environment](https://developer.paypal.com/braintree/docs/guides/3d-secure/advanced-options/javascript/v3#authentication-insight) for the tokenized card.
+ * @property {object} details Additional account details.
+ * @property {string} details.bin The BIN number of the card.
+ * @property {string} details.cardType Type of card, ex: Visa, MasterCard.
+ * @property {string} details.expirationMonth The expiration month of the card.
+ * @property {string} details.expirationYear The expiration year of the card.
+ * @property {string} details.cardholderName The cardholder name tokenized with the card.
+ * @property {string} details.lastFour Last four digits of card number.
+ * @property {string} details.lastTwo Last two digits of card number.
+ * @property {string} description A human-readable description.
+ * @property {string} type The payment method type, always `CreditCard`.
+ * @property {object} binData Information about the card based on the bin.
+ * @property {string} binData.commercial Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.countryOfIssuance The country of issuance.
+ * @property {string} binData.debit Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.durbinRegulated Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.healthcare Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.issuingBank The issuing bank.
+ * @property {string} binData.payroll Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.prepaid Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.productId The product id.
+ */
+
+/**
+ * @typedef {object} HostedFields~stateObject
+ * @description The event payload sent from {@link HostedFields#on|on} or {@link HostedFields#getState|getState}.
+ * @property {HostedFields~hostedFieldsCard[]} cards
+ * This will return an array of potential {@link HostedFields~hostedFieldsCard|cards}. If the card type has been determined, the array will contain only one card.
+ * Internally, Hosted Fields uses <a href="https://github.com/braintree/credit-card-type">credit-card-type</a>,
+ * an open-source card detection library.
+ * @property {string} emittedBy
+ * The name of the field associated with an event. This will not be included if returned by {@link HostedFields#getState|getState}. It will be one of the following strings:<br>
+ * - `"number"`
+ * - `"cvv"`
+ * - `"expirationDate"`
+ * - `"expirationMonth"`
+ * - `"expirationYear"`
+ * - `"postalCode"`
+ * - `"cardholderName"`
+ * @property {object} fields
+ * @property {?HostedFields~hostedFieldsFieldData} fields.number {@link HostedFields~hostedFieldsFieldData|hostedFieldsFieldData} for the number field, if it is present.
+ * @property {?HostedFields~hostedFieldsFieldData} fields.cvv {@link HostedFields~hostedFieldsFieldData|hostedFieldsFieldData} for the CVV field, if it is present.
+ * @property {?HostedFields~hostedFieldsFieldData} fields.expirationDate {@link HostedFields~hostedFieldsFieldData|hostedFieldsFieldData} for the expiration date field, if it is present.
+ * @property {?HostedFields~hostedFieldsFieldData} fields.expirationMonth {@link HostedFields~hostedFieldsFieldData|hostedFieldsFieldData} for the expiration month field, if it is present.
+ * @property {?HostedFields~hostedFieldsFieldData} fields.expirationYear {@link HostedFields~hostedFieldsFieldData|hostedFieldsFieldData} for the expiration year field, if it is present.
+ * @property {?HostedFields~hostedFieldsFieldData} fields.postalCode {@link HostedFields~hostedFieldsFieldData|hostedFieldsFieldData} for the postal code field, if it is present.
+ * @property {?HostedFields~hostedFieldsFieldData} fields.cardholderName {@link HostedFields~hostedFieldsFieldData|hostedFieldsFieldData} for the cardholder name field, if it is present.
+ */
+
+/**
+ * @typedef {object} HostedFields~binPayload
+ * @description The event payload sent from {@link HostedFields#on|on} when the {@link HostedFields#event:binAvailable|binAvailable} event is emitted.
+ * @property {string} bin The first 6 digits of the card number.
+ */
+
+/**
+ * @typedef {object} HostedFields~hostedFieldsFieldData
+ * @description Data about Hosted Fields fields, sent in {@link HostedFields~stateObject|stateObjects}.
+ * @property {HTMLElement} container Reference to the container DOM element on your page associated with the current event.
+ * @property {boolean} isFocused Whether or not the input is currently focused.
+ * @property {boolean} isEmpty Whether or not the user has entered a value in the input.
+ * @property {boolean} isPotentiallyValid
+ * A determination based on the future validity of the input value.
+ * This is helpful when a user is entering a card number and types <code>"41"</code>.
+ * While that value is not valid for submission, it is still possible for
+ * it to become a fully qualified entry. However, if the user enters <code>"4x"</code>
+ * it is clear that the card number can never become valid and isPotentiallyValid will
+ * return false.
+ * @property {boolean} isValid Whether or not the value of the associated input is <i>fully</i> qualified for submission.
+ */
+
+/**
+ * @typedef {object} HostedFields~hostedFieldsCard
+ * @description Information about the card type, sent in {@link HostedFields~stateObject|stateObjects}.
+ * @property {string} type The code-friendly representation of the card type. It will be one of the following strings:
+ * - `american-express`
+ * - `diners-club`
+ * - `discover`
+ * - `jcb`
+ * - `maestro`
+ * - `master-card`
+ * - `unionpay`
+ * - `visa`
+ * @property {string} niceType The pretty-printed card type. It will be one of the following strings:
+ * - `American Express`
+ * - `Diners Club`
+ * - `Discover`
+ * - `JCB`
+ * - `Maestro`
+ * - `MasterCard`
+ * - `UnionPay`
+ * - `Visa`
+ * @property {object} code
+ * This object contains data relevant to the security code requirements of the card brand.
+ * For example, on a Visa card there will be a <code>CVV</code> of 3 digits, whereas an
+ * American Express card requires a 4-digit <code>CID</code>.
+ * @property {string} code.name <code>"CVV"</code> <code>"CID"</code> <code>"CVC"</code>
+ * @property {number} code.size The expected length of the security code. Typically, this is 3 or 4.
+ */
+
+/**
+ * @name HostedFields#on
+ * @function
+ * @param {string} event The name of the event to which you are subscribing.
+ * @param {function} handler A callback to handle the event.
+ * @description Subscribes a handler function to a named event.
+ *
+ * **Events that emit a {@link HostedFields~stateObject|stateObject}.**
+ * * {@link HostedFields#event:blur|blur}
+ * * {@link HostedFields#event:focus|focus}
+ * * {@link HostedFields#event:empty|empty}
+ * * {@link HostedFields#event:notEmpty|notEmpty}
+ * * {@link HostedFields#event:cardTypeChange|cardTypeChange}
+ * * {@link HostedFields#event:validityChange|validityChange}
+ * * {@link HostedFields#event:inputSubmitRequest|inputSubmitRequest}
+ *
+ * **Other Events**
+ * * {@link HostedFields#event:binAvailable|binAvailable} - emits a {@link HostedFields~binPayload|bin payload}. Note: If you are using a [Referrer-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy) header that prevents the origin from being sent, this event will not fire.
+ * @example
+ * <caption>Listening to a Hosted Field event, in this case 'focus'</caption>
+ * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+ *   hostedFieldsInstance.on('focus', function (event) {
+ *     console.log(event.emittedBy, 'has been focused');
+ *   });
+ * });
+ * @returns {void}
+ */
+
+/**
+ * @name HostedFields#off
+ * @function
+ * @param {string} event The name of the event to which you are unsubscribing.
+ * @param {function} handler The callback for the event you are unsubscribing from.
+ * @description Unsubscribes the handler function to a named event.
+ * @example
+ * <caption>Subscribing and then unsubscribing from a Hosted Field event, in this case 'focus'</caption>
+ * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+ *   var callback = function (event) {
+ *     console.log(event.emittedBy, 'has been focused');
+ *   };
+ *   hostedFieldsInstance.on('focus', callback);
+ *
+ *   // later on
+ *   hostedFieldsInstance.off('focus', callback);
+ * });
+ * @returns {void}
+ */
+
+/**
+ * This event is emitted when the user requests submission of an input field, such as by pressing the Enter or Return key on their keyboard, or mobile equivalent.
+ * @event HostedFields#inputSubmitRequest
+ * @type {HostedFields~stateObject}
+ * @example
+ * <caption>Clicking a submit button upon hitting Enter (or equivalent) within a Hosted Field</caption>
+ * var hostedFields = require('braintree-web/hosted-fields');
+ * var submitButton = document.querySelector('input[type="submit"]');
+ *
+ * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+ *   hostedFieldsInstance.on('inputSubmitRequest', function () {
+ *     // User requested submission, e.g. by pressing Enter or equivalent
+ *     submitButton.click();
+ *   });
+ * });
+ */
+
+/**
+ * This event is emitted when a field transitions from having data to being empty.
+ * @event HostedFields#empty
+ * @type {HostedFields~stateObject}
+ * @example
+ * <caption>Listening to an empty event</caption>
+ * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+ *   hostedFieldsInstance.on('empty', function (event) {
+ *     console.log(event.emittedBy, 'is now empty');
+ *   });
+ * });
+ */
+
+/**
+ * This event is emitted when a field transitions from being empty to having data.
+ * @event HostedFields#notEmpty
+ * @type {HostedFields~stateObject}
+ * @example
+ * <caption>Listening to an notEmpty event</caption>
+ * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+ *   hostedFieldsInstance.on('notEmpty', function (event) {
+ *     console.log(event.emittedBy, 'is now not empty');
+ *   });
+ * });
+ */
+
+/**
+ * This event is emitted when a field loses focus.
+ * @event HostedFields#blur
+ * @type {HostedFields~stateObject}
+ * @example
+ * <caption>Listening to a blur event</caption>
+ * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+ *   hostedFieldsInstance.on('blur', function (event) {
+ *     console.log(event.emittedBy, 'lost focus');
+ *   });
+ * });
+ */
+
+/**
+ * This event is emitted when a field gains focus.
+ * @event HostedFields#focus
+ * @type {HostedFields~stateObject}
+ * @example
+ * <caption>Listening to a focus event</caption>
+ * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+ *   hostedFieldsInstance.on('focus', function (event) {
+ *     console.log(event.emittedBy, 'gained focus');
+ *   });
+ * });
+ */
+
+/**
+ * This event is emitted when activity within the number field has changed such that the possible card type has changed.
+ * @event HostedFields#cardTypeChange
+ * @type {HostedFields~stateObject}
+ * @example
+ * <caption>Listening to a cardTypeChange event</caption>
+ * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+ *   hostedFieldsInstance.on('cardTypeChange', function (event) {
+ *     if (event.cards.length === 1) {
+ *       console.log(event.cards[0].type);
+ *     } else {
+ *       console.log('Type of card not yet known');
+ *     }
+ *   });
+ * });
+ */
+
+/**
+ * This event is emitted when the validity of a field has changed. Validity is represented in the {@link HostedFields~stateObject|stateObject} as two booleans: `isValid` and `isPotentiallyValid`.
+ * @event HostedFields#validityChange
+ * @type {HostedFields~stateObject}
+ * @example
+ * <caption>Listening to a validityChange event</caption>
+ * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+ *   hostedFieldsInstance.on('validityChange', function (event) {
+ *     var field = event.fields[event.emittedBy];
+ *
+ *     if (field.isValid) {
+ *       console.log(event.emittedBy, 'is fully valid');
+ *     } else if (field.isPotentiallyValid) {
+ *       console.log(event.emittedBy, 'is potentially valid');
+ *     } else {
+ *       console.log(event.emittedBy, 'is not valid');
+ *     }
+ *   });
+ * });
+ */
+
+/**
+ * This event is emitted when the first 6 digits of the card number have been entered by the customer.
+ * @event HostedFields#binAvailable
+ * @type {string}
+ * @example
+ * <caption>Listening to a `binAvailable` event</caption>
+ * hostedFields.create({ ... }, function (createErr, hostedFieldsInstance) {
+ *   hostedFieldsInstance.on('binAvailable', function (event) {
+ *     event.bin // send bin to 3rd party bin service
+ *   });
+ * });
+ */
+
+function createInputEventHandler(fields) {
+  return function (eventData) {
+    var field;
+    var merchantPayload = eventData.merchantPayload;
+    var emittedBy = merchantPayload.emittedBy;
+    var container = fields[emittedBy].containerElement;
+
+    Object.keys(merchantPayload.fields).forEach(function (key) {
+      merchantPayload.fields[key].container = fields[key].containerElement;
+    });
+
+    field = merchantPayload.fields[emittedBy];
+
+    container.classList.toggle(
+      constants.externalClasses.FOCUSED,
+      field.isFocused
+    );
+    container.classList.toggle(constants.externalClasses.VALID, field.isValid);
+
+    container.classList.toggle(
+      constants.externalClasses.INVALID,
+      !field.isPotentiallyValid
+    );
+
+    // eslint-disable-next-line no-invalid-this
+    this._state = {
+      cards: merchantPayload.cards,
+      fields: merchantPayload.fields,
+    };
+
+    this._emit(eventData.type, merchantPayload); // eslint-disable-line no-invalid-this
+  };
+}
+
+function isVisibleEnough(node) {
+  var boundingBox = node.getBoundingClientRect();
+  var verticalMidpoint = Math.floor(boundingBox.height / 2);
+  var horizontalMidpoint = Math.floor(boundingBox.width / 2);
+
+  return (
+    boundingBox.top <
+      (window.innerHeight - verticalMidpoint ||
+        document.documentElement.clientHeight - verticalMidpoint) &&
+    boundingBox.right > horizontalMidpoint &&
+    boundingBox.bottom > verticalMidpoint &&
+    boundingBox.left <
+      (window.innerWidth - horizontalMidpoint ||
+        document.documentElement.clientWidth - horizontalMidpoint)
+  );
+}
+
+/**
+ * @class HostedFields
+ * @param {object} options The Hosted Fields {@link module:braintree-web/hosted-fields.create create} options.
+ * @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/hosted-fields.create|braintree-web.hosted-fields.create} instead.</strong>
+ * @classdesc This class represents a Hosted Fields component produced by {@link module:braintree-web/hosted-fields.create|braintree-web/hosted-fields.create}. Instances of this class have methods for interacting with the input fields within Hosted Fields' iframes.
+ */
+function HostedFields(options) {
+  var failureTimeout, clientConfig, assetsUrl, isDebug, hostedFieldsUrl;
+  var self = this;
+  var fields = {};
+  var frameReadyPromiseResolveFunctions = {};
+  var frameReadyPromises = [];
+  var componentId = uuid();
+  var sessionId = options.sessionId;
+
+  this._merchantConfigurationOptions = assign({}, options);
+
+  if (options.client) {
+    clientConfig = options.client.getConfiguration(undefined, sessionId); // eslint-disable-line no-undefined
+    assetsUrl = clientConfig.gatewayConfiguration.assetsUrl;
+    isDebug = clientConfig.isDebug;
+  } else {
+    assetsUrl = createAssetsUrl.create(options.authorization);
+    isDebug = Boolean(options.isDebug);
+  }
+
+  this._clientPromise = createDeferredClient.create({
+    client: options.client,
+    authorization: options.authorization,
+    debug: isDebug,
+    assetsUrl: assetsUrl,
+    name: "Hosted Fields",
+    sessionId: sessionId,
+  });
+
+  hostedFieldsUrl = composeUrl(assetsUrl, componentId, isDebug);
+
+  if (!options.fields || Object.keys(options.fields).length === 0) {
+    throw new BraintreeError({
+      type: sharedErrors.INSTANTIATION_OPTION_REQUIRED.type,
+      code: sharedErrors.INSTANTIATION_OPTION_REQUIRED.code,
+      message: "options.fields is required when instantiating Hosted Fields.",
+    });
+  }
+
+  EventEmitter.call(this);
+
+  this._injectedNodes = [];
+  this._destructor = new Destructor();
+  this._fields = fields;
+  this._state = {
+    fields: {},
+    cards: getCardTypes(""),
+  };
+
+  this._bus = new Bus({
+    channel: componentId,
+    verifyDomain: isVerifiedDomain,
+    targetFrames: [window],
+  });
+
+  this._destructor.registerFunctionForTeardown(function () {
+    self._bus.teardown();
+  });
+
+  // NEXT_MAJOR_VERSION analytics events should have present tense verbs
+  if (!options.client) {
+    analytics.sendEvent(
+      this._clientPromise,
+      "custom.hosted-fields.initialized.deferred-client"
+    );
+  } else {
+    analytics.sendEvent(
+      this._clientPromise,
+      "custom.hosted-fields.initialized"
+    );
+  }
+
+  Object.keys(options.fields).forEach(
+    function (key) {
+      var field, externalContainer, internalContainer, frame, frameReadyPromise;
+
+      if (!constants.allowedFields.hasOwnProperty(key)) {
+        throw new BraintreeError({
+          type: errors.HOSTED_FIELDS_INVALID_FIELD_KEY.type,
+          code: errors.HOSTED_FIELDS_INVALID_FIELD_KEY.code,
+          message: '"' + key + '" is not a valid field.',
+        });
+      }
+
+      field = options.fields[key];
+      // NEXT_MAJOR_VERSION remove selector as an option
+      // and simply make the API take a container
+      externalContainer = field.container || field.selector;
+
+      if (typeof externalContainer === "string") {
+        externalContainer = document.querySelector(externalContainer);
+      }
+
+      if (!externalContainer || externalContainer.nodeType !== 1) {
+        throw new BraintreeError({
+          type: errors.HOSTED_FIELDS_INVALID_FIELD_SELECTOR.type,
+          code: errors.HOSTED_FIELDS_INVALID_FIELD_SELECTOR.code,
+          message: errors.HOSTED_FIELDS_INVALID_FIELD_SELECTOR.message,
+          details: {
+            fieldSelector: field.selector,
+            fieldContainer: field.container,
+            fieldKey: key,
+          },
+        });
+      } else if (
+        externalContainer.querySelector('iframe[name^="braintree-"]')
+      ) {
+        throw new BraintreeError({
+          type: errors.HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME.type,
+          code: errors.HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME.code,
+          message: errors.HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME.message,
+          details: {
+            fieldSelector: field.selector,
+            fieldContainer: field.container,
+            fieldKey: key,
+          },
+        });
+      }
+
+      internalContainer = externalContainer;
+
+      if (shadow.isShadowElement(internalContainer)) {
+        internalContainer = shadow.transformToSlot(
+          internalContainer,
+          "height: 100%"
+        );
+      }
+
+      if (field.maxlength && typeof field.maxlength !== "number") {
+        throw new BraintreeError({
+          type: errors.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.type,
+          code: errors.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.code,
+          message: "The value for maxlength must be a number.",
+          details: {
+            fieldKey: key,
+          },
+        });
+      }
+
+      if (field.minlength && typeof field.minlength !== "number") {
+        throw new BraintreeError({
+          type: errors.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.type,
+          code: errors.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.code,
+          message: "The value for minlength must be a number.",
+          details: {
+            fieldKey: key,
+          },
+        });
+      }
+
+      frame = iFramer({
+        type: key,
+        name: "braintree-hosted-field-" + key,
+        style: constants.defaultIFrameStyle,
+        title:
+          field.iframeTitle ||
+          "Secure Credit Card Frame - " + constants.allowedFields[key].label,
+      });
+      this._bus.addTargetFrame(frame);
+
+      this._injectedNodes.push.apply(
+        this._injectedNodes,
+        injectFrame(componentId, frame, internalContainer, function () {
+          self.focus(key);
+        })
+      );
+
+      this._setupLabelFocus(key, externalContainer);
+      fields[key] = {
+        frameElement: frame,
+        containerElement: externalContainer,
+      };
+      frameReadyPromise = new Promise(function (resolve) {
+        frameReadyPromiseResolveFunctions[key] = resolve;
+      });
+      frameReadyPromises.push(frameReadyPromise);
+
+      this._state.fields[key] = {
+        isEmpty: true,
+        isValid: false,
+        isPotentiallyValid: true,
+        isFocused: false,
+        container: externalContainer,
+      };
+
+      // prevents loading the iframe from blocking the code
+      setTimeout(function () {
+        frame.src = hostedFieldsUrl;
+      }, 0);
+    }.bind(this)
+  );
+
+  if (this._merchantConfigurationOptions.styles) {
+    Object.keys(this._merchantConfigurationOptions.styles).forEach(function (
+      selector
+    ) {
+      var className = self._merchantConfigurationOptions.styles[selector];
+
+      if (typeof className === "string") {
+        self._merchantConfigurationOptions.styles[selector] =
+          getStylesFromClass(className);
+      }
+    });
+  }
+
+  this._bus.on(events.REMOVE_FOCUS_INTERCEPTS, function (data) {
+    destroyFocusIntercept(data && data.id);
+  });
+
+  this._bus.on(
+    events.TRIGGER_FOCUS_CHANGE,
+    focusChange.createFocusChangeHandler(componentId, {
+      onRemoveFocusIntercepts: function (element) {
+        self._bus.emit(events.REMOVE_FOCUS_INTERCEPTS, {
+          id: element,
+        });
+      },
+      onTriggerInputFocus: function (targetType) {
+        self.focus(targetType);
+      },
+    })
+  );
+
+  this._bus.on(events.READY_FOR_CLIENT, function (reply) {
+    self._clientPromise.then(function (client) {
+      reply(client);
+    });
+  });
+
+  this._bus.on(events.CARD_FORM_ENTRY_HAS_BEGUN, function () {
+    analytics.sendEvent(self._clientPromise, "hosted-fields.input.started");
+  });
+
+  this._bus.on(events.BIN_AVAILABLE, function (bin) {
+    self._emit("binAvailable", {
+      bin: bin,
+    });
+  });
+
+  failureTimeout = setTimeout(function () {
+    analytics.sendEvent(
+      self._clientPromise,
+      "custom.hosted-fields.load.timed-out"
+    );
+    self._emit("timeout");
+  }, INTEGRATION_TIMEOUT_MS);
+
+  Promise.all(frameReadyPromises).then(function (results) {
+    var reply = results[0];
+
+    clearTimeout(failureTimeout);
+    reply(
+      formatMerchantConfigurationForIframes(self._merchantConfigurationOptions)
+    );
+
+    self._cleanUpFocusIntercepts();
+
+    self._emit("ready");
+  });
+
+  this._bus.on(events.FRAME_READY, function (data, reply) {
+    frameReadyPromiseResolveFunctions[data.field](reply);
+  });
+
+  this._bus.on(events.INPUT_EVENT, createInputEventHandler(fields).bind(this));
+
+  this._destructor.registerFunctionForTeardown(function () {
+    var j, node, parent;
+
+    for (j = 0; j < self._injectedNodes.length; j++) {
+      node = self._injectedNodes[j];
+      parent = node.parentNode;
+
+      parent.removeChild(node);
+
+      parent.classList.remove(
+        constants.externalClasses.FOCUSED,
+        constants.externalClasses.INVALID,
+        constants.externalClasses.VALID
+      );
+    }
+  });
+
+  this._destructor.registerFunctionForTeardown(function () {
+    destroyFocusIntercept();
+  });
+
+  this._destructor.registerFunctionForTeardown(function () {
+    var methodNames = methods(HostedFields.prototype).concat(
+      methods(EventEmitter.prototype)
+    );
+
+    convertMethodsToError(self, methodNames);
+  });
+}
+
+EventEmitter.createChild(HostedFields);
+
+HostedFields.prototype._setupLabelFocus = function (type, container) {
+  var labels, i;
+  var self = this;
+  var rootNode = findRootNode(container);
+
+  if (container.id == null) {
+    return;
+  }
+
+  function triggerFocus() {
+    self.focus(type);
+  }
+
+  // find any labels in the normal DOM
+  labels = Array.prototype.slice.call(
+    document.querySelectorAll('label[for="' + container.id + '"]')
+  );
+  if (rootNode !== document) {
+    // find any labels within the shadow dom
+    labels = labels.concat(
+      Array.prototype.slice.call(
+        rootNode.querySelectorAll('label[for="' + container.id + '"]')
+      )
+    );
+  }
+  // find any labels surrounding the container that don't also have the `for` attribute
+  labels = labels.concat(findParentTags(container, "label"));
+  // filter out any accidental duplicates
+  labels = labels.filter(function (label, index, arr) {
+    return arr.indexOf(label) === index;
+  });
+
+  for (i = 0; i < labels.length; i++) {
+    labels[i].addEventListener("click", triggerFocus, false);
+  }
+
+  this._destructor.registerFunctionForTeardown(function () {
+    for (i = 0; i < labels.length; i++) {
+      labels[i].removeEventListener("click", triggerFocus, false);
+    }
+  });
+};
+
+HostedFields.prototype._getAnyFieldContainer = function () {
+  var self = this;
+
+  return Object.keys(this._fields).reduce(function (found, field) {
+    return found || self._fields[field].containerElement;
+  }, null);
+};
+
+HostedFields.prototype._cleanUpFocusIntercepts = function () {
+  var iframeContainer, checkoutForm;
+
+  if (document.forms.length < 1) {
+    this._bus.emit(events.REMOVE_FOCUS_INTERCEPTS);
+  } else {
+    iframeContainer = this._getAnyFieldContainer();
+    checkoutForm = findParentTags(iframeContainer, "form")[0];
+
+    if (checkoutForm) {
+      focusChange.removeExtraFocusElements(
+        checkoutForm,
+        function (id) {
+          this._bus.emit(events.REMOVE_FOCUS_INTERCEPTS, {
+            id: id,
+          });
+        }.bind(this)
+      );
+    } else {
+      this._bus.emit(events.REMOVE_FOCUS_INTERCEPTS);
+    }
+  }
+};
+
+HostedFields.prototype._attachInvalidFieldContainersToError = function (err) {
+  if (
+    !(
+      err.details &&
+      err.details.invalidFieldKeys &&
+      err.details.invalidFieldKeys.length > 0
+    )
+  ) {
+    return;
+  }
+  err.details.invalidFields = {};
+  err.details.invalidFieldKeys.forEach(
+    function (field) {
+      err.details.invalidFields[field] = this._fields[field].containerElement;
+    }.bind(this)
+  );
+};
+
+/**
+ * Get card verification challenges, such as requirements for cvv and postal code.
+ * @public
+ * @param {callback} [callback] Called on completion, containing an error if one occurred. If no callback is provided, `getChallenges` returns a promise.
+ * @example
+ * hostedFieldsInstance.getChallenges().then(function (challenges) {
+ *   challenges // ['cvv', 'postal_code']
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+HostedFields.prototype.getChallenges = function () {
+  return this._clientPromise.then(function (client) {
+    return client.getConfiguration().gatewayConfiguration.challenges;
+  });
+};
+
+/**
+ * Get supported card types configured in the Braintree Control Panel
+ * @public
+ * @param {callback} [callback] Called on completion, containing an error if one occurred. If no callback is provided, `getSupportedCardTypes` returns a promise.
+ * @example
+ * hostedFieldsInstance.getSupportedCardTypes().then(function (cardTypes) {
+ *   cardTypes // ['Visa', 'American Express', 'Mastercard']
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+HostedFields.prototype.getSupportedCardTypes = function () {
+  return this._clientPromise.then(function (client) {
+    var cards = client
+      .getConfiguration()
+      .gatewayConfiguration.creditCards.supportedCardTypes.map(function (
+        cardType
+      ) {
+        if (cardType === "MasterCard") {
+          // Mastercard changed their branding. We can't update our
+          // config without creating a breaking change, so we just
+          // hard code the change here
+          return "Mastercard";
+        }
+
+        return cardType;
+      });
+
+    return cards;
+  });
+};
+
+/**
+ * Cleanly remove anything set up by {@link module:braintree-web/hosted-fields.create|create}.
+ * @public
+ * @param {callback} [callback] Called on completion, containing an error if one occurred. No data is returned if teardown completes successfully. If no callback is provided, `teardown` returns a promise.
+ * @example
+ * hostedFieldsInstance.teardown(function (teardownErr) {
+ *   if (teardownErr) {
+ *     console.error('Could not tear down Hosted Fields!');
+ *   } else {
+ *     console.info('Hosted Fields has been torn down!');
+ *   }
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+HostedFields.prototype.teardown = function () {
+  var self = this;
+
+  return new Promise(function (resolve, reject) {
+    self._destructor.teardown(function (err) {
+      analytics.sendEvent(
+        self._clientPromise,
+        "custom.hosted-fields.teardown-completed"
+      );
+
+      if (err) {
+        reject(err);
+      } else {
+        resolve();
+      }
+    });
+  });
+};
+
+/**
+ * Tokenizes fields and returns a nonce payload.
+ * @public
+ * @param {object} [options] All tokenization options for the Hosted Fields component.
+ * @param {boolean} [options.vault=false] When true, will vault the tokenized card. Cards will only be vaulted when using a client created with a client token that includes a customer ID. Note: merchants using Advanced Fraud Tools should not use this option, as device data will not be included.
+ * @param {object} [options.authenticationInsight] Options for checking authentication insight - the [regulatory environment](https://developer.paypal.com/braintree/docs/guides/3d-secure/advanced-options/javascript/v3#authentication-insight) of the tokenized card.
+ * @param {string} options.authenticationInsight.merchantAccountId The Braintree merchant account id to use to look up the authentication insight information.
+ * @param {array} [options.fieldsToTokenize] By default, all fields will be tokenized. You may specify which fields specifically you wish to tokenize with this property. Valid options are `'number'`, `'cvv'`, `'expirationDate'`, `'expirationMonth'`, `'expirationYear'`, `'postalCode'`, `'cardholderName'`.
+ * @param {string} [options.cardholderName] When supplied, the cardholder name to be tokenized with the contents of the fields.
+ * @param {string} [options.billingAddress.postalCode] When supplied, this postal code will be tokenized along with the contents of the fields. If a postal code is provided as part of the Hosted Fields configuration, the value of the field will be tokenized and this value will be ignored.
+ * @param {string} [options.billingAddress.firstName] When supplied, this customer first name will be tokenized along with the contents of the fields.
+ * @param {string} [options.billingAddress.lastName] When supplied, this customer last name will be tokenized along with the contents of the fields.
+ * @param {string} [options.billingAddress.company] When supplied, this company name will be tokenized along with the contents of the fields.
+ * @param {string} [options.billingAddress.streetAddress] When supplied, this street address will be tokenized along with the contents of the fields.
+ * @param {string} [options.billingAddress.extendedAddress] When supplied, this extended address will be tokenized along with the contents of the fields.
+ * @param {string} [options.billingAddress.locality] When supplied, this locality (the city) will be tokenized along with the contents of the fields.
+ * @param {string} [options.billingAddress.region] When supplied, this region (the state) will be tokenized along with the contents of the fields.
+ * @param {string} [options.billingAddress.countryCodeNumeric] When supplied, this numeric country code will be tokenized along with the contents of the fields.
+ * @param {string} [options.billingAddress.countryCodeAlpha2] When supplied, this alpha 2 representation of a country will be tokenized along with the contents of the fields.
+ * @param {string} [options.billingAddress.countryCodeAlpha3] When supplied, this alpha 3 representation of a country will be tokenized along with the contents of the fields.
+ * @param {string} [options.billingAddress.countryName] When supplied, this country name will be tokenized along with the contents of the fields.
+ *
+ * @param {callback} [callback] May be used as the only parameter of the function if no options are passed in. The second argument, <code>data</code>, is a {@link HostedFields~tokenizePayload|tokenizePayload}. If no callback is provided, `tokenize` returns a function that resolves with a {@link HostedFields~tokenizePayload|tokenizePayload}.
+ * @example <caption>Tokenize a card</caption>
+ * hostedFieldsInstance.tokenize(function (tokenizeErr, payload) {
+ *   if (tokenizeErr) {
+ *     switch (tokenizeErr.code) {
+ *       case 'HOSTED_FIELDS_FIELDS_EMPTY':
+ *         // occurs when none of the fields are filled in
+ *         console.error('All fields are empty! Please fill out the form.');
+ *         break;
+ *       case 'HOSTED_FIELDS_FIELDS_INVALID':
+ *         // occurs when certain fields do not pass client side validation
+ *         console.error('Some fields are invalid:', tokenizeErr.details.invalidFieldKeys);
+ *
+ *         // you can also programmatically access the field containers for the invalid fields
+ *         tokenizeErr.details.invalidFields.forEach(function (fieldContainer) {
+ *           fieldContainer.className = 'invalid';
+ *         });
+ *         break;
+ *       case 'HOSTED_FIELDS_TOKENIZATION_FAIL_ON_DUPLICATE':
+ *         // occurs when:
+ *         //   * the client token used for client authorization was generated
+ *         //     with a customer ID and the fail on duplicate payment method
+ *         //     option is set to true
+ *         //   * the card being tokenized has previously been vaulted (with any customer)
+ *         // See: https://developer.paypal.com/braintree/docs/reference/request/client-token/generate#options.fail_on_duplicate_payment_method
+ *         console.error('This payment method already exists in your vault.');
+ *         break;
+ *       case 'HOSTED_FIELDS_TOKENIZATION_CVV_VERIFICATION_FAILED':
+ *         // occurs when:
+ *         //   * the client token used for client authorization was generated
+ *         //     with a customer ID and the verify card option is set to true
+ *         //     and you have credit card verification turned on in the Braintree
+ *         //     control panel
+ *         //   * the cvv does not pass verification (https://developer.paypal.com/braintree/docs/reference/general/testing#avs-and-cvv/cid-responses)
+ *         // See: https://developer.paypal.com/braintree/docs/reference/request/client-token/generate#options.verify_card
+ *         console.error('CVV did not pass verification');
+ *         break;
+ *       case 'HOSTED_FIELDS_FAILED_TOKENIZATION':
+ *         // occurs for any other tokenization error on the server
+ *         console.error('Tokenization failed server side. Is the card valid?');
+ *         break;
+ *       case 'HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR':
+ *         // occurs when the Braintree gateway cannot be contacted
+ *         console.error('Network error occurred when tokenizing.');
+ *         break;
+ *       default:
+ *         console.error('Something bad happened!', tokenizeErr);
+ *     }
+ *   } else {
+ *     console.log('Got nonce:', payload.nonce);
+ *   }
+ * });
+ * @example <caption>Tokenize and vault a card</caption>
+ * hostedFieldsInstance.tokenize({
+ *   vault: true
+ * }, function (tokenizeErr, payload) {
+ *   if (tokenizeErr) {
+ *     console.error(tokenizeErr);
+ *   } else {
+ *     console.log('Got nonce:', payload.nonce);
+ *   }
+ * });
+ * @example <caption>Tokenize a card with non-Hosted Fields cardholder name</caption>
+ * hostedFieldsInstance.tokenize({
+ *   cardholderName: 'First Last'
+ * }, function (tokenizeErr, payload) {
+ *   if (tokenizeErr) {
+ *     console.error(tokenizeErr);
+ *   } else {
+ *     console.log('Got nonce:', payload.nonce);
+ *   }
+ * });
+ * @example <caption>Tokenize a card with non-Hosted Fields postal code option</caption>
+ * hostedFieldsInstance.tokenize({
+ *   billingAddress: {
+ *     postalCode: '11111'
+ *   }
+ * }, function (tokenizeErr, payload) {
+ *   if (tokenizeErr) {
+ *     console.error(tokenizeErr);
+ *   } else {
+ *     console.log('Got nonce:', payload.nonce);
+ *   }
+ * });
+ * @example <caption>Tokenize a card with additional billing address options</caption>
+ * hostedFieldsInstance.tokenize({
+ *   billingAddress: {
+ *     firstName: 'First',
+ *     lastName: 'Last',
+ *     company: 'Company',
+ *     streetAddress: '123 Street',
+ *     extendedAddress: 'Unit 1',
+ *     // passing just one of the country options is sufficient to
+ *     // associate the card details with a particular country
+ *     // valid country names and codes can be found here:
+ *     // https://developer.paypal.com/braintree/docs/reference/general/countries/ruby#list-of-countries
+ *     countryName: 'United States',
+ *     countryCodeAlpha2: 'US',
+ *     countryCodeAlpha3: 'USA',
+ *     countryCodeNumeric: '840'
+ *   }
+ * }, function (tokenizeErr, payload) {
+ *   if (tokenizeErr) {
+ *     console.error(tokenizeErr);
+ *   } else {
+ *     console.log('Got nonce:', payload.nonce);
+ *   }
+ * });
+ * @example <caption>Allow tokenization with empty cardholder name field</caption>
+ * var state = hostedFieldsInstance.getState();
+ * var fields = Object.keys(state.fields);
+ *
+ * // normally, if you tried to tokenize an empty cardholder name field
+ * // you would get an error, to allow making this field optional,
+ * // tokenize all the fields except for the cardholder name field
+ * // when the cardholder name field is empty. Otherwise, tokenize
+ * // all the fields
+ * if (state.fields.cardholderName.isEmpty) {
+ *  fields = fields.filter(function (field) {
+ *    return field !== 'cardholderName';
+ *  });
+ * }
+ *
+ * hostedFieldsInstance.tokenize({
+ *  fieldsToTokenize: fields
+ * }, function (tokenizeErr, payload) {
+ *   if (tokenizeErr) {
+ *     console.error(tokenizeErr);
+ *   } else {
+ *     console.log('Got nonce:', payload.nonce);
+ *   }
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+HostedFields.prototype.tokenize = function (options) {
+  var self = this;
+
+  if (!options) {
+    options = {};
+  }
+
+  return new Promise(function (resolve, reject) {
+    self._bus.emit(events.TOKENIZATION_REQUEST, options, function (response) {
+      var err = response[0];
+      var payload = response[1];
+
+      if (err) {
+        self._attachInvalidFieldContainersToError(err);
+        reject(new BraintreeError(err));
+      } else {
+        resolve(payload);
+      }
+    });
+  });
+};
+
+/**
+ * Add a class to a {@link module:braintree-web/hosted-fields~field field}. Useful for updating field styles when events occur elsewhere in your checkout.
+ * @public
+ * @param {string} field The field you wish to add a class to. Must be a valid {@link module:braintree-web/hosted-fields~fieldOptions fieldOption}.
+ * @param {string} classname The class to be added.
+ * @param {callback} [callback] Callback executed on completion, containing an error if one occurred. No data is returned if the class is added successfully.
+ *
+ * @example
+ * hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr) {
+ *   if (addClassErr) {
+ *     console.error(addClassErr);
+ *   }
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+HostedFields.prototype.addClass = function (field, classname) {
+  var err;
+
+  if (!allowedFields.hasOwnProperty(field)) {
+    err = new BraintreeError({
+      type: errors.HOSTED_FIELDS_FIELD_INVALID.type,
+      code: errors.HOSTED_FIELDS_FIELD_INVALID.code,
+      message:
+        '"' +
+        field +
+        '" is not a valid field. You must use a valid field option when adding a class.',
+    });
+  } else if (!this._fields.hasOwnProperty(field)) {
+    err = new BraintreeError({
+      type: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,
+      code: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,
+      message:
+        'Cannot add class to "' +
+        field +
+        '" field because it is not part of the current Hosted Fields options.',
+    });
+  } else {
+    this._bus.emit(events.ADD_CLASS, {
+      field: field,
+      classname: classname,
+    });
+  }
+
+  if (err) {
+    return Promise.reject(err);
+  }
+
+  return Promise.resolve();
+};
+
+/**
+ * Removes a class to a {@link module:braintree-web/hosted-fields~field field}. Useful for updating field styles when events occur elsewhere in your checkout.
+ * @public
+ * @param {string} field The field you wish to remove a class from. Must be a valid {@link module:braintree-web/hosted-fields~fieldOptions fieldOption}.
+ * @param {string} classname The class to be removed.
+ * @param {callback} [callback] Callback executed on completion, containing an error if one occurred. No data is returned if the class is removed successfully.
+ *
+ * @example
+ * hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr) {
+ *   if (addClassErr) {
+ *     console.error(addClassErr);
+ *     return;
+ *   }
+ *
+ *   // some time later...
+ *   hostedFieldsInstance.removeClass('number', 'custom-class');
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+HostedFields.prototype.removeClass = function (field, classname) {
+  var err;
+
+  if (!allowedFields.hasOwnProperty(field)) {
+    err = new BraintreeError({
+      type: errors.HOSTED_FIELDS_FIELD_INVALID.type,
+      code: errors.HOSTED_FIELDS_FIELD_INVALID.code,
+      message:
+        '"' +
+        field +
+        '" is not a valid field. You must use a valid field option when removing a class.',
+    });
+  } else if (!this._fields.hasOwnProperty(field)) {
+    err = new BraintreeError({
+      type: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,
+      code: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,
+      message:
+        'Cannot remove class from "' +
+        field +
+        '" field because it is not part of the current Hosted Fields options.',
+    });
+  } else {
+    this._bus.emit(events.REMOVE_CLASS, {
+      field: field,
+      classname: classname,
+    });
+  }
+
+  if (err) {
+    return Promise.reject(err);
+  }
+
+  return Promise.resolve();
+};
+
+/**
+ * Sets an attribute of a {@link module:braintree-web/hosted-fields~field field}.
+ * Supported attributes are `aria-invalid`, `aria-required`, `disabled`, and `placeholder`.
+ *
+ * @public
+ * @param {object} options The options for the attribute you wish to set.
+ * @param {string} options.field The field to which you wish to add an attribute. Must be a valid {@link module:braintree-web/hosted-fields~fieldOptions fieldOption}.
+ * @param {string} options.attribute The name of the attribute you wish to add to the field.
+ * @param {string} options.value The value for the attribute.
+ * @param {callback} [callback] Callback executed on completion, containing an error if one occurred. No data is returned if the attribute is set successfully.
+ *
+ * @example <caption>Set the placeholder attribute of a field</caption>
+ * hostedFieldsInstance.setAttribute({
+ *   field: 'number',
+ *   attribute: 'placeholder',
+ *   value: '1111 1111 1111 1111'
+ * }, function (attributeErr) {
+ *   if (attributeErr) {
+ *     console.error(attributeErr);
+ *   }
+ * });
+ *
+ * @example <caption>Set the aria-required attribute of a field</caption>
+ * hostedFieldsInstance.setAttribute({
+ *   field: 'number',
+ *   attribute: 'aria-required',
+ *   value: true
+ * }, function (attributeErr) {
+ *   if (attributeErr) {
+ *     console.error(attributeErr);
+ *   }
+ * });
+ *
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+HostedFields.prototype.setAttribute = function (options) {
+  var attributeErr, err;
+
+  if (!allowedFields.hasOwnProperty(options.field)) {
+    err = new BraintreeError({
+      type: errors.HOSTED_FIELDS_FIELD_INVALID.type,
+      code: errors.HOSTED_FIELDS_FIELD_INVALID.code,
+      message:
+        '"' +
+        options.field +
+        '" is not a valid field. You must use a valid field option when setting an attribute.',
+    });
+  } else if (!this._fields.hasOwnProperty(options.field)) {
+    err = new BraintreeError({
+      type: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,
+      code: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,
+      message:
+        'Cannot set attribute for "' +
+        options.field +
+        '" field because it is not part of the current Hosted Fields options.',
+    });
+  } else {
+    attributeErr = attributeValidationError(options.attribute, options.value);
+
+    if (attributeErr) {
+      err = attributeErr;
+    } else {
+      this._bus.emit(events.SET_ATTRIBUTE, {
+        field: options.field,
+        attribute: options.attribute,
+        value: options.value,
+      });
+    }
+  }
+
+  if (err) {
+    return Promise.reject(err);
+  }
+
+  return Promise.resolve();
+};
+
+/**
+ * Sets the month options for the expiration month field when presented as a select element.
+ *
+ * @public
+ * @param {array} options An array of 12 entries corresponding to the 12 months.
+ * @param {callback} [callback] Callback executed on completion, containing an error if one occurred. No data is returned if the options are updated successfully. Errors if expirationMonth is not configured on the Hosted Fields instance or if the expirationMonth field is not configured to be a select input.
+ *
+ * @example <caption>Update the month options to spanish</caption>
+ * hostedFieldsInstance.setMonthOptions([
+ *   '01 - enero',
+ *   '02 - febrero',
+ *   '03 - marzo',
+ *   '04 - abril',
+ *   '05 - mayo',
+ *   '06 - junio',
+ *   '07 - julio',
+ *   '08 - agosto',
+ *   '09 - septiembre',
+ *   '10 - octubre',
+ *   '11 - noviembre',
+ *   '12 - diciembre'
+ * ]);
+ *
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+HostedFields.prototype.setMonthOptions = function (options) {
+  var self = this;
+  var merchantOptions = this._merchantConfigurationOptions.fields;
+  var errorMessage;
+
+  if (!merchantOptions.expirationMonth) {
+    errorMessage = "Expiration month field must exist to use setMonthOptions.";
+  } else if (!merchantOptions.expirationMonth.select) {
+    errorMessage = "Expiration month field must be a select element.";
+  }
+
+  if (errorMessage) {
+    return Promise.reject(
+      new BraintreeError({
+        type: errors.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.type,
+        code: errors.HOSTED_FIELDS_FIELD_PROPERTY_INVALID.code,
+        message: errorMessage,
+      })
+    );
+  }
+
+  return new Promise(function (resolve) {
+    self._bus.emit(events.SET_MONTH_OPTIONS, options, resolve);
+  });
+};
+
+/**
+ * Sets a visually hidden message (for screen readers) on a {@link module:braintree-web/hosted-fields~field field}.
+ *
+ * @public
+ * @param {object} options The options for the attribute you wish to set.
+ * @param {string} options.field The field to which you wish to add an attribute. Must be a valid {@link module:braintree-web/hosted-fields~field field}.
+ * @param {string} options.message The message to set.
+ *
+ * @example <caption>Set an error message on a field</caption>
+ * hostedFieldsInstance.setMessage({
+ *   field: 'number',
+ *   message: 'Invalid card number'
+ * });
+ *
+ * @example <caption>Remove the message on a field</caption>
+ * hostedFieldsInstance.setMessage({
+ *   field: 'number',
+ *   message: ''
+ * });
+ *
+ * @returns {void}
+ */
+HostedFields.prototype.setMessage = function (options) {
+  this._bus.emit(events.SET_MESSAGE, {
+    field: options.field,
+    message: options.message,
+  });
+};
+
+/**
+ * Removes a supported attribute from a {@link module:braintree-web/hosted-fields~field field}.
+ *
+ * @public
+ * @param {object} options The options for the attribute you wish to remove.
+ * @param {string} options.field The field from which you wish to remove an attribute. Must be a valid {@link module:braintree-web/hosted-fields~fieldOptions fieldOption}.
+ * @param {string} options.attribute The name of the attribute you wish to remove from the field.
+ * @param {callback} [callback] Callback executed on completion, containing an error if one occurred. No data is returned if the attribute is removed successfully.
+ *
+ * @example <caption>Remove the placeholder attribute of a field</caption>
+ * hostedFieldsInstance.removeAttribute({
+ *   field: 'number',
+ *   attribute: 'placeholder'
+ * }, function (attributeErr) {
+ *   if (attributeErr) {
+ *     console.error(attributeErr);
+ *   }
+ * });
+ *
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+HostedFields.prototype.removeAttribute = function (options) {
+  var attributeErr, err;
+
+  if (!allowedFields.hasOwnProperty(options.field)) {
+    err = new BraintreeError({
+      type: errors.HOSTED_FIELDS_FIELD_INVALID.type,
+      code: errors.HOSTED_FIELDS_FIELD_INVALID.code,
+      message:
+        '"' +
+        options.field +
+        '" is not a valid field. You must use a valid field option when removing an attribute.',
+    });
+  } else if (!this._fields.hasOwnProperty(options.field)) {
+    err = new BraintreeError({
+      type: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,
+      code: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,
+      message:
+        'Cannot remove attribute for "' +
+        options.field +
+        '" field because it is not part of the current Hosted Fields options.',
+    });
+  } else {
+    attributeErr = attributeValidationError(options.attribute);
+
+    if (attributeErr) {
+      err = attributeErr;
+    } else {
+      this._bus.emit(events.REMOVE_ATTRIBUTE, {
+        field: options.field,
+        attribute: options.attribute,
+      });
+    }
+  }
+
+  if (err) {
+    return Promise.reject(err);
+  }
+
+  return Promise.resolve();
+};
+
+/**
+ * @deprecated since version 3.8.0. Use {@link HostedFields#setAttribute|setAttribute} instead.
+ *
+ * @public
+ * @param {string} field The field whose placeholder you wish to change. Must be a valid {@link module:braintree-web/hosted-fields~fieldOptions fieldOption}.
+ * @param {string} placeholder Will be used as the `placeholder` attribute of the input.
+ * @param {callback} [callback] Callback executed on completion, containing an error if one occurred. No data is returned if the placeholder updated successfully.
+ *
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+HostedFields.prototype.setPlaceholder = function (field, placeholder) {
+  return this.setAttribute({
+    field: field,
+    attribute: "placeholder",
+    value: placeholder,
+  });
+};
+
+/**
+ * Clear the value of a {@link module:braintree-web/hosted-fields~field field}.
+ * @public
+ * @param {string} field The field you wish to clear. Must be a valid {@link module:braintree-web/hosted-fields~fieldOptions fieldOption}.
+ * @param {callback} [callback] Callback executed on completion, containing an error if one occurred. No data is returned if the field cleared successfully.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * hostedFieldsInstance.clear('number', function (clearErr) {
+ *   if (clearErr) {
+ *     console.error(clearErr);
+ *   }
+ * });
+ *
+ * @example <caption>Clear several fields</caption>
+ * hostedFieldsInstance.clear('number');
+ * hostedFieldsInstance.clear('cvv');
+ * hostedFieldsInstance.clear('expirationDate');
+ */
+HostedFields.prototype.clear = function (field) {
+  var err;
+
+  if (!allowedFields.hasOwnProperty(field)) {
+    err = new BraintreeError({
+      type: errors.HOSTED_FIELDS_FIELD_INVALID.type,
+      code: errors.HOSTED_FIELDS_FIELD_INVALID.code,
+      message:
+        '"' +
+        field +
+        '" is not a valid field. You must use a valid field option when clearing a field.',
+    });
+  } else if (!this._fields.hasOwnProperty(field)) {
+    err = new BraintreeError({
+      type: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,
+      code: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,
+      message:
+        'Cannot clear "' +
+        field +
+        '" field because it is not part of the current Hosted Fields options.',
+    });
+  } else {
+    this._bus.emit(events.CLEAR_FIELD, {
+      field: field,
+    });
+  }
+
+  if (err) {
+    return Promise.reject(err);
+  }
+
+  return Promise.resolve();
+};
+
+/**
+ * Programmatically focus a {@link module:braintree-web/hosted-fields~field field}.
+ * @public
+ * @param {string} field The field you want to focus. Must be a valid {@link module:braintree-web/hosted-fields~fieldOptions fieldOption}.
+ * @param {callback} [callback] Callback executed on completion, containing an error if one occurred. No data is returned if the field focused successfully.
+ * @returns {void}
+ * @example
+ * hostedFieldsInstance.focus('number', function (focusErr) {
+ *   if (focusErr) {
+ *     console.error(focusErr);
+ *   }
+ * });
+ * @example <caption>Using an event listener</caption>
+ * myElement.addEventListener('click', function (e) {
+ *   // In Firefox, the focus method can be suppressed
+ *   //   if the element has a tabindex property or the element
+ *   //   is an anchor link with an href property.
+ *   e.preventDefault();
+ *   hostedFieldsInstance.focus('number');
+ * });
+ */
+HostedFields.prototype.focus = function (field) {
+  var err;
+  var fieldConfig = this._fields[field];
+
+  if (!allowedFields.hasOwnProperty(field)) {
+    err = new BraintreeError({
+      type: errors.HOSTED_FIELDS_FIELD_INVALID.type,
+      code: errors.HOSTED_FIELDS_FIELD_INVALID.code,
+      message:
+        '"' +
+        field +
+        '" is not a valid field. You must use a valid field option when focusing a field.',
+    });
+  } else if (!this._fields.hasOwnProperty(field)) {
+    err = new BraintreeError({
+      type: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.type,
+      code: errors.HOSTED_FIELDS_FIELD_NOT_PRESENT.code,
+      message:
+        'Cannot focus "' +
+        field +
+        '" field because it is not part of the current Hosted Fields options.',
+    });
+  } else {
+    fieldConfig.frameElement.focus();
+
+    this._bus.emit(events.TRIGGER_INPUT_FOCUS, {
+      field: field,
+    });
+
+    if (browserDetection.isIos()) {
+      // Inputs outside of the viewport don't always scroll into view on
+      // focus in iOS Safari. 5ms timeout gives the browser a chance to
+      // do the right thing and prevents stuttering.
+      setTimeout(function () {
+        if (!isVisibleEnough(fieldConfig.containerElement)) {
+          fieldConfig.containerElement.scrollIntoView();
+        }
+      }, SAFARI_FOCUS_TIMEOUT);
+    }
+  }
+
+  if (err) {
+    return Promise.reject(err);
+  }
+
+  return Promise.resolve();
+};
+
+/**
+ * Returns an {@link HostedFields~stateObject|object} that includes the state of all fields and possible card types.
+ * @public
+ * @returns {object} {@link HostedFields~stateObject|stateObject}
+ * @example <caption>Check if all fields are valid</caption>
+ * var state = hostedFieldsInstance.getState();
+ *
+ * var formValid = Object.keys(state.fields).every(function (key) {
+ *   return state.fields[key].isValid;
+ * });
+ */
+HostedFields.prototype.getState = function () {
+  return this._state;
+};
+
+// React adds decorations to DOM nodes that cause
+// circular dependencies, so we remove them from the
+// config before sending it to the iframes. However,
+// we don't want to mutate the original object that
+// was passed in, so we create fresh objects via assign
+function formatMerchantConfigurationForIframes(config) {
+  var formattedConfig = assign({}, config);
+
+  formattedConfig.fields = assign({}, formattedConfig.fields);
+  Object.keys(formattedConfig.fields).forEach(function (field) {
+    formattedConfig.fields[field] = assign({}, formattedConfig.fields[field]);
+    delete formattedConfig.fields[field].container;
+  });
+
+  return formattedConfig;
+}
+
+module.exports = wrapPromise.wrapPrototype(HostedFields);
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/hosted-fields_index.js.html b/3.111.1/hosted-fields_index.js.html new file mode 100644 index 00000000..8ee24f14 --- /dev/null +++ b/3.111.1/hosted-fields_index.js.html @@ -0,0 +1,503 @@ + + + + + + + + + + + hosted-fields/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ hosted-fields/index.js +

+ + + + + +
+
+
"use strict";
+/** @module braintree-web/hosted-fields */
+
+var HostedFields = require("./external/hosted-fields");
+var basicComponentVerification = require("../lib/basic-component-verification");
+var errors = require("./shared/errors");
+var supportsInputFormatting = require("restricted-input/supports-input-formatting");
+var wrapPromise = require("@braintree/wrap-promise");
+var BraintreeError = require("../lib/braintree-error");
+var VERSION = process.env.npm_package_version;
+
+/**
+ * Fields used in {@link module:braintree-web/hosted-fields~fieldOptions fields options}
+ * @typedef {object} field
+ * @property {string} selector Deprecated: Now an alias for `options.container`.
+ * @property {(string|HTMLElement)} container A DOM node or CSS selector to find the container where the hosted field will be inserted.
+ * @property {string} [placeholder] Will be used as the `placeholder` attribute of the input. If `placeholder` is not natively supported by the browser, it will be polyfilled.
+ * @property {string} [type] Will be used as the `type` attribute of the input. To mask `cvv` input, for instance, `type: "password"` can be used.
+ * @property {string} [iframeTitle] The title used for the iframe containing the credit card input. By default, this will be `Secure Credit Card Frame - <the name of the specific field>`.
+ * @property {string} [internalLabel] Each Hosted Field iframe has a hidden label that is used by screen readers to identify the input. The `internalLabel` property can be used to customize the field for localization purposes. The default values are:
+ * * number: Credit Card Number
+ * * cvv: CVV
+ * * expirationDate: Expiration Date
+ * * expirationMonth: Expiration Month
+ * * expirationYear: Expiration Year
+ * * postalCode: Postal Code
+ * * cardholderName: Cardholder Name
+ * @property {boolean} [formatInput=true] Enable or disable automatic formatting on this field.
+ * @property {(object|boolean)} [maskInput=false] Enable or disable input masking when input is not focused. If set to `true` instead of an object, the defaults for the `maskInput` parameters will be used.
+ * @property {string} [maskInput.character=•] The character to use when masking the input. The default character ('•') uses a unicode symbol, so the webpage must support UTF-8 characters when using the default.
+ * @property {Boolean} [maskInput.showLastFour=false] Only applicable for the credit card field. Whether or not to show the last 4 digits of the card when masking.
+ * @property {(object|boolean)} [select] If truthy, this field becomes a `<select>` dropdown list. This can only be used for `expirationMonth` and `expirationYear` fields. If you do not use a `placeholder` property for the field, the current month/year will be the default selected value.
+ * @property {string[]} [select.options] An array of 12 strings, one per month. This can only be used for the `expirationMonth` field. For example, the array can look like `['01 - January', '02 - February', ...]`.
+ * @property {number} [maxCardLength] This option applies only to the number field. Allows a limit to the length of the card number, even if the card brand may support numbers of a greater length. If the value passed is greater than the max length for a card brand, the smaller number of the 2 values will be used. For example, is `maxCardLength` is set to 16, but an American Express card is entered (which has a max card length of 15), a max card length of 15 will be used.
+ * @property {number} [maxlength] This option applies only to the CVV and postal code fields. Will be used as the `maxlength` attribute of the input. The primary use cases for the `maxlength` option are: limiting the length of the CVV input for CVV-only verifications when the card type is known and setting the length of the postal code input when cards are coming from a known region. The default `maxlength` for the postal code input is `10`.
+ * @property {number} [minlength=3] This option applies only to the cvv and postal code fields. Will be used as the `minlength` attribute of the input.
+ * For postal code fields, the default value is 3, representing the Icelandic postal code length. This option's primary use case is to increase the `minlength`, e.g. for US customers, the postal code `minlength` can be set to 5.
+ * For cvv fields, the default value is 3. The `minlength` attribute only applies to integrations capturing a cvv without a number field.
+ * @property {string} [prefill] A value to prefill the field with. For example, when creating an update card form, you can prefill the expiration date fields with the old expiration date data.
+ * @property {boolean} [rejectUnsupportedCards=false] Deprecated since version 3.46.0, use `supportedCardBrands` instead. Only allow card types that your merchant account is able to process. Unsupported card types will invalidate the card form. e.g. if you only process Visa cards, a customer entering a American Express card would get an invalid card field. This can only be used for the `number` field.
+ * @property {object} [supportedCardBrands] Override card brands that are supported by the card form. Pass `'card-brand-id': true` to override the default in the merchant configuration and enable a card brand. Pass `'card-brand-id': false` to disable a card brand. Unsupported card types will invalidate the card form. e.g. if you only process Visa cards, a customer entering an American Express card would get an invalid card field. This can only be used for the  `number` field. (Note: only allow card types that your merchant account is actually able to process.)
+ *
+ * Valid card brand ids are:
+ * * visa
+ * * mastercard
+ * * american-express
+ * * diners-club
+ * * discover
+ * * jcb
+ * * union-pay
+ * * maestro
+ * * elo
+ * * mir
+ * * hiper
+ * * hipercard
+ */
+
+/**
+ * An object that has {@link module:braintree-web/hosted-fields~field field objects} for each field. Used in {@link module:braintree-web/hosted-fields~create create}.
+ * @typedef {object} fieldOptions
+ * @property {field} [number] A field for card number.
+ * @property {field} [expirationDate] A field for expiration date in `MM/YYYY` or `MM/YY` format. This should not be used with the `expirationMonth` and `expirationYear` properties.
+ * @property {field} [expirationMonth] A field for expiration month in `MM` format. This should be used with the `expirationYear` property.
+ * @property {field} [expirationYear] A field for expiration year in `YYYY` or `YY` format. This should be used with the `expirationMonth` property.
+ * @property {field} [cvv] A field for 3 or 4 digit card verification code (like CVV or CID). If you wish to create a CVV-only payment method nonce to verify a card already stored in your Vault, omit all other fields to only collect CVV.
+ * @property {field} [postalCode] A field for postal or region code.
+ * @property {field} [cardholderName] A field for the cardholder name on the customer's credit card.
+ */
+
+/**
+ * An object that represents CSS that will be applied in each hosted field. This object looks similar to CSS. Typically, these styles involve fonts (such as `font-family` or `color`).
+ *
+ * You may also pass the name of a class on your site that contains the styles you would like to apply. The style properties will be automatically pulled off the class and applied to the Hosted Fields inputs. Note: this is recommended for `input` elements only. If using a `select` for the expiration date, unexpected styling may occur.
+ *
+ * These are the CSS properties that Hosted Fields supports. Any other CSS should be specified on your page and outside of any Braintree configuration. Trying to set unsupported properties will fail and put a warning in the console.
+ *
+ * Supported CSS properties are:
+ * `appearance`
+ * `box-shadow`
+ * `color`
+ * `direction`
+ * `font-family`
+ * `font-size-adjust`
+ * `font-size`
+ * `font-stretch`
+ * `font-style`
+ * `font-variant-alternates`
+ * `font-variant-caps`
+ * `font-variant-east-asian`
+ * `font-variant-ligatures`
+ * `font-variant-numeric`
+ * `font-variant`
+ * `font-weight`
+ * `font`
+ * `letter-spacing`
+ * `line-height`
+ * `opacity`
+ * `outline`
+ * `margin`
+ * `margin-top`
+ * `margin-right`
+ * `margin-bottom`
+ * `margin-left`
+ * `padding`
+ * `padding-top`
+ * `padding-right`
+ * `padding-bottom`
+ * `padding-left`
+ * `text-align`
+ * `text-shadow`
+ * `transition`
+ * `-moz-appearance`
+ * `-moz-box-shadow`
+ * `-moz-osx-font-smoothing`
+ * `-moz-tap-highlight-color`
+ * `-moz-transition`
+ * `-webkit-appearance`
+ * `-webkit-box-shadow`
+ * `-webkit-font-smoothing`
+ * `-webkit-tap-highlight-color`
+ * `-webkit-transition`
+ * @typedef {object} styleOptions
+ */
+
+/**
+ * @static
+ * @function create
+ * @param {object} options Creation options:
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {fieldOptions} options.fields A {@link module:braintree-web/hosted-fields~fieldOptions set of options for each field}.
+ * @param {styleOptions} [options.styles] {@link module:braintree-web/hosted-fields~styleOptions Styles} applied to each field.
+ * @param {boolean} [options.preventAutofill=false] When true, browsers will not try to prompt the customer to autofill their credit card information.
+ * @param {string} [options.sessionId] Used in specific cases where associating SDK events with a specific external id is required.
+ * @param {callback} [callback] The second argument, `data`, is the {@link HostedFields} instance. If no callback is provided, `create` returns a promise that resolves with the {@link HostedFields} instance.
+ * @returns {void}
+ * @example
+ * braintree.hostedFields.create({
+ *   client: clientInstance,
+ *   styles: {
+ *     'input': {
+ *       'font-size': '16pt',
+ *       'color': '#3A3A3A'
+ *     },
+ *     '.number': {
+ *       'font-family': 'monospace'
+ *     },
+ *     '.valid': {
+ *       'color': 'green'
+ *     }
+ *   },
+ *   fields: {
+ *     number: {
+ *       container: '#card-number'
+ *     },
+ *     cvv: {
+ *       container: '#cvv',
+ *       placeholder: '•••'
+ *     },
+ *     expirationDate: {
+ *       container: '#expiration-date'
+ *     }
+ *   }
+ * }, callback);
+ * @example <caption>With cardholder name</caption>
+ * braintree.hostedFields.create({
+ *   client: clientInstance,
+ *   fields: {
+ *     number: {
+ *       container: '#card-number'
+ *     },
+ *     cardholderName: {
+ *       container: '#cardholder-name'
+ *     },
+ *     cvv: {
+ *       container: '#cvv',
+ *     },
+ *     expirationDate: {
+ *       container: '#expiration-date'
+ *     }
+ *   }
+ * }, callback);
+ * @example <caption>Applying styles with a class name</caption>
+ * // in document head
+ * <style>
+ *   .braintree-input-class {
+ *     color: black;
+ *   }
+ *   .braintree-valid-class {
+ *     color: green;
+ *   }
+ *   .braintree-invalid-class {
+ *     color: red;
+ *   }
+ * </style>
+ * // in a script tag
+ * braintree.hostedFields.create({
+ *   client: clientInstance,
+ *   styles: {
+ *     'input': 'braintree-input-class',
+ *     '.invalid': 'braintree-invalid-class',
+ *     '.valid': {
+ *       // you can also use the object syntax alongside
+ *       // the class name syntax
+ *       color: green;
+ *     }
+ *   },
+ *   fields: {
+ *     number: {
+ *       container: '#card-number'
+ *     },
+ *     // etc...
+ *   }
+ * }, callback);
+ * @example <caption>Right to Left Language Support</caption>
+ * braintree.hostedFields.create({
+ *   client: clientInstance,
+ *   styles: {
+ *     'input': {
+ *       // other styles
+ *       direction: 'rtl'
+ *     },
+ *   },
+ *   fields: {
+ *     number: {
+ *       container: '#card-number',
+ *       // Credit card formatting is not currently supported
+ *       // with RTL languages, so we need to turn it off for the number input
+ *       formatInput: false
+ *     },
+ *     cvv: {
+ *       container: '#cvv',
+ *       placeholder: '•••'
+ *     },
+ *     expirationDate: {
+ *       container: '#expiration-date',
+ *       type: 'month'
+ *     }
+ *   }
+ * }, callback);
+ * @example <caption>Setting up Hosted Fields to tokenize CVV only</caption>
+ * braintree.hostedFields.create({
+ *   client: clientInstance,
+ *   fields: {
+ *     // Only add the `cvv` option.
+ *     cvv: {
+ *       container: '#cvv',
+ *       placeholder: '•••'
+ *     }
+ *   }
+ * }, callback);
+ * @example <caption>Creating an expiration date update form with prefilled data</caption>
+ * var storedCreditCardInformation = {
+ *   // get this info from your server
+ *   // with a payment method lookup
+ *   month: '09',
+ *   year: '2017'
+ * };
+ *
+ * braintree.hostedFields.create({
+ *   client: clientInstance,
+ *   fields: {
+ *     expirationMonth: {
+ *       container: '#expiration-month',
+ *       prefill: storedCreditCardInformation.month
+ *     },
+ *     expirationYear: {
+ *       container: '#expiration-year',
+ *       prefill: storedCreditCardInformation.year
+ *     }
+ *   }
+ * }, callback);
+ * @example <caption>Validate the card form for supported card types</caption>
+ * braintree.hostedFields.create({
+ *   client: clientInstance,
+ *   fields: {
+ *     number: {
+ *       container: '#card-number',
+ *       supportedCardBrands: {
+ *         visa: false, // prevents Visas from showing up as valid even when the Braintree control panel is configured to allow them
+ *         'diners-club': true // allow Diners Club cards to be valid (processed as Discover cards on the Braintree backend)
+ *       }
+ *     },
+ *     cvv: {
+ *       container: '#cvv',
+ *       placeholder: '•••'
+ *     },
+ *     expirationDate: {
+ *       container: '#expiration-date',
+ *       type: 'month'
+ *     }
+ *   },
+ * }, callback);
+ */
+function create(options) {
+  return basicComponentVerification
+    .verify({
+      name: "Hosted Fields",
+      authorization: options.authorization,
+      client: options.client,
+    })
+    .then(function () {
+      var integration = new HostedFields(options);
+
+      return new Promise(function (resolve, reject) {
+        integration.on("ready", function () {
+          resolve(integration);
+        });
+        integration.on("timeout", function () {
+          reject(new BraintreeError(errors.HOSTED_FIELDS_TIMEOUT));
+        });
+      });
+    });
+}
+
+module.exports = {
+  /**
+   * @static
+   * @function supportsInputFormatting
+   * @description Returns false if input formatting will be automatically disabled due to browser incompatibility. Otherwise, returns true. For a list of unsupported browsers, [go here](https://github.com/braintree/restricted-input/blob/main/README.md#browsers-where-formatting-is-turned-off-automatically).
+   * @returns {Boolean} Returns false if input formatting will be automatically disabled due to browser incompatibility. Otherwise, returns true.
+   * @example
+   * <caption>Conditionally choosing split expiration date inputs if formatting is unavailable</caption>
+   * var canFormat = braintree.hostedFields.supportsInputFormatting();
+   * var fields = {
+   *   number: {
+   *     container: '#card-number'
+   *   },
+   *   cvv: {
+   *     container: '#cvv'
+   *   }
+   * };
+   *
+   * if (canFormat) {
+   *   fields.expirationDate = {
+   *     selection: '#expiration-date'
+   *   };
+   *   functionToCreateAndInsertExpirationDateDivToForm();
+   * } else {
+   *   fields.expirationMonth = {
+   *     selection: '#expiration-month'
+   *   };
+   *   fields.expirationYear = {
+   *     selection: '#expiration-year'
+   *   };
+   *   functionToCreateAndInsertExpirationMonthAndYearDivsToForm();
+   * }
+   *
+   * braintree.hostedFields.create({
+   *   client: clientInstance,
+   *   styles: {
+   *     // Styles
+   *   },
+   *   fields: fields
+   * }, callback);
+   */
+  supportsInputFormatting: supportsInputFormatting,
+  create: wrapPromise(create),
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/hosted-fields_shared_errors.js.html b/3.111.1/hosted-fields_shared_errors.js.html new file mode 100644 index 00000000..0dcb215e --- /dev/null +++ b/3.111.1/hosted-fields_shared_errors.js.html @@ -0,0 +1,251 @@ + + + + + + + + + + + hosted-fields/shared/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ hosted-fields/shared/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.Hosted Fields - Creation Error Codes
+ * @description Errors that occur when [creating the Hosted Fields component](./module-braintree-web_hosted-fields.html#.create).
+ * @property {UNKNOWN} HOSTED_FIELDS_TIMEOUT Occurs when Hosted Fields does not finish setting up within 60 seconds.
+ * @property {MERCHANT} HOSTED_FIELDS_INVALID_FIELD_KEY Occurs when Hosted Fields is instantiated with an invalid Field option.
+ * @property {MERCHANT} HOSTED_FIELDS_INVALID_FIELD_SELECTOR Occurs when Hosted Fields given a field selector that is not valid.
+ * @property {MERCHANT} HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME Occurs when Hosted Fields given a field selector that already contains an iframe.
+ * @property {MERCHANT} HOSTED_FIELDS_FIELD_PROPERTY_INVALID Occurs when a field configuration option is not valid.
+ */
+
+/**
+ * @name BraintreeError.Hosted Fields - Field Manipulation Error Codes
+ * @description Errors that occur when modifying fields through [`addClass`](./HostedFields.html#addClass), [`removeClass`](./HostedFields.html#removeClass), [`setAttribute`](./HostedFields.html#setAttribute), [`removeAttribute`](./HostedFields.html#removeAttribute), [`clear`](./HostedFields.html#clear), [`focus`](./HostedFields.html#focus), and [`setMonthOptions`](./HostedFields.html#setMonthOptions).
+ * @property {MERCHANT} HOSTED_FIELDS_FIELD_INVALID Occurs when attempting to modify a field that is not a valid Hosted Fields option.
+ * @property {MERCHANT} HOSTED_FIELDS_FIELD_NOT_PRESENT Occurs when attempting to modify a field that is not configured with Hosted Fields.
+ * @property {MERCHANT} HOSTED_FIELDS_FIELD_PROPERTY_INVALID Occurs when a field configuration option is not valid.
+ */
+
+/**
+ * @name BraintreeError.Hosted Fields - Set Attribute Error Codes
+ * @description Errors that occur when using the [`setAttribute` method](./HostedFields.html#setAttribute)
+ * @property {MERCHANT} HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED Occurs when trying to set an attribute that is not supported to be set.
+ * @property {MERCHANT} HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED Occurs when the type of value for an attribute is not allowed to be set.
+ */
+
+/**
+ * @name BraintreeError.Hosted Fields - Tokenize Error Codes
+ * @description Errors that occur when [tokenizing the card details with Hosted Fields](./HostedFields.html#tokenize).
+ * @property {NETWORK} HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR Occurs when the Braintree gateway cannot be contacted.
+ * @property {CUSTOMER} HOSTED_FIELDS_TOKENIZATION_FAIL_ON_DUPLICATE Occurs when attempting to vault a card, but the client token being used is configured to fail if the card already exists in the vault.
+ * @property {CUSTOMER} HOSTED_FIELDS_TOKENIZATION_CVV_VERIFICATION_FAILED Occurs when cvv verification is turned on in the Braintree control panel.
+ * @property {CUSTOMER} HOSTED_FIELDS_FAILED_TOKENIZATION Occurs when the credit card details were sent to Braintree, but failed to tokenize.
+ * @property {CUSTOMER} HOSTED_FIELDS_FIELDS_EMPTY Occurs when all the Hosted Fields inputs are empty.
+ * @property {CUSTOMER} HOSTED_FIELDS_FIELDS_INVALID Occurs when one ore more fields are invalid.
+ */
+
+var BraintreeError = require("../../lib/braintree-error");
+
+module.exports = {
+  HOSTED_FIELDS_TIMEOUT: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "HOSTED_FIELDS_TIMEOUT",
+    message: "Hosted Fields timed out when attempting to set up.",
+  },
+  HOSTED_FIELDS_INVALID_FIELD_KEY: {
+    type: BraintreeError.types.MERCHANT,
+    code: "HOSTED_FIELDS_INVALID_FIELD_KEY",
+  },
+  HOSTED_FIELDS_INVALID_FIELD_SELECTOR: {
+    type: BraintreeError.types.MERCHANT,
+    code: "HOSTED_FIELDS_INVALID_FIELD_SELECTOR",
+    message: "Selector does not reference a valid DOM node.",
+  },
+  HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME: {
+    type: BraintreeError.types.MERCHANT,
+    code: "HOSTED_FIELDS_FIELD_DUPLICATE_IFRAME",
+    message: "Element already contains a Braintree iframe.",
+  },
+  HOSTED_FIELDS_FIELD_INVALID: {
+    type: BraintreeError.types.MERCHANT,
+    code: "HOSTED_FIELDS_FIELD_INVALID",
+  },
+  HOSTED_FIELDS_FIELD_NOT_PRESENT: {
+    type: BraintreeError.types.MERCHANT,
+    code: "HOSTED_FIELDS_FIELD_NOT_PRESENT",
+  },
+  HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR: {
+    type: BraintreeError.types.NETWORK,
+    code: "HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR",
+    message: "A tokenization network error occurred.",
+  },
+  HOSTED_FIELDS_TOKENIZATION_FAIL_ON_DUPLICATE: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "HOSTED_FIELDS_TOKENIZATION_FAIL_ON_DUPLICATE",
+    message: "This credit card already exists in the merchant's vault.",
+  },
+  HOSTED_FIELDS_TOKENIZATION_CVV_VERIFICATION_FAILED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "HOSTED_FIELDS_TOKENIZATION_CVV_VERIFICATION_FAILED",
+    message: "CVV verification failed during tokenization.",
+  },
+  HOSTED_FIELDS_FAILED_TOKENIZATION: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "HOSTED_FIELDS_FAILED_TOKENIZATION",
+    message: "The supplied card data failed tokenization.",
+  },
+  HOSTED_FIELDS_FIELDS_EMPTY: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "HOSTED_FIELDS_FIELDS_EMPTY",
+    message: "All fields are empty. Cannot tokenize empty card fields.",
+  },
+  HOSTED_FIELDS_FIELDS_INVALID: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "HOSTED_FIELDS_FIELDS_INVALID",
+    message:
+      "Some payment input fields are invalid. Cannot tokenize invalid card fields.",
+  },
+  HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "HOSTED_FIELDS_ATTRIBUTE_NOT_SUPPORTED",
+  },
+  HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "HOSTED_FIELDS_ATTRIBUTE_VALUE_NOT_ALLOWED",
+  },
+  HOSTED_FIELDS_FIELD_PROPERTY_INVALID: {
+    type: BraintreeError.types.MERCHANT,
+    code: "HOSTED_FIELDS_FIELD_PROPERTY_INVALID",
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/icons/home.svg b/3.111.1/icons/home.svg new file mode 100644 index 00000000..676d2d38 --- /dev/null +++ b/3.111.1/icons/home.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/3.111.1/icons/search.svg b/3.111.1/icons/search.svg new file mode 100644 index 00000000..ccc84b62 --- /dev/null +++ b/3.111.1/icons/search.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/3.111.1/index.html b/3.111.1/index.html new file mode 100644 index 00000000..753e0e8d --- /dev/null +++ b/3.111.1/index.html @@ -0,0 +1,456 @@ + + + + + + + + + Home - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + + + + + + + + + + +
+
+

Braintree Web Client Reference v3.111.1

+

+ +

+

+

Overview

+

The Braintree JavaScript SDK is split up into several modules. Each module is also represented by a class encapsulating the actions that module can perform. In general, each SDK feature is represented by its own standalone module. You can include as many or as few of these modules in your page depending on the Braintree features you will be using.

+

Each module exports a create function which is responsible for returning an instance of that module's class. For instance, the braintree-web/paypal module's create method will return an instance of the PayPal class.

+

+

Module hierarchy

+

Many modules of this SDK require an instance of our Client for communicating to our servers. In these cases, a single Client instance can be used for the creation of several other module instances.

+
braintree.client.create(...) --------> Client ─┐
+                         ┌─────────────────────┤
+braintree.paypal.create(...) --------> PayPal  │
+                               ┌───────────────┘
+braintree.hostedFields.create(...) --> HostedFields
+
+

+

Callbacks

+

This SDK uses the Node.js callback style, with callbacks passed as the last argument to a function. Callbacks are expected to receive possible errors as the first parameter, and any returned data as the second:

+
braintree.client.create({...}, callback);
+
+function callback(err, clientInstance) { ... }
+
+

+

Promises

+

In addition to callbacks, all asynchronous methods will return a Promise if no callback is provided:

+
braintree.client
+  .create({
+    authorization: CLIENT_AUTHORIZATION,
+  })
+  .then(function (client) {
+    // Create other components
+  });
+
+

+

Browser support

+

The Braintree JS SDK provides support for numerous browsers and devices. There are, however, caveats with certain integrations and browser combinations.

+

While braintree-web will work in browsers other than the ones below, these represent the platforms against which we actively test. If you have problems with a specific browser or device, contact our Support team.

+

+

Desktop

+
    +
  • Chrome latest
  • +
  • Firefox latest
  • +
  • Microsoft Edge latest
  • +
  • Safari 8+
  • +
+

+

Mobile

+

iOS

+
    +
  • Safari 8+ (9+ for 3D Secure)
  • +
  • Chrome 48+ (iOS 9+)
  • +
+

Android

+
    +
  • Native browser 4.4+
  • +
  • Chrome
  • +
  • Firefox +
  • +
+

Webviews and hybrid environments

+

If you are using PayPal in a mobile webview, we recommend using PopupBridge for iOS or Android to open the PayPal authentication flow in a mobile browser for improved security.

+

Additionally, braintree-web is neither tested nor developed for hybrid runtimes such as Cordova, PhoneGap, Ionic, React Native, and Electron. While some success may be had in such environments, our SDK is optimized for the browser and its security policies and may not function correctly outside of them.

+

+

Teardown

+

In certain scenarios you may need to remove your braintree-web integration. This is common in single page applications, modal flows, and other situations where state management is a key factor. Any module returned from a braintree.component.create call that can be torn down will include a teardown function.

+

Invoking teardown will clean up any DOM nodes, event handlers, popups and/or iframes that have been created by the integration. Additionally, teardown accepts a callback which you can use to know when it is safe to proceed.

+
hostedFieldsInstance.teardown(function (err) {
+  if (err) {
+    console.error("Could not tear down Hosted Fields!");
+  } else {
+    console.log("Hosted Fields has been torn down!");
+  }
+});
+
+

If you happen to call this method while the instance's teardown is in progress, you'll receive an error. Once completed, calling any methods on the instance will throw an error.

+

+

Using braintree-web with a Content Security Policy (CSP)

+

Content Security Policy is a feature of web browsers that mitigates cross-site scripting and other attacks. By limiting the origins of resources that may be loaded on your page, you can maintain tighter control over any potentially malicious code. We recommend considering the implementation of a CSP when available.

+

Basic Directives

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SandboxProduction
script-srcjs.braintreegateway.com
assets.braintreegateway.com
js.braintreegateway.com
assets.braintreegateway.com
img-srcassets.braintreegateway.com
data:
assets.braintreegateway.com
data:
child-srcassets.braintreegateway.comassets.braintreegateway.com
frame-srcassets.braintreegateway.comassets.braintreegateway.com
connect-srcapi.sandbox.braintreegateway.com
client-analytics.sandbox.braintreegateway.com
*.braintree-api.com
api.braintreegateway.com
client-analytics.braintreegateway.com
*.braintree-api.com
+

PayPal Specific Directives

+

If using the PayPal Checkout component, include these additional directives:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SandboxProduction
script-srcwww.paypalobjects.com
*.paypal.com
'unsafe-inline'
www.paypalobjects.com
*.paypal.com
'unsafe-inline'
style-src'unsafe-inline''unsafe-inline'
img-srccheckout.paypal.comcheckout.paypal.com
child-src*.paypal.com*.paypal.com
frame-src*.paypal.com*.paypal.com
+

Google Pay Specific Directives

+

If using the Google Pay component, include these additional directives:

+ + + + + + + + + + + + + + + + + + + + +
SandboxProduction
script-srcpay.google.compay.google.com
connect-srcpay.google.com
https://google.com/pay
https://pay.google.com
https://pay.google.com/about/redirect/
pay.google.com
https://google.com/pay
https://pay.google.com
https://pay.google.com/about/redirect/
+

If Google adds redirects or changes URLs related to the Google Pay component, the domains or URLs in these directives may change.

+

3D Secure Specific Directives

+

If using the 3D Secure component, include these additional directives:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SandboxProduction
script-srcsongbirdstag.cardinalcommerce.comsongbird.cardinalcommerce.com
frame-src**
connect-src*.cardinalcommerce.com*.cardinalcommerce.com
form-action**
+

3D Secure 2 utilizes an iframe implementation that requires the use of the issuing bank's full ACS URL. In contrast to 3D Secure 1, the 3D Secure 2 core framework does not allow masked URLs or redirects. Given that the list of possible ACS URLs changes regularly and varies between issuers and ACS providers, there is not a strict CSP configuration available for 3D Secure 2.

+

Additionally, 3D Secure 2 includes a data collection flow called "3DS Method" or "Method URL Collection", which also utilizes the ACS URL directly. This process increases authentication success significantly and is considered mandatory by Visa. Blocking this process through a CSP can potentially result in authentication failures and increased friction within the checkout experience.

+

If maintaining a CSP in an integration that uses 3D Secure, merchants can consider setting frame-src * to whitelist all potential ACS URLs that could be utilized during the 3D Secure authentication process.

+

Data Collector Specific Directives

+

If using Kount with the Data Collector component, adhere to the Kount CSP guide.

+

For Braintree Fraud Protection, use these directives:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
SandboxProduction
script-src*.paypal.com*.paypal.com
child-src*.paypal.com*.paypal.com
frame-src*.paypal.com*.paypal.com
+

Executing In-Line Scripts

+ + + + + + + + + + + + + + + + + + + + +
SandboxProduction
script-src'unsafe-inline''unsafe-inline'
(see documentation)'sha__-{HASHED_INLINE_SCRIPT}'
'nonce-ONE_TIME-BASE64'
'sha__-{HASHED_INLINE_SCRIPT}'
'nonce-ONE_TIME-BASE64'
+

Allowing execution of any inline script(s) may lead to security vulnerabilities. To restrict the execution of inline scripts to known code, include a hash-source of the inline script(s) in the script-src directive or generate an one-time use nonce-source to allow specific <script> blocks to execute.

+

The generation and appropriate use of these hash-source or one-time nonce-source values are specific to your HTML files and/or server setup. See documentation on "content security policy" and "script-src" directive.

+

Example of hash of inline script(s):

+
<html><head><meta http-equiv="Content-Security-Policy" content="
+    Content-Security-Policy: script-src 'unsafe-inline' 'sha256-zVu1jtS1MTItvxLN0tAAAAOAOlDFjjz/oAIlo5KIjMs='
+"/><head>
+<script>console.log("execution of inline-script")</script>
+</html>
+
+

ℹ Try generating a hash of the contents of the <script> tag here.

+

⚠️ Note that any change to the <script> blocks including empty-space changes will change the hash. For example:

+
<script>
+  console.log("execution of inline-script");
+</script>
+
+

Adding empty-space around the content of the <script> tags changes the matching hash. As a result, attempts to load the HTML would show the following error (visible in the developer console):

+
+

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' 'sha256-zVu1jtS1MTItvxLN0tAAAAOAOlDFjjz/oAIlo5KIjMs=' js.braintreegateway.com assets.braintreegateway.com pay.google.com". Either the 'unsafe-inline' keyword, a hash ('sha256-y5bhUNykMSWsqlMH7ObmFlUgQFkbMBMmFmeQ3H9wltI='), or a nonce ('nonce-...') is required to enable inline execution.

+
+

ℹ️ In the example above, the correct hash, sha256-y5bhUNykMSWsqlMH7ObmFlUgQFkbMBMmFmeQ3H9wltI=, appears in the last sentence of the error message.

+

Example of nonce-source

+
<html><head>
+  <meta http-equiv="Content-Security-Policy" content="
+    Content-Security-Policy: script-src 'unsafe-inline' 'nonce-123a456b789c000d='
+"/>
+<head>
+<script nonce="123a456b789c000d=">console.log("execution of inline-script");</script>
+<script nonce="123a456b789c000d=">var sum = 1 + 2;</script>
+</html>
+
+

ℹ️️ nonce-source should be one-time use; that is, it changes for each request.

+

ℹ️️ nonce-source should be a randomly generated, non-guessable,cryptographically strong value; the standard of whats cryptographical strong continue to evolve, but is currently at least 128 bits.

+

ℹ️️ It is recommended that a nonce-source be used with HTML templating engine.

+
+
+ + + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/index.js.html b/3.111.1/index.js.html new file mode 100644 index 00000000..a0a570ef --- /dev/null +++ b/3.111.1/index.js.html @@ -0,0 +1,246 @@ + + + + + + + + + + + index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ index.js +

+ + + + + +
+
+
"use strict";
+/**
+ * @module braintree-web
+ * @description This is the top-level module exported by the Braintree JavaScript SDK. In a browser environment, this will be the global <code>braintree</code> object. In a CommonJS environment (like Browserify or Webpack), it will be the default export of the <code>braintree-web</code> package. In AMD environments (like RequireJS), it can be `require`d like other modules.
+ * @example
+ * <caption>CommonJS</caption>
+ * var braintree = require('braintree-web');
+ *
+ * braintree.client.create(...);
+ * @example
+ * <caption>In the browser</caption>
+ * <script src="https://js.braintreegateway.com/web/{@pkg version}/js/client.min.js"></script>
+ * <script>
+ *   window.braintree.client.create(...);
+ * </script>
+ * @example
+ * <caption>AMD</caption>
+ * // main.js
+ * require.config({
+ *   paths: {
+ *     braintreeClient: 'https://js.braintreegateway.com/web/{@pkg version}/js/client.min'
+ *   }
+ * });
+ *
+ * require(['braintreeClient'], function (braintreeClient) {
+ *   braintreeClient.create(...);
+ * });
+ */
+
+/**
+ * @global
+ * @callback callback
+ * @param {?BraintreeError} [err] `null` or `undefined` if there was no error.
+ * @param {?any} [data] The successful result of the asynchronous function call (if data exists).
+ * @description The Node.js-style callback pattern used throughout the SDK.
+ * @returns {void}
+ */
+
+var americanExpress = require("./american-express");
+var applePay = require("./apple-pay");
+var client = require("./client");
+var fastlane = require("./fastlane");
+var dataCollector = require("./data-collector");
+var hostedFields = require("./hosted-fields");
+var localPayment = require("./local-payment");
+var masterpass = require("./masterpass");
+var paymentRequest = require("./payment-request");
+var paypal = require("./paypal");
+var paypalCheckout = require("./paypal-checkout");
+var googlePayment = require("./google-payment");
+var sepa = require("./sepa");
+var threeDSecure = require("./three-d-secure");
+var unionpay = require("./unionpay");
+var usBankAccount = require("./us-bank-account");
+var vaultManager = require("./vault-manager");
+var venmo = require("./venmo");
+var visaCheckout = require("./visa-checkout");
+var preferredPaymentMethods = require("./preferred-payment-methods");
+var VERSION = process.env.npm_package_version;
+
+module.exports = {
+  /** @type {module:braintree-web/fastlane} */
+  fastlane: fastlane,
+  /** @type {module:braintree-web/american-express} */
+  americanExpress: americanExpress,
+  /** @type {module:braintree-web/apple-pay} */
+  applePay: applePay,
+  /** @type {module:braintree-web/client} */
+  client: client,
+  /** @type {module:braintree-web/data-collector} */
+  dataCollector: dataCollector,
+  /** @type {module:braintree-web/hosted-fields} */
+  hostedFields: hostedFields,
+  /** @type {module:braintree-web/local-payment} */
+  localPayment: localPayment,
+  /** @type {module:braintree-web/masterpass} */
+  masterpass: masterpass,
+  /** @type {module:braintree-web/google-payment} */
+  googlePayment: googlePayment,
+  /** @type {module:braintree-web/payment-request} */
+  paymentRequest: paymentRequest,
+  /** @type {module:braintree-web/paypal} */
+  paypal: paypal,
+  /** @type {module:braintree-web/paypal-checkout} */
+  paypalCheckout: paypalCheckout,
+  /** @type {module:braintree-web/three-d-secure} */
+  threeDSecure: threeDSecure,
+  /** @type {module:braintree-web/unionpay} */
+  unionpay: unionpay,
+  /** @type {module:braintree-web/us-bank-account} */
+  usBankAccount: usBankAccount,
+  /** @type {module:braintree-web/vault-manager} */
+  vaultManager: vaultManager,
+  /** @type {module:braintree-web/venmo} */
+  venmo: venmo,
+  /** @type {module:braintree-web/visa-checkout} */
+  visaCheckout: visaCheckout,
+  /** @type {module:braintree-web/sepa} */
+  sepa: sepa,
+  /** @type {module:braintree-web/preferred-payment-methods} */
+  preferredPaymentMethods: preferredPaymentMethods,
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/lib_braintree-error.js.html b/3.111.1/lib_braintree-error.js.html new file mode 100644 index 00000000..8c924381 --- /dev/null +++ b/3.111.1/lib_braintree-error.js.html @@ -0,0 +1,226 @@ + + + + + + + + + + + lib/braintree-error.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ lib/braintree-error.js +

+ + + + + +
+
+
"use strict";
+
+var enumerate = require("./enumerate");
+
+/**
+ * @class
+ * @global
+ * @param {object} options Construction options
+ * @classdesc This class is used to report error conditions, frequently as the first parameter to callbacks throughout the Braintree SDK.
+ * @description <strong>You cannot use this constructor directly. Interact with instances of this class through {@link callback callbacks}.</strong>
+ */
+function BraintreeError(options) {
+  if (!BraintreeError.types.hasOwnProperty(options.type)) {
+    throw new Error(options.type + " is not a valid type.");
+  }
+
+  if (!options.code) {
+    throw new Error("Error code required.");
+  }
+
+  if (!options.message) {
+    throw new Error("Error message required.");
+  }
+
+  this.name = "BraintreeError";
+
+  /**
+   * @type {string}
+   * @description A code that corresponds to specific errors.
+   */
+  this.code = options.code;
+
+  /**
+   * @type {string}
+   * @description A short description of the error.
+   */
+  this.message = options.message;
+
+  /**
+   * @type {BraintreeError.types}
+   * @description The type of error.
+   */
+  this.type = options.type;
+
+  /**
+   * @type {object=}
+   * @description Additional information about the error, such as an underlying network error response.
+   */
+  this.details = options.details;
+}
+
+BraintreeError.prototype = Object.create(Error.prototype);
+BraintreeError.prototype.constructor = BraintreeError;
+
+/**
+ * Enum for {@link BraintreeError} types.
+ * @name BraintreeError.types
+ * @enum
+ * @readonly
+ * @memberof BraintreeError
+ * @property {string} CUSTOMER An error caused by the customer.
+ * @property {string} MERCHANT An error that is actionable by the merchant.
+ * @property {string} NETWORK An error due to a network problem.
+ * @property {string} INTERNAL An error caused by Braintree code.
+ * @property {string} UNKNOWN An error where the origin is unknown.
+ */
+BraintreeError.types = enumerate([
+  "CUSTOMER",
+  "MERCHANT",
+  "NETWORK",
+  "INTERNAL",
+  "UNKNOWN",
+]);
+
+BraintreeError.findRootError = function (err) {
+  if (
+    err instanceof BraintreeError &&
+    err.details &&
+    err.details.originalError
+  ) {
+    return BraintreeError.findRootError(err.details.originalError);
+  }
+
+  return err;
+};
+
+module.exports = BraintreeError;
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/lib_errors.js.html b/3.111.1/lib_errors.js.html new file mode 100644 index 00000000..c4d6bd95 --- /dev/null +++ b/3.111.1/lib_errors.js.html @@ -0,0 +1,187 @@ + + + + + + + + + + + lib/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ lib/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.Shared Internal Error Codes
+ * @ignore
+ * @description These codes should never be experienced by the merchant directly.
+ * @property {INTERNAL} INVALID_USE_OF_INTERNAL_FUNCTION Occurs when the client is created without a gateway configuration. Should never happen.
+ */
+
+/**
+ * @name BraintreeError.Shared Errors - Component Creation Error Codes
+ * @description Errors that occur when creating components.
+ * @property {MERCHANT} INSTANTIATION_OPTION_REQUIRED Occurs when a component is created that is missing a required option.
+ * @property {MERCHANT} INCOMPATIBLE_VERSIONS Occurs when a component is created with a client with a different version than the component.
+ * @property {NETWORK} CLIENT_SCRIPT_FAILED_TO_LOAD Occurs when a component attempts to load the Braintree client script, but the request fails.
+ */
+
+/**
+ * @name BraintreeError.Shared Errors - Component Instance Error Codes
+ * @description Errors that occur when using instances of components.
+ * @property {MERCHANT} METHOD_CALLED_AFTER_TEARDOWN Occurs when a method is called on a component instance after it has been torn down.
+ */
+
+var BraintreeError = require("./braintree-error");
+
+module.exports = {
+  INVALID_USE_OF_INTERNAL_FUNCTION: {
+    type: BraintreeError.types.INTERNAL,
+    code: "INVALID_USE_OF_INTERNAL_FUNCTION",
+  },
+  INSTANTIATION_OPTION_REQUIRED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "INSTANTIATION_OPTION_REQUIRED",
+  },
+  INCOMPATIBLE_VERSIONS: {
+    type: BraintreeError.types.MERCHANT,
+    code: "INCOMPATIBLE_VERSIONS",
+  },
+  CLIENT_SCRIPT_FAILED_TO_LOAD: {
+    type: BraintreeError.types.NETWORK,
+    code: "CLIENT_SCRIPT_FAILED_TO_LOAD",
+    message: "Braintree client script could not be loaded.",
+  },
+  METHOD_CALLED_AFTER_TEARDOWN: {
+    type: BraintreeError.types.MERCHANT,
+    code: "METHOD_CALLED_AFTER_TEARDOWN",
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/lib_frame-service_external_strategies_modal.js.html b/3.111.1/lib_frame-service_external_strategies_modal.js.html new file mode 100644 index 00000000..47a7c7e6 --- /dev/null +++ b/3.111.1/lib_frame-service_external_strategies_modal.js.html @@ -0,0 +1,259 @@ + + + + + + + + + + + lib/frame-service/external/strategies/modal.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ lib/frame-service/external/strategies/modal.js +

+ + + + + +
+
+
"use strict";
+
+var iFramer = require("@braintree/iframer");
+var assign = require("../../../assign").assign;
+var browserDetection = require("../../shared/browser-detection");
+
+var ELEMENT_STYLES = {
+  position: "fixed",
+  top: 0,
+  left: 0,
+  bottom: 0,
+  padding: 0,
+  margin: 0,
+  border: 0,
+  outline: "none",
+  zIndex: 20001,
+  background: "#FFFFFF",
+};
+
+function noop() {}
+
+/**
+ *
+ * We should not ever really use the Modal. Modals are _like_  popups, but the key difference is that the customer can't actually verify it's app domain and thus secure/valid. Old PP sdk (./src/paypal) uses this
+ * to get info from webviews (e.g. facebook).
+ */
+
+function Modal(options) {
+  this._closed = null;
+  this._frame = null;
+  this._options = options || {};
+  this._container = this._options.container || document.body;
+}
+
+Modal.prototype.initialize = noop;
+
+Modal.prototype.open = function () {
+  var iframerConfig = {
+    src: this._options.openFrameUrl,
+    name: this._options.name,
+    scrolling: "yes",
+    height: "100%",
+    width: "100%",
+    style: assign({}, ELEMENT_STYLES),
+    title: "Lightbox Frame",
+  };
+
+  if (browserDetection.isIos()) {
+    // WKWebView has buggy behavior when scrolling a fixed position modal. The workaround is to lock scrolling in
+    // the background. When modal is closed, we restore scrolling and return to the previous scroll position.
+    if (browserDetection.isIosWKWebview()) {
+      this._lockScrolling();
+      // Allows WKWebView to scroll all the way down to bottom
+      iframerConfig.style = {};
+    }
+
+    this._el = document.createElement("div");
+
+    assign(this._el.style, ELEMENT_STYLES, {
+      height: "100%",
+      width: "100%",
+      overflow: "auto",
+      "-webkit-overflow-scrolling": "touch",
+    });
+
+    this._frame = iFramer(iframerConfig);
+    this._el.appendChild(this._frame);
+  } else {
+    this._el = this._frame = iFramer(iframerConfig);
+  }
+  this._closed = false;
+
+  this._container.appendChild(this._el);
+};
+
+Modal.prototype.focus = noop;
+
+Modal.prototype.close = function () {
+  this._container.removeChild(this._el);
+  this._frame = null;
+  this._closed = true;
+  if (browserDetection.isIosWKWebview()) {
+    this._unlockScrolling();
+  }
+};
+
+Modal.prototype.isClosed = function () {
+  return Boolean(this._closed);
+};
+
+Modal.prototype.redirect = function (redirectUrl) {
+  this._frame.src = redirectUrl;
+};
+
+Modal.prototype._unlockScrolling = function () {
+  document.body.style.overflow = this._savedBodyProperties.overflowStyle;
+  document.body.style.position = this._savedBodyProperties.positionStyle;
+  window.scrollTo(
+    this._savedBodyProperties.left,
+    this._savedBodyProperties.top
+  );
+  delete this._savedBodyProperties;
+};
+
+Modal.prototype._lockScrolling = function () {
+  var doc = document.documentElement;
+
+  // From https://stackoverflow.com/questions/9538868/prevent-body-from-scrolling-when-a-modal-is-opened#comment65626743_24727206
+  this._savedBodyProperties = {
+    left: (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0),
+    top: (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0),
+    overflowStyle: document.body.style.overflow,
+    positionStyle: document.body.style.position,
+  };
+  document.body.style.overflow = "hidden";
+  document.body.style.position = "fixed";
+  window.scrollTo(0, 0);
+};
+
+module.exports = Modal;
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/local-payment_external_local-payment.js.html b/3.111.1/local-payment_external_local-payment.js.html new file mode 100644 index 00000000..03f0f9e1 --- /dev/null +++ b/3.111.1/local-payment_external_local-payment.js.html @@ -0,0 +1,1268 @@ + + + + + + + + + + + local-payment/external/local-payment.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ local-payment/external/local-payment.js +

+ + + + + +
+
+
"use strict";
+
+var frameService = require("../../lib/frame-service/external");
+var BraintreeError = require("../../lib/braintree-error");
+var useMin = require("../../lib/use-min");
+var VERSION = process.env.npm_package_version;
+var INTEGRATION_TIMEOUT_MS =
+  require("../../lib/constants").INTEGRATION_TIMEOUT_MS;
+var analytics = require("../../lib/analytics");
+var methods = require("../../lib/methods");
+var convertMethodsToError = require("../../lib/convert-methods-to-error");
+var convertToBraintreeError = require("../../lib/convert-to-braintree-error");
+var ExtendedPromise = require("@braintree/extended-promise");
+var querystring = require("../../lib/querystring");
+var wrapPromise = require("@braintree/wrap-promise");
+var constants = require("./constants");
+var errors = require("../shared/errors");
+var assign = require("../../lib/assign").assign;
+
+var DEFAULT_WINDOW_WIDTH = 1282;
+var DEFAULT_WINDOW_HEIGHT = 720;
+
+ExtendedPromise.suppressUnhandledPromiseMessage = true;
+
+/**
+ * @class
+ * @param {object} options see {@link module:braintree-web/local-payment.create|local-payment.create}
+ * @classdesc This class represents a LocalPayment component. Instances of this class can open a LocalPayment window for paying with alternate payments local to a specific country. Any additional UI, such as disabling the page while authentication is taking place, is up to the developer.
+ *
+ * @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/local-payment.create|braintree-web.local-payment.create} instead.</strong>
+ */
+function LocalPayment(options) {
+  this._client = options.client;
+  this._assetsUrl =
+    options.client.getConfiguration().gatewayConfiguration.assetsUrl +
+    "/web/" +
+    VERSION;
+  this._isDebug = options.client.getConfiguration().isDebug;
+  this._loadingFrameUrl =
+    this._assetsUrl +
+    "/html/local-payment-landing-frame" +
+    useMin(this._isDebug) +
+    ".html";
+  this._authorizationInProgress = false;
+  this._paymentType = "unknown";
+  this._merchantAccountId = options.merchantAccountId;
+  if (options.redirectUrl) {
+    this._redirectUrl = options.redirectUrl;
+    this._isRedirectFlow = true;
+  }
+}
+
+LocalPayment.prototype._initialize = function () {
+  var self = this;
+  var client = this._client;
+  var failureTimeout = setTimeout(function () {
+    analytics.sendEvent(client, "local-payment.load.timed-out");
+  }, INTEGRATION_TIMEOUT_MS);
+
+  return new Promise(function (resolve) {
+    frameService.create(
+      {
+        name: "localpaymentlandingpage",
+        dispatchFrameUrl:
+          self._assetsUrl +
+          "/html/dispatch-frame" +
+          useMin(self._isDebug) +
+          ".html",
+        openFrameUrl: self._loadingFrameUrl,
+      },
+      function (service) {
+        self._frameService = service;
+        clearTimeout(failureTimeout);
+        analytics.sendEvent(client, "local-payment.load.succeeded");
+        resolve(self);
+      }
+    );
+  });
+};
+
+/**
+ * Options used for most local payment types.
+ * @typedef {object} LocalPayment~StartPaymentOptions
+ * @property {object} fallback Configuration for what to do when app switching back from a Bank app on a mobile device. Only applicable to the popup flow.
+ * @property {string} fallback.buttonText The text to display in a button to redirect back to the merchant page.
+ * @property {string} fallback.url The url to redirect to when the redirect button is pressed. Query params will be added to the url to process the data returned from the bank.
+ * @property {string} fallback.cancelButtonText The text to display in a button to redirect back to the merchant page when the customer cancels. If no `cancelButtonText` is provided, `buttonText` will be used.
+ * @property {string} fallback.cancelUrl The url to redirect to when the redirect button is pressed when the customer cancels. Query params will be added to the url to check the state of the payment. If no `cancelUrl` is provided, `url` will be used.
+ * @property {object} [windowOptions] The options for configuring the window that is opened when starting the payment. Only applicable to the popup flow.
+ * @property {number} [windowOptions.width=1282] The width in pixels of the window opened when starting the payment. The default width size is this large to allow various banking partner landing pages to display the QR Code to be scanned by the bank's mobile app. Many will not display the QR code when the window size is smaller than a standard desktop screen.
+ * @property {number} [windowOptions.height=720] The height in pixels of the window opened when starting the payment.
+ * @property {string} amount The amount to authorize for the transaction.
+ * @property {string} currencyCode The currency to process the payment (three-character ISO-4217).
+ * @property {string} [displayName] The merchant name displayed inside of the window that is opened when starting the payment.
+ * @property {string} paymentType The type of local payment. See https://developer.paypal.com/braintree/docs/guides/local-payment-methods/client-side-custom
+ * @property {string} paymentTypeCountryCode The country code of the local payment. This value must be one of the supported country codes for a given local payment type listed {@link https://developer.paypal.com/braintree/docs/guides/local-payment-methods/client-side-custom/javascript/v3#render-local-payment-method-buttons|here}. For local payments supported in multiple countries, this value may determine which banks are presented to the customer.
+ * @property {string} email Payer email of the customer.
+ * @property {string} givenName First name of the customer.
+ * @property {string} surname Last name of the customer.
+ * @property {string} phone Phone number of the customer.
+ * @property {string} bic Bank Identification Code of the customer (specific to iDEAL transactions).
+ * @property {boolean} recurrent Enable recurrent payment.
+ * @property {string} customerId The customer's id in merchant's system (required for recurrent payments).
+ * @property {boolean} shippingAddressRequired Indicates whether or not the payment needs to be shipped. For digital goods, this should be false. Defaults to false.
+ * @property {object} address The shipping address.
+ * @property {string} address.streetAddress Line 1 of the Address (eg. number, street, etc). An error will occur if this address is not valid.
+ * @property {string} address.extendedAddress Line 2 of the Address (eg. suite, apt #, etc.). An error will occur if this address is not valid.
+ * @property {string} address.locality Customer's city.
+ * @property {string} address.region Customer's region or state.
+ * @property {string} address.postalCode Customer's postal code.
+ * @property {string} address.countryCode Customer's country code (two-character ISO 3166-1 code).
+ * @property {function} onPaymentStart A function that will be called with two parameters: an object containing the  `paymentId` and a `continueCallback` that must be called to launch the flow. You can use method to do any preprocessing on your server before the flow begins..
+ */
+
+/**
+ * Options used for the Pay Upon Invoice local payment type.
+ * @typedef {object} LocalPayment~StartPaymentPayUponInvoiceOptions
+ * @property {string} amount The amount to authorize for the transaction.
+ * @property {string} currencyCode The currency to process the payment (three-character ISO-4217).
+ * @property {string} [displayName] The merchant name displayed inside of the window that is opened when starting the payment.
+ * @property {string} paymentType The type of local payment. Must be `pay_upon_invoice`.
+ * @property {string} [paymentTypeCountryCode] The country code of the local payment. This value must be one of the supported country codes for a given local payment type listed {@link https://developer.paypal.com/braintree/docs/guides/local-payment-methods/client-side-custom/javascript/v3#render-local-payment-method-buttons|here}. For local payments supported in multiple countries, this value may determine which banks are presented to the customer.
+ * @property {string} email Payer email of the customer.
+ * @property {string} givenName First name of the customer.
+ * @property {string} surname Last name of the customer.
+ * @property {string} phone Phone number of the customer.
+ * @property {string} phoneCountryCode The country calling code.
+ * @property {string} birthDate The birth date of the customer in `YYYY-MM-DD` format.
+ * @property {object} address The shipping address.
+ * @property {string} address.streetAddress Line 1 of the Address (eg. number, street, etc). An error will occur if this address is not valid.
+ * @property {string} [address.extendedAddress] Line 2 of the Address (eg. suite, apt #, etc.). An error will occur if this address is not valid.
+ * @property {string} address.locality Customer's city.
+ * @property {string} [address.region] Customer's region or state.
+ * @property {string} address.postalCode Customer's postal code.
+ * @property {string} address.countryCode Customer's country code (two-character ISO 3166-1 code).
+ * @property {string} [shippingAmount] The shipping fee for all items. This value can not be a negative number.
+ * @property {string} [discountAmount] The discount for all items. This value can not be a negative number.
+ * @property {object} billingAddress The billing address.
+ * @property {string} billingAddress.streetAddress Line 1 of the Address (eg. number, street, etc). An error will occur if this address is not valid.
+ * @property {string} [billingAddress.extendedAddress] Line 2 of the Address (eg. suite, apt #, etc.). An error will occur if this address is not valid.
+ * @property {string} billingAddress.locality Customer's city.
+ * @property {string} [billingAddress.region] Customer's region or state.
+ * @property {string} billingAddress.postalCode Customer's postal code.
+ * @property {string} billingAddress.countryCode Customer's country code (two-character ISO 3166-1 code).
+ * @property {object[]} lineItems List of line items.
+ * @property {string} lineItems.category The item category type: `'DIGITAL_GOODS'`, `'PHYSICAL_GOODS'`, or `'DONATION'`.
+ * @property {string} lineItems.name Item name. Maximum 127 characters.
+ * @property {string} lineItems.quantity Number of units of the item purchased. This value must be a whole number and can't be negative or zero.
+ * @property {string} lineItems.unitAmount Per-unit price of the item. Can include up to 2 decimal places. This value can't be negative or zero.
+ * @property {string} lineItems.unitTaxAmount Per-unit tax price of the item. Can include up to 2 decimal places. This value can't be negative.
+ * @property {string} locale The BCP 47-formatted locale. PayPal supports a five-character code. For example, `en-DE`, `da-DK`, `he-IL`, `id-ID`, `ja-JP`, `no-NO`, `pt-BR`, `ru-RU`, `sv-SE`, `th-TH`, `zh-CN`, `zh-HK`, or `zh-TW`.
+ * @property {string} customerServiceInstructions Instructions for how to contact the merchant's customer service. Maximum 4,000 characters.
+ * @property {string} correlationId Used to correlate user sessions with server transactions.
+ * @property {function} onPaymentStart A function that will be called with an object containing the `paymentId`. The `continueCallback` is not provided as it is not needed for this use case.
+ */
+
+/**
+ * Options used for the seamless/oneclick BLIK local payment type.
+ * @typedef {object} LocalPayment~StartPaymentOptions
+ * @property {string} amount The amount to authorize for the transaction.
+ * @property {string} currencyCode The currency to process the payment (three-character ISO-4217).
+ * @property {string} [displayName] The merchant name displayed inside of the window that is opened when starting the payment.
+ * @property {string} paymentType The type of local payment. Must be `blik`.
+ * @property {string} paymentTypeCountryCode The country code of the local payment. This value must be one of the supported country codes for a given local payment type listed {@link https://developer.paypal.com/braintree/docs/guides/local-payment-methods/client-side-custom/javascript/v3#render-local-payment-method-buttons|here}. For local payments supported in multiple countries, this value may determine which banks are presented to the customer.
+ * @property {string} email Payer email of the customer.
+ * @property {string} givenName First name of the customer.
+ * @property {string} surname Last name of the customer.
+ * @property {string} phone Phone number of the customer.
+ * @property {boolean} shippingAddressRequired Indicates whether or not the payment needs to be shipped. For digital goods, this should be false. Defaults to false.
+ * @property {object} address The shipping address.
+ * @property {string} address.streetAddress Line 1 of the Address (eg. number, street, etc). An error will occur if this address is not valid.
+ * @property {string} address.extendedAddress Line 2 of the Address (eg. suite, apt #, etc.). An error will occur if this address is not valid.
+ * @property {string} address.locality Customer's city.
+ * @property {string} address.region Customer's region or state.
+ * @property {string} address.postalCode Customer's postal code.
+ * @property {string} address.countryCode Customer's country code (two-character ISO 3166-1 code).
+ * @property {object} blikOptions Blik seamless/oneclick specific options. Should contain only one object: `level_0` or `oneClick`.
+ * @property {object} blikOptions.level_0 Blik seamless specific options.
+ * @property {string} blikOptions.level_0.authCode 6-digit code used to authenticate a consumer within BLIK.
+ * @property {object} blikOptions.oneClick Blik oneclick specific options.
+ * @property {string} blikOptions.oneClick.authCode 6-digit code used to authenticate a consumer within BLIK.
+ * @property {string} blikOptions.oneClick.consumerReference The merchant generated, unique reference serving as a primary identifier for accounts connected between Blik and a merchant.
+ * @property {string} blikOptions.oneClick.aliasLabel A bank defined identifier used as a display name to allow the payer to differentiate between multiple registered bank accounts.
+ * @property {string} blikOptions.oneClick.aliasKey A Blik-defined identifier for a specific Blik-enabled bank account that is associated with a given merchant. Used only in conjunction with a Consumer Reference.
+ * @property {function} onPaymentStart A function that will be called with an object containing the `paymentId`. The `continueCallback` is not provided as it is not needed for this use case.
+ */
+
+/**
+ * Launches the local payment flow and returns a nonce payload. Only one local payment flow should be active at a time. One way to achieve this is to disable your local payment button while the flow is open.
+ * @public
+ * @function
+ * @param {LocalPayment~StartPaymentOptions|LocalPayment~StartPaymentPayUponInvoiceOptions} options Options for initiating the local payment payment flow.
+ * @param {callback} callback The second argument, <code>data</code>, is a {@link LocalPayment~startPaymentPayload|startPaymentPayload}. If no callback is provided, the method will return a Promise that resolves with a {@link LocalPayment~startPaymentPayload|startPaymentPayload}.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * localPaymentInstance.startPayment({
+ *   paymentType: 'ideal',
+ *   paymentTypeCountryCode: 'NL',
+ *   fallback: {
+ *     buttonText: 'Return to Merchant',
+ *     url: 'https://example.com/my-checkout-page'
+ *   },
+ *   amount: '10.00',
+ *   currencyCode: 'EUR',
+ *   givenName: 'Joe',
+ *   surname: 'Doe',
+ *   address: {
+ *     countryCode: 'NL'
+ *   },
+ *   onPaymentStart: function (data, continueCallback) {
+ *     // Do any preprocessing before starting the flow
+ *     // data.paymentId is the ID of the localPayment
+ *     continueCallback();
+ *   }
+ * }).then(function (payload) {
+ *   // Submit payload.nonce to your server
+ * }).catch(function (startPaymentError) {
+ *   // Handle flow errors or premature flow closure
+ *   console.error('Error!', startPaymentError);
+ * });
+ * @example <caption>Pay Upon Invoice</caption>
+ * localPaymentInstance.startPayment({
+ *   paymentType: 'pay_upon_invoice',
+ *   amount: '100.00',
+ *   currencyCode: 'EUR',
+ *   givenName: 'Max',
+ *   surname: 'Mustermann',
+ *   address: { // This is used as the shipping address.
+ *     streetAddress: 'Taunusanlage 12',
+ *     locality: 'Frankfurt',
+ *     postalCode: '60325',
+ *     countryCode: 'DE',
+ *   },
+ *   billingAddress: {
+ *     streetAddress: 'Schönhauser Allee 84',
+ *     locality: 'Berlin',
+ *     postalCode: '10439',
+ *     countryCode: 'DE'
+ *   },
+ *   birthDate: '1990-01-01',
+ *   email: 'buyer@example.com',
+ *   locale: 'en-DE',
+ *   customerServiceInstructions: 'Customer service phone is +49 6912345678.',
+ *   lineItems: [{
+ *     category: 'PHYSICAL_GOODS',
+ *     name: 'Basketball Shoes',
+ *     quantity: '1',
+ *     unitAmount: '81.00',
+ *     unitTaxAmount: '19.00',
+ *   }],
+ *   phone: '6912345678',
+ *   phoneCountryCode: '49',
+ *   correlationId: correlationId,
+ *   onPaymentStart: function (data) {
+ *     // NOTE: It is critical here to store data.paymentId on your server
+ *     //       so it can be mapped to a webhook sent by Braintree once the
+ *     //       buyer completes their payment.
+ *     console.log('Payment ID:', data.paymentId);
+ *   },
+ * }).catch(function (err) {
+ *   // Handle any error calling startPayment.
+ *   console.error(err);
+ * });
+ * @example <caption>BLIK seamless</caption>
+ * localPaymentInstance.startPayment({
+ *   paymentType: 'blik',
+ *   paymentTypeCountryCode: 'PL',
+ *   amount: '10.00',
+ *   currencyCode: 'PLN',
+ *   givenName: 'Joe',
+ *   surname: 'Doe',
+ *   phone: '1234566789',
+ *   address: {
+ *     streetAddress: 'Mokotowska 1234',
+ *     locality: 'Warsaw',
+ *     postalCode: '02-697',
+ *     countryCode: 'PL',
+ *   },
+ *   blikOptions: {
+ *     level_0: {
+ *       authCode: "123456",
+ *     },
+ *   },
+ *   onPaymentStart: function (data) {
+ *     // NOTE: It is critical here to store data.paymentId on your server
+ *     //       so it can be mapped to a webhook sent by Braintree once the
+ *     //       buyer completes their payment.
+ *     console.log('Payment ID:', data.paymentId);
+ *   },
+ * }).catch(function (err) {
+ *   // Handle any error calling startPayment.
+ *   console.error(err);
+ * });
+ * @example <caption>BLIK oneclick first payment</caption>
+ * localPaymentInstance.startPayment({
+ *   paymentType: 'blik',
+ *   paymentTypeCountryCode: 'PL',
+ *   amount: '10.00',
+ *   currencyCode: 'PLN',
+ *   givenName: 'Joe',
+ *   surname: 'Doe',
+ *   phone: '1234566789',
+ *   address: {
+ *     streetAddress: 'Mokotowska 1234',
+ *     locality: 'Warsaw',
+ *     postalCode: '02-697',
+ *     countryCode: 'PL',
+ *   },
+ *   blikOptions: {
+ *     oneClick: {
+ *       authCode: "123456",
+ *       consumerReference: "ABCde123",
+ *       aliasLabel: "my uniq alias",
+ *     },
+ *   },
+ *   onPaymentStart: function (data) {
+ *     // NOTE: It is critical here to store data.paymentId on your server
+ *     //       so it can be mapped to a webhook sent by Braintree once the
+ *     //       buyer completes their payment.
+ *     console.log('Payment ID:', data.paymentId);
+ *   },
+ * }).catch(function (err) {
+ *   // Handle any error calling startPayment.
+ *   console.error(err);
+ * });
+ * @example <caption>BLIK oneclick subsequent payment</caption>
+ * localPaymentInstance.startPayment({
+ *   paymentType: 'blik',
+ *   paymentTypeCountryCode: 'PL',
+ *   amount: '10.00',
+ *   currencyCode: 'PLN',
+ *   givenName: 'Joe',
+ *   surname: 'Doe',
+ *   phone: '1234566789',
+ *   address: {
+ *     streetAddress: 'Mokotowska 1234',
+ *     locality: 'Warsaw',
+ *     postalCode: '02-697',
+ *     countryCode: 'PL',
+ *   },
+ *   blikOptions: {
+ *     oneClick: {
+ *       consumerReference: "ABCde123",
+ *       aliasKey: "123456789",
+ *     },
+ *   },
+ *   onPaymentStart: function (data) {
+ *     // NOTE: It is critical here to store data.paymentId on your server
+ *     //       so it can be mapped to a webhook sent by Braintree once the
+ *     //       buyer completes their payment.
+ *     console.log('Payment ID:', data.paymentId);
+ *   },
+ * }).catch(function (err) {
+ *   // Handle any error calling startPayment.
+ *   console.error(err);
+ * });
+ * @example <caption>MB WAY</caption>
+ * localPaymentInstance.startPayment({
+ *   paymentType: 'mbway',
+ *   amount: '10.00',
+ *   currencyCode: 'EUR',
+ *   givenName: 'Joe',
+ *   surname: 'Doe',
+ *   phone: '1234566789',
+ *   phoneCountryCode: '351'
+ *   address: {
+ *     streetAddress: 'Rua Escura 12',
+ *     locality: 'Porto',
+ *     postalCode: '4465-283',
+ *     countryCode: 'PT',
+ *   },
+ *   onPaymentStart: function (data) {
+ *     // NOTE: It is critical here to store data.paymentId on your server
+ *     //       so it can be mapped to a webhook sent by Braintree once the
+ *     //       buyer completes their payment.
+ *     console.log('Payment ID:', data.paymentId);
+ *   },
+ * }).catch(function (err) {
+ *   // Handle any error calling startPayment.
+ *   console.error(err);
+ * });
+ * @example <caption>BANCOMAT PAY</caption>
+ * localPaymentInstance.startPayment({
+ *   paymentType: 'bancomatpay',
+ *   amount: '10.00',
+ *   currencyCode: 'EUR',
+ *   givenName: 'Joe',
+ *   surname: 'Doe',
+ *   phone: '1234566789',
+ *   phoneCountryCode: '49'
+ *   address: {
+ *     streetAddress: 'Via del Corso 12',
+ *     locality: 'Roma',
+ *     postalCode: '00100',
+ *     countryCode: 'IT',
+ *   },
+ *   onPaymentStart: function (data) {
+ *     // NOTE: It is critical here to store data.paymentId on your server
+ *     //       so it can be mapped to a webhook sent by Braintree once the
+ *     //       buyer completes their payment.
+ *     console.log('Payment ID:', data.paymentId);
+ *   },
+ * }).catch(function (err) {
+ *   // Handle any error calling startPayment.
+ *   console.error(err);
+ * });
+ */
+LocalPayment.prototype.startPayment = function (options) {
+  var missingOption,
+    missingError,
+    address,
+    fallback,
+    params,
+    promise,
+    billingAddress,
+    windowOptions,
+    onPaymentStartPromise,
+    serviceId,
+    cancelUrl,
+    returnUrl;
+  var self = this; // eslint-disable-line no-invalid-this
+
+  if (self._isRedirectFlow) {
+    options.redirectUrl = self._redirectUrl;
+  } else {
+    serviceId = self._frameService._serviceId;
+  }
+  // In order to provide the merchant with appropriate error messaging,
+  // more robust validation is being done on the client-side, since some
+  // option names are mapped to legacy names for the sake of the API.
+  // For example, if `billingAddress.streetAddress` was missing, then
+  // the API error response would say that `billing_address.line1` was
+  // missing. This client-side validation will correctly tell the
+  // merchant that `billingAddress.streetAddress` was missing.
+  missingOption = hasMissingOption(options);
+  if (missingOption) {
+    missingError = new BraintreeError(
+      errors.LOCAL_PAYMENT_START_PAYMENT_MISSING_REQUIRED_OPTION
+    );
+    if (typeof missingOption === "string") {
+      missingError.details = "Missing required '" + missingOption + "' option.";
+    }
+
+    return Promise.reject(missingError);
+  }
+  windowOptions = options.windowOptions || {};
+  address = options.address || {};
+  fallback = options.fallback || {};
+  billingAddress = options.billingAddress || {};
+  params = {
+    amount: options.amount,
+    bic: options.bic,
+    billingAddress: {
+      line1: billingAddress.streetAddress,
+      line2: billingAddress.extendedAddress,
+      city: billingAddress.locality,
+      state: billingAddress.region,
+      postalCode: billingAddress.postalCode,
+      countryCode: billingAddress.countryCode,
+    },
+    birthDate: options.birthDate,
+    blikOptions: options.blikOptions,
+    city: address.locality,
+    correlationId: options.correlationId,
+    countryCode: address.countryCode,
+    currencyIsoCode: options.currencyCode,
+    discountAmount: options.discountAmount,
+    experienceProfile: {
+      brandName: options.displayName,
+      customerServiceInstructions: options.customerServiceInstructions,
+      locale: options.locale,
+      noShipping: !options.shippingAddressRequired,
+    },
+    firstName: options.givenName,
+    fundingSource: options.paymentType,
+    intent: "sale",
+    lastName: options.surname,
+    line1: address.streetAddress,
+    line2: address.extendedAddress,
+    lineItems: options.lineItems,
+    merchantAccountId: self._merchantAccountId,
+    merchantOrPartnerCustomerId: options.customerId,
+    payerEmail: options.email,
+    paymentTypeCountryCode: options.paymentTypeCountryCode,
+    phone: options.phone,
+    phoneCountryCode: options.phoneCountryCode,
+    postalCode: address.postalCode,
+    recurrent: options.recurrent,
+    shippingAmount: options.shippingAmount,
+    state: address.region,
+  };
+
+  if (self._isRedirectFlow) {
+    cancelUrl = querystring.queryify(self._redirectUrl, {
+      wasCanceled: true,
+    });
+    returnUrl = self._redirectUrl;
+  } else {
+    cancelUrl = querystring.queryify(
+      self._assetsUrl +
+        "/html/local-payment-redirect-frame" +
+        useMin(self._isDebug) +
+        ".html",
+      {
+        channel: serviceId,
+        r: fallback.cancelUrl || fallback.url,
+        t: fallback.cancelButtonText || fallback.buttonText,
+        c: 1, // indicating we went through the cancel flow
+      }
+    );
+    returnUrl = querystring.queryify(
+      self._assetsUrl +
+        "/html/local-payment-redirect-frame" +
+        useMin(self._isDebug) +
+        ".html",
+      {
+        channel: serviceId,
+        r: fallback.url,
+        t: fallback.buttonText,
+      }
+    );
+  }
+  assign(params, { cancelUrl: cancelUrl, returnUrl: returnUrl });
+
+  self._paymentType = options.paymentType.toLowerCase();
+
+  if (self._authorizationInProgress && !self._isRedirectFlow) {
+    analytics.sendEvent(
+      self._client,
+      self._paymentType + ".local-payment.start-payment.error.already-opened"
+    );
+
+    return Promise.reject(
+      new BraintreeError(errors.LOCAL_PAYMENT_ALREADY_IN_PROGRESS)
+    );
+  }
+
+  self._authorizationInProgress = true;
+
+  promise = new ExtendedPromise();
+
+  // For deferred payment types, the popup window should not be opened,
+  // since the actual payment will be done outside of this session.
+  if (!isDeferredPaymentTypeOptions(options) && !self._isRedirectFlow) {
+    self._startPaymentCallback = self._createStartPaymentCallback(
+      function (val) {
+        promise.resolve(val);
+      },
+      function (err) {
+        promise.reject(err);
+      }
+    );
+
+    self._frameService.open(
+      {
+        width: windowOptions.width || DEFAULT_WINDOW_WIDTH,
+        height: windowOptions.height || DEFAULT_WINDOW_HEIGHT,
+      },
+      self._startPaymentCallback
+    );
+  }
+
+  self._client
+    .request({
+      method: "post",
+      endpoint: "local_payments/create",
+      data: params,
+    })
+    .then(function (response) {
+      var redirectUrl = response.paymentResource.redirectUrl;
+
+      if (self._isRedirectFlow) {
+        analytics.sendEvent(
+          self._client,
+          self._paymentType + ".local-payment.start-payment.redirected"
+        );
+      } else {
+        analytics.sendEvent(
+          self._client,
+          self._paymentType + ".local-payment.start-payment.opened"
+        );
+      }
+      self._startPaymentOptions = options;
+
+      if (isDeferredPaymentTypeOptions(options)) {
+        self._authorizationInProgress = false;
+
+        if (typeof redirectUrl === "string" && redirectUrl.length) {
+          promise.reject(
+            new BraintreeError(
+              errors.LOCAL_PAYMENT_START_PAYMENT_DEFERRED_PAYMENT_FAILED
+            )
+          );
+        } else {
+          onPaymentStartPromise = options.onPaymentStart({
+            paymentId: response.paymentResource.paymentToken,
+          });
+
+          if (onPaymentStartPromise instanceof Promise) {
+            onPaymentStartPromise.then(function () {
+              promise.resolve();
+            });
+          } else {
+            promise.resolve();
+          }
+        }
+      } else if (self._isRedirectFlow) {
+        window.location.href = response.paymentResource.redirectUrl;
+      } else {
+        options.onPaymentStart(
+          { paymentId: response.paymentResource.paymentToken },
+          function () {
+            self._frameService.redirect(response.paymentResource.redirectUrl);
+          }
+        );
+      }
+    })
+    .catch(function (err) {
+      var status = err.details && err.details.httpStatus;
+
+      if (!self._isRedirectFlow) {
+        self._frameService.close();
+      }
+      self._authorizationInProgress = false;
+
+      if (status === 422) {
+        promise.reject(
+          new BraintreeError({
+            type: errors.LOCAL_PAYMENT_INVALID_PAYMENT_OPTION.type,
+            code: errors.LOCAL_PAYMENT_INVALID_PAYMENT_OPTION.code,
+            message: errors.LOCAL_PAYMENT_INVALID_PAYMENT_OPTION.message,
+            details: {
+              originalError: err,
+            },
+          })
+        );
+
+        return;
+      }
+
+      promise.reject(
+        convertToBraintreeError(err, {
+          type: errors.LOCAL_PAYMENT_START_PAYMENT_FAILED.type,
+          code: errors.LOCAL_PAYMENT_START_PAYMENT_FAILED.code,
+          message: errors.LOCAL_PAYMENT_START_PAYMENT_FAILED.message,
+        })
+      );
+    });
+
+  return promise;
+};
+
+/**
+ * Manually tokenizes params for a local payment received from PayPal.When app switching back from a mobile application (such as a bank application for an iDEAL payment), the window may lose context with the parent page. In that case, a fallback url is used, and this method can be used to finish the flow.
+ * @public
+ * @function
+ * @param {object} [params] All options for tokenizing local payment parameters. If no params are passed in, the params will be pulled off of the query string of the page.
+ * @param {string} params.btLpToken The token representing the local payment. Aliased to `token` if `btLpToken` is not present.
+ * @param {string} params.btLpPaymentId The payment id for the local payment. Aliased to `paymentId` if `btLpPaymentId` is not present.
+ * @param {string} params.btLpPayerId The payer id for the local payment. Aliased to `PayerID` if `btLpPayerId` is not present.
+ * @param {callback} [callback] The second argument, <code>data</code>, is a {@link LocalPayment~startPaymentPayload|startPaymentPayload}. If no callback is provided, the method will return a Promise that resolves with a {@link LocalPayment~startPaymentPayload|startPaymentPayload}.
+ * @example
+ * localPaymentInstance.tokenize().then(function (payload) {
+ *   // send payload.nonce to your server
+ * }).catch(function (err) {
+ *   // handle tokenization error
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+LocalPayment.prototype.tokenize = function (params) {
+  var self = this;
+  var client = this._client;
+
+  params = params || querystring.parse();
+
+  // iOS Safari parses query params by adding the params inside an object called: queryItems
+  if (params.queryItems) {
+    params = params.queryItems;
+  }
+
+  if (params.c || params.wasCanceled) {
+    return Promise.reject(
+      new BraintreeError({
+        type: errors.LOCAL_PAYMENT_CANCELED.type,
+        code: errors.LOCAL_PAYMENT_CANCELED.code,
+        message: errors.LOCAL_PAYMENT_CANCELED.message,
+        details: {
+          originalError: {
+            errorcode: params.errorcode,
+            token: params.btLpToken,
+          },
+        },
+      })
+    );
+  } else if (params.errorcode) {
+    return Promise.reject(
+      new BraintreeError({
+        type: errors.LOCAL_PAYMENT_START_PAYMENT_FAILED.type,
+        code: errors.LOCAL_PAYMENT_START_PAYMENT_FAILED.code,
+        message: errors.LOCAL_PAYMENT_START_PAYMENT_FAILED.message,
+        details: {
+          originalError: {
+            errorcode: params.errorcode,
+            token: params.btLpToken,
+          },
+        },
+      })
+    );
+  }
+
+  return client
+    .request({
+      endpoint: "payment_methods/paypal_accounts",
+      method: "post",
+      data: this._formatTokenizeData(params),
+    })
+    .then(function (response) {
+      var payload = self._formatTokenizePayload(response);
+
+      if (window.popupBridge) {
+        analytics.sendEvent(
+          client,
+          self._paymentType + ".local-payment.tokenization.success-popupbridge"
+        );
+      } else {
+        analytics.sendEvent(
+          client,
+          self._paymentType + ".local-payment.tokenization.success"
+        );
+      }
+
+      return payload;
+    })
+    .catch(function (err) {
+      analytics.sendEvent(
+        client,
+        self._paymentType + ".local-payment.tokenization.failed"
+      );
+
+      return Promise.reject(
+        convertToBraintreeError(err, {
+          type: errors.LOCAL_PAYMENT_TOKENIZATION_FAILED.type,
+          code: errors.LOCAL_PAYMENT_TOKENIZATION_FAILED.code,
+          message: errors.LOCAL_PAYMENT_TOKENIZATION_FAILED.message,
+        })
+      );
+    });
+};
+
+/**
+ * Closes the LocalPayment window if it is open.
+ * @public
+ * @example
+ * localPaymentInstance.closeWindow();
+ * @returns {void}
+ */
+LocalPayment.prototype.closeWindow = function () {
+  if (this._authoriztionInProgress) {
+    analytics.sendEvent(
+      this._client,
+      this._paymentType + ".local-payment.start-payment.closed.by-merchant"
+    );
+  }
+  this._frameService.close();
+};
+
+/**
+ * Focuses the LocalPayment window if it is open.
+ * @public
+ * @example
+ * localPaymentInstance.focusWindow();
+ * @returns {void}
+ */
+LocalPayment.prototype.focusWindow = function () {
+  this._frameService.focus();
+};
+
+LocalPayment.prototype._createStartPaymentCallback = function (
+  resolve,
+  reject
+) {
+  var self = this;
+  var client = this._client;
+
+  return function (err, params) {
+    self._authorizationInProgress = false;
+    if (err) {
+      if (err.code === "FRAME_SERVICE_FRAME_CLOSED") {
+        if (params && params.errorcode === "processing_error") {
+          // something failed within the payment window (rather than when
+          // tokenizing with Braintree)
+          analytics.sendEvent(
+            client,
+            self._paymentType + ".local-payment.failed-in-window"
+          );
+          reject(new BraintreeError(errors.LOCAL_PAYMENT_START_PAYMENT_FAILED));
+
+          return;
+        }
+
+        // its possible to have a query param with errorcode=payment_error, which
+        // indicates that the customer cancelled the flow from within the UI,
+        // but as there's no meaningful difference to the merchant whether the
+        // customer closes via the UI or by manually closing the window, we
+        // don't differentiate these
+        analytics.sendEvent(
+          client,
+          self._paymentType + ".local-payment.tokenization.closed.by-user"
+        );
+        reject(new BraintreeError(errors.LOCAL_PAYMENT_WINDOW_CLOSED));
+      } else if (
+        err.code &&
+        err.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED") > -1
+      ) {
+        reject(
+          new BraintreeError({
+            code: errors.LOCAL_PAYMENT_WINDOW_OPEN_FAILED.code,
+            type: errors.LOCAL_PAYMENT_WINDOW_OPEN_FAILED.type,
+            message: errors.LOCAL_PAYMENT_WINDOW_OPEN_FAILED.message,
+            details: {
+              originalError: err,
+            },
+          })
+        );
+      }
+    } else if (params) {
+      if (!window.popupBridge) {
+        self._frameService.redirect(self._loadingFrameUrl);
+      }
+
+      self
+        .tokenize(params)
+        .then(resolve)
+        .catch(reject)
+        .then(function () {
+          self._frameService.close();
+        });
+    }
+  };
+};
+
+LocalPayment.prototype._formatTokenizePayload = function (response) {
+  var payload;
+  var account = {};
+
+  if (response.paypalAccounts) {
+    account = response.paypalAccounts[0];
+  }
+
+  payload = {
+    nonce: account.nonce,
+    details: {},
+    type: account.type,
+  };
+
+  if (account.details) {
+    if (account.details.payerInfo) {
+      payload.details = account.details.payerInfo;
+    }
+    if (account.details.correlationId) {
+      payload.correlationId = account.details.correlationId;
+    }
+  }
+
+  return payload;
+};
+
+/**
+ * Checks if required tokenization parameters are available in querystring for manual tokenization requests.
+ * @public
+ * @function
+ * @example
+ * // if query string contains
+ * // ?btLpToken=token&btLpPaymentId=payment-id&btLpPayerId=payer-id
+ * localPaymentInstance.hasTokenizationParams(); // true
+ *
+ * // if query string is missing required params
+ * localPaymentInstance.hasTokenizationParams(); // false
+ *
+ * if (localPaymentInstance.hasTokenizationParams()) {
+ *   localPaymentInstance.tokenize();
+ * }
+ * @returns {Boolean} Returns a Boolean value for the state of the query string.
+ */
+LocalPayment.prototype.hasTokenizationParams = function () {
+  var params = querystring.parse();
+
+  if (params.errorcode) {
+    return true;
+  }
+
+  return Boolean(
+    params.btLpToken && params.btLpPaymentId && params.btLpPayerId
+  );
+};
+
+LocalPayment.prototype._formatTokenizeData = function (params) {
+  var clientConfiguration = this._client.getConfiguration();
+  var gatewayConfiguration = clientConfiguration.gatewayConfiguration;
+  var data = {
+    merchantAccountId: this._merchantAccountId,
+    paypalAccount: {
+      correlationId: params.btLpToken || params.token,
+      paymentToken: params.btLpPaymentId || params.paymentId,
+      payerId: params.btLpPayerId || params.PayerID,
+      unilateral: gatewayConfiguration.paypal.unvettedMerchant,
+      intent: "sale",
+    },
+  };
+
+  return data;
+};
+
+// Some payment types are deferred. Meaning, the actual payment will
+// occur at a later time outside of this session. For example, with
+// Pay Upon Invoice, the customer will later receive an email that will
+// be used to make the actual payment through RatePay. This function
+// will return `true` if the given options contain `paymentType` of
+// a deferred payment type; and/or some payments, like blik, may have
+// specific extra options to be treated as deferred. Otherwise, it
+// will return `false`.
+function isDeferredPaymentTypeOptions(options) {
+  var blikOptions = options.blikOptions || {};
+  var paymentType =
+    typeof options.paymentType === "string"
+      ? options.paymentType.toLowerCase()
+      : options.paymentType;
+
+  if (paymentType === "blik") {
+    return (
+      blikOptions.hasOwnProperty("level_0") ||
+      blikOptions.hasOwnProperty("oneClick")
+    );
+  }
+
+  return ["pay_upon_invoice", "mbway", "bancomatpay"].includes(paymentType);
+}
+
+function hasMissingAddressOption(options) {
+  var i, option;
+
+  for (i = 0; i < constants.REQUIRED_OPTIONS_FOR_ADDRESS.length; i++) {
+    option = constants.REQUIRED_OPTIONS_FOR_ADDRESS[i];
+    if (!options.hasOwnProperty(option)) {
+      return option;
+    }
+  }
+
+  return false;
+}
+
+function hasMissingLineItemsOption(items) {
+  var i, j, item, option;
+
+  for (j = 0; j < items.length; j++) {
+    item = items[j];
+    for (i = 0; i < constants.REQUIRED_OPTIONS_FOR_LINE_ITEMS.length; i++) {
+      option = constants.REQUIRED_OPTIONS_FOR_LINE_ITEMS[i];
+      if (!item.hasOwnProperty(option)) {
+        return option;
+      }
+    }
+  }
+
+  return false;
+}
+
+function hasMissingBlikOptions(options) {
+  var i, option, oneClick;
+  var blikOptions = options.blikOptions || {};
+
+  if (!options.redirectUrl) {
+    constants.REQUIRED_OPTIONS_FOR_BLIK_SEAMLESS_PAYMENT_TYPE.push(
+      "onPaymentStart"
+    );
+  }
+
+  for (
+    i = 0;
+    i < constants.REQUIRED_OPTIONS_FOR_BLIK_SEAMLESS_PAYMENT_TYPE.length;
+    i++
+  ) {
+    option = constants.REQUIRED_OPTIONS_FOR_BLIK_SEAMLESS_PAYMENT_TYPE[i];
+    if (!options.hasOwnProperty(option)) {
+      return option;
+    }
+  }
+
+  if (blikOptions.hasOwnProperty("level_0")) {
+    for (
+      i = 0;
+      i < constants.REQUIRED_OPTIONS_FOR_BLIK_OPTIONS_LEVEL_0.length;
+      i++
+    ) {
+      option = constants.REQUIRED_OPTIONS_FOR_BLIK_OPTIONS_LEVEL_0[i];
+
+      // eslint-disable-next-line camelcase
+      if (!blikOptions.level_0.hasOwnProperty(option)) {
+        return "blikOptions.level_0." + option;
+      }
+    }
+  } else if (blikOptions.hasOwnProperty("oneClick")) {
+    oneClick = blikOptions.oneClick || {};
+
+    if (oneClick.hasOwnProperty("aliasKey")) {
+      for (
+        i = 0;
+        i <
+        constants.REQUIRED_OPTIONS_FOR_BLIK_OPTIONS_ONE_CLICK_SUBSEQUENT.length;
+        i++
+      ) {
+        option =
+          constants.REQUIRED_OPTIONS_FOR_BLIK_OPTIONS_ONE_CLICK_SUBSEQUENT[i];
+
+        if (!oneClick.hasOwnProperty(option)) {
+          return "blikOptions.oneClick." + option;
+        }
+      }
+    } else {
+      for (
+        i = 0;
+        i < constants.REQUIRED_OPTIONS_FOR_BLIK_OPTIONS_ONE_CLICK_FIRST.length;
+        i++
+      ) {
+        option = constants.REQUIRED_OPTIONS_FOR_BLIK_OPTIONS_ONE_CLICK_FIRST[i];
+
+        if (!oneClick.hasOwnProperty(option)) {
+          return "blikOptions.oneClick." + option;
+        }
+      }
+    }
+  }
+
+  return false;
+}
+
+// This will return the name of the first missing required option that
+// is found or `true` if `options` itself is not defined. Otherwise, it
+// will return `false`.
+function hasMissingOption(options) {
+  var i, option, missingAddressOption, missingLineItemOption, paymentType;
+
+  if (!options) {
+    return true;
+  }
+
+  if (isDeferredPaymentTypeOptions(options)) {
+    paymentType = options.paymentType || "";
+
+    if (paymentType.toLowerCase() === "pay_upon_invoice") {
+      for (
+        i = 0;
+        i < constants.REQUIRED_OPTIONS_FOR_PAY_UPON_INVOICE_PAYMENT_TYPE.length;
+        i++
+      ) {
+        option =
+          constants.REQUIRED_OPTIONS_FOR_PAY_UPON_INVOICE_PAYMENT_TYPE[i];
+        if (!options.hasOwnProperty(option)) {
+          return option;
+        }
+        if (option === "address" || option === "billingAddress") {
+          missingAddressOption = hasMissingAddressOption(options[option]);
+          if (missingAddressOption) {
+            return option + "." + missingAddressOption;
+          }
+        } else if (option === "lineItems") {
+          missingLineItemOption = hasMissingLineItemsOption(options[option]);
+          if (missingLineItemOption) {
+            return option + "." + missingLineItemOption;
+          }
+        }
+      }
+    } else if (paymentType.toLowerCase() === "blik") {
+      return hasMissingBlikOptions(options);
+    }
+  } else {
+    if (!options.redirectUrl) {
+      constants.REQUIRED_OPTIONS_FOR_START_PAYMENT.push("onPaymentStart");
+    }
+
+    for (i = 0; i < constants.REQUIRED_OPTIONS_FOR_START_PAYMENT.length; i++) {
+      option = constants.REQUIRED_OPTIONS_FOR_START_PAYMENT[i];
+
+      if (!options.hasOwnProperty(option)) {
+        return option;
+      }
+    }
+
+    if (!options.fallback.url) {
+      return "fallback.url";
+    }
+    if (!options.fallback.buttonText) {
+      return "fallback.buttonText";
+    }
+    if (options.recurrent === true && !options.customerId) {
+      return "customerId";
+    }
+  }
+
+  return false;
+}
+
+/**
+ * Cleanly remove anything set up by {@link module:braintree-web/local-payment.create|create}.
+ * @public
+ * @param {callback} [callback] Called on completion.
+ * @example
+ * localPaymentInstance.teardown();
+ * @example <caption>With callback</caption>
+ * localPaymentInstance.teardown(function () {
+ *   // teardown is complete
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+LocalPayment.prototype.teardown = function () {
+  var self = this; // eslint-disable-line no-invalid-this
+
+  if (!self._isRedirectFlow) {
+    self._frameService.teardown();
+  }
+
+  convertMethodsToError(self, methods(LocalPayment.prototype));
+
+  analytics.sendEvent(self._client, "local-payment.teardown-completed");
+
+  return Promise.resolve();
+};
+
+module.exports = wrapPromise.wrapPrototype(LocalPayment);
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/local-payment_index.js.html b/3.111.1/local-payment_index.js.html new file mode 100644 index 00000000..5cfe77b2 --- /dev/null +++ b/3.111.1/local-payment_index.js.html @@ -0,0 +1,292 @@ + + + + + + + + + + + local-payment/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ local-payment/index.js +

+ + + + + +
+
+
"use strict";
+/**
+ * @module braintree-web/local-payment
+ * @description A component to integrate with local payment methods. *This component is currently in beta and is subject to change.*
+ */
+
+var analytics = require("../lib/analytics");
+var basicComponentVerification = require("../lib/basic-component-verification");
+var createDeferredClient = require("../lib/create-deferred-client");
+var createAssetsUrl = require("../lib/create-assets-url");
+var LocalPayment = require("./external/local-payment");
+var VERSION = process.env.npm_package_version;
+var wrapPromise = require("@braintree/wrap-promise");
+var BraintreeError = require("../lib/braintree-error");
+var errors = require("./shared/errors");
+var parse = require("../lib/querystring").parse;
+
+/**
+ * @static
+ * @function create
+ * @param {object} options Creation options:
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {string} [options.merchantAccountId] A non-default merchant account ID to use for tokenization and creation of the authorizing transaction. Braintree strongly recommends specifying this parameter.
+ * @param {redirectUrl} When provided, triggers full page redirect flow instead of popup flow.
+ * @param {callback} callback The second argument, `data`, is the {@link LocalPayment} instance.
+ * @example <caption>Using the local payment component to set up an iDEAL button</caption>
+ * var idealButton = document.querySelector('.ideal-button');
+ *
+ * braintree.client.create({
+ *   authorization: CLIENT_AUTHORIZATION
+ * }, function (clientErr, clientInstance) {
+ *   if (clientErr) {
+ *     console.error('Error creating client:', clientErr);
+ *     return;
+ *   }
+ *
+ *   braintree.localPayment.create({
+ *     client: clientInstance,
+ *     merchantAccountId: 'merchantAccountEUR',
+ *   }, function (localPaymentErr, localPaymentInstance) {
+ *     if (localPaymentErr) {
+ *       console.error('Error creating local payment component:', localPaymentErr);
+ *       return;
+ *     }
+ *
+ *     idealButton.removeAttribute('disabled');
+ *
+ *     // When the button is clicked, attempt to start the payment flow.
+ *     idealButton.addEventListener('click', function (event) {
+ *       // Because this opens a popup, this has to be called as a result of
+ *       // customer action, like clicking a button. You cannot call this at any time.
+ *       localPaymentInstance.startPayment({
+ *         paymentType: 'ideal',
+ *         amount: '10.67',
+ *         city: 'Den Haag',
+ *         countryCode: 'NL',
+ *         firstName: 'Test',
+ *         lastName: 'McTester',
+ *         line1: '123 of 456 Fake Lane',
+ *         line2: 'Apartment 789',
+ *         payerEmail: 'payer@example.com',
+ *         phone: '123456789',
+ *         postalCode: '1234 AA',
+ *         currencyCode: 'EUR',
+ *         onPaymentStart: function (data, continueCallback) {
+ *           // Do any preprocessing to store the ID and setup webhook
+ *           // Call start to initiate the popup
+ *           continueCallback();
+ *         }
+ **       }, function (startPaymentErr, payload) {
+ *         if (startPaymentErr) {
+ *           if (startPaymentErr.type !== 'CUSTOMER') {
+ *             console.error('Error starting payment:', startPaymentErr);
+ *           }
+ *           return;
+ *         }
+ *
+ *         idealButton.setAttribute('disabled', true);
+ *
+ *         console.log(payload.paymentId);
+ *       });
+ *     }, false);
+ *   });
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+function create(options) {
+  var name = "Local Payment";
+
+  return basicComponentVerification
+    .verify({
+      name: name,
+      client: options.client,
+      authorization: options.authorization,
+    })
+    .then(function () {
+      return createDeferredClient.create({
+        authorization: options.authorization,
+        client: options.client,
+        debug: options.debug,
+        assetsUrl: createAssetsUrl.create(options.authorization),
+        name: name,
+      });
+    })
+    .then(function (client) {
+      var localPaymentInstance, params;
+      var config = client.getConfiguration();
+
+      options.client = client;
+
+      if (config.gatewayConfiguration.paypalEnabled !== true) {
+        return Promise.reject(
+          new BraintreeError(errors.LOCAL_PAYMENT_NOT_ENABLED)
+        );
+      }
+
+      analytics.sendEvent(client, "local-payment.initialized");
+
+      localPaymentInstance = new LocalPayment(options);
+      if (options.redirectUrl) {
+        params = parse(window.location.href);
+
+        if (params.token || params.wasCanceled) {
+          return localPaymentInstance
+            .tokenize(params)
+            .then(function (payload) {
+              localPaymentInstance.tokenizePayload = payload;
+
+              return localPaymentInstance;
+            })
+            .catch(function (err) {
+              console.log("Error while tokenizing: ", err);
+
+              return localPaymentInstance;
+            });
+        }
+
+        return localPaymentInstance;
+      }
+
+      return localPaymentInstance._initialize();
+    });
+}
+
+module.exports = {
+  create: wrapPromise(create),
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/local-payment_shared_errors.js.html b/3.111.1/local-payment_shared_errors.js.html new file mode 100644 index 00000000..d3cc64e2 --- /dev/null +++ b/3.111.1/local-payment_shared_errors.js.html @@ -0,0 +1,215 @@ + + + + + + + + + + + local-payment/shared/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ local-payment/shared/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.LocalPayment - Creation Error Codes
+ * @description Errors that occur when [creating the Local Payment component](./module-braintree-web_local-payment.html#.create).
+ * @property {MERCHANT} LOCAL_PAYMENT_NOT_ENABLED Occurs when Local Payment is not enabled on the Braintree control panel.
+ */
+
+/**
+ * @name BraintreeError.LocalPayment - startPayment Error Codes
+ * @description Errors that occur when using the [`startPayment` method](./LocalPayment.html#startPayment).
+ * @property {MERCHANT} LOCAL_PAYMENT_START_PAYMENT_MISSING_REQUIRED_OPTION Occurs when a startPayment is missing a required option.
+ * @property {MERCHANT} LOCAL_PAYMENT_ALREADY_IN_PROGRESS Occurs when a startPayment call is already in progress.
+ * @property {MERCHANT} LOCAL_PAYMENT_INVALID_PAYMENT_OPTION Occurs when a startPayment call has an invalid option.
+ * @property {NETWORK} LOCAL_PAYMENT_START_PAYMENT_FAILED Occurs when a startPayment call fails.
+ * @property {NETWORK} LOCAL_PAYMENT_TOKENIZATION_FAILED Occurs when a startPayment call fails to tokenize the result from authorization.
+ * @property {CUSTOMER} LOCAL_PAYMENT_CANCELED Occurs when the customer cancels the Local Payment.
+ * @property {CUSTOMER} LOCAL_PAYMENT_WINDOW_CLOSED Occurs when the customer closes the Local Payment window.
+ * @property {MERCHANT} LOCAL_PAYMENT_WINDOW_OPEN_FAILED Occurs when the Local Payment window fails to open. Usually because `startPayment` was not called as a direct result of a user action.
+ */
+
+var BraintreeError = require("../../lib/braintree-error");
+
+module.exports = {
+  LOCAL_PAYMENT_NOT_ENABLED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "LOCAL_PAYMENT_NOT_ENABLED",
+    message: "LocalPayment is not enabled for this merchant.",
+  },
+  LOCAL_PAYMENT_ALREADY_IN_PROGRESS: {
+    type: BraintreeError.types.MERCHANT,
+    code: "LOCAL_PAYMENT_ALREADY_IN_PROGRESS",
+    message: "LocalPayment payment is already in progress.",
+  },
+  LOCAL_PAYMENT_CANCELED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "LOCAL_PAYMENT_CANCELED",
+    message: "Customer canceled the LocalPayment before authorizing.",
+  },
+  LOCAL_PAYMENT_WINDOW_CLOSED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "LOCAL_PAYMENT_WINDOW_CLOSED",
+    message: "Customer closed LocalPayment window before authorizing.",
+  },
+  LOCAL_PAYMENT_WINDOW_OPEN_FAILED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "LOCAL_PAYMENT_WINDOW_OPEN_FAILED",
+    message:
+      "LocalPayment window failed to open; make sure startPayment was called in response to a user action.",
+  },
+  LOCAL_PAYMENT_START_PAYMENT_FAILED: {
+    type: BraintreeError.types.NETWORK,
+    code: "LOCAL_PAYMENT_START_PAYMENT_FAILED",
+    message: "LocalPayment startPayment failed.",
+  },
+  LOCAL_PAYMENT_START_PAYMENT_MISSING_REQUIRED_OPTION: {
+    type: BraintreeError.types.MERCHANT,
+    code: "LOCAL_PAYMENT_START_PAYMENT_MISSING_REQUIRED_OPTION",
+    message: "Missing required option for startPayment.",
+  },
+  LOCAL_PAYMENT_START_PAYMENT_DEFERRED_PAYMENT_FAILED: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "LOCAL_PAYMENT_START_PAYMENT_DEFERRED_PAYMENT_FAILED",
+    message: "LocalPayment startPayment deferred payment failed.",
+  },
+  LOCAL_PAYMENT_TOKENIZATION_FAILED: {
+    type: BraintreeError.types.NETWORK,
+    code: "LOCAL_PAYMENT_TOKENIZATION_FAILED",
+    message: "Could not tokenize user's local payment method.",
+  },
+  LOCAL_PAYMENT_INVALID_PAYMENT_OPTION: {
+    type: BraintreeError.types.MERCHANT,
+    code: "LOCAL_PAYMENT_INVALID_PAYMENT_OPTION",
+    message: "Local payment options are invalid.",
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/masterpass_external_masterpass.js.html b/3.111.1/masterpass_external_masterpass.js.html new file mode 100644 index 00000000..181b643e --- /dev/null +++ b/3.111.1/masterpass_external_masterpass.js.html @@ -0,0 +1,612 @@ + + + + + + + + + + + masterpass/external/masterpass.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ masterpass/external/masterpass.js +

+ + + + + +
+
+
"use strict";
+
+var frameService = require("../../lib/frame-service/external");
+var BraintreeError = require("../../lib/braintree-error");
+var errors = require("../shared/errors");
+var VERSION = process.env.npm_package_version;
+var methods = require("../../lib/methods");
+var wrapPromise = require("@braintree/wrap-promise");
+var analytics = require("../../lib/analytics");
+var convertMethodsToError = require("../../lib/convert-methods-to-error");
+var convertToBraintreeError = require("../../lib/convert-to-braintree-error");
+var constants = require("../shared/constants");
+
+var INTEGRATION_TIMEOUT_MS =
+  require("../../lib/constants").INTEGRATION_TIMEOUT_MS;
+
+/**
+ * Masterpass Address object.
+ * @typedef {object} Masterpass~Address
+ * @property {string} countryCodeAlpha2 The customer's country code.
+ * @property {string} extendedAddress The customer's extended address.
+ * @property {string} locality The customer's locality.
+ * @property {string} postalCode The customer's postal code.
+ * @property {string} region The customer's region.
+ * @property {string} streetAddress The customer's street address.
+ */
+
+/**
+ * @typedef {object} Masterpass~tokenizePayload
+ * @property {string} nonce The payment method nonce.
+ * @property {string} description The human readable description.
+ * @property {string} type The payment method type, always `MasterpassCard`.
+ * @property {object} details Additional account details.
+ * @property {string} details.cardType Type of card, ex: Visa, MasterCard.
+ * @property {string} details.lastFour Last four digits of card number.
+ * @property {string} details.lastTwo Last two digits of card number.
+ * @property {object} contact The customer's contact information.
+ * @property {string} contact.firstName The customer's first name.
+ * @property {string} contact.lastName The customer's last name.
+ * @property {string} contact.phoneNumber The customer's phone number.
+ * @property {string} contact.emailAddress The customer's email address.
+ * @property {Masterpass~Address} billingAddress The customer's billing address.
+ * @property {Masterpass~Address} shippingAddress The customer's shipping address.
+ * @property {object} binData Information about the card based on the bin.
+ * @property {string} binData.commercial Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.countryOfIssuance The country of issuance.
+ * @property {string} binData.debit Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.durbinRegulated Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.healthcare Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.issuingBank The issuing bank.
+ * @property {string} binData.payroll Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.prepaid Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.productId The product id.
+ */
+
+/**
+ * @class
+ * @param {object} options see {@link module:braintree-web/masterpass.create|masterpass.create}
+ * @description <strong>You cannot use this constructor directly. Use {@link module:braintree-web/masterpass.create|braintree.masterpass.create} instead.</strong>
+ * @classdesc This class represents an Masterpass component. Instances of this class have methods for launching a new window to process a transaction with Masterpass.
+ */
+function Masterpass(options) {
+  var configuration = options.client.getConfiguration();
+
+  this._client = options.client;
+  this._assetsUrl =
+    configuration.gatewayConfiguration.assetsUrl + "/web/" + VERSION;
+  this._isDebug = configuration.isDebug;
+  this._authInProgress = false;
+  if (
+    window.popupBridge &&
+    typeof window.popupBridge.getReturnUrlPrefix === "function"
+  ) {
+    this._callbackUrl = window.popupBridge.getReturnUrlPrefix() + "return";
+  } else {
+    this._callbackUrl =
+      this._assetsUrl +
+      "/html/redirect-frame" +
+      (this._isDebug ? "" : ".min") +
+      ".html";
+  }
+}
+
+Masterpass.prototype._initialize = function () {
+  var self = this;
+
+  return new Promise(function (resolve) {
+    var failureTimeout = setTimeout(function () {
+      analytics.sendEvent(self._client, "masterpass.load.timed-out");
+    }, INTEGRATION_TIMEOUT_MS);
+
+    frameService.create(
+      {
+        name: constants.LANDING_FRAME_NAME,
+        height: constants.POPUP_HEIGHT,
+        width: constants.POPUP_WIDTH,
+        dispatchFrameUrl:
+          self._assetsUrl +
+          "/html/dispatch-frame" +
+          (self._isDebug ? "" : ".min") +
+          ".html",
+        openFrameUrl:
+          self._assetsUrl +
+          "/html/masterpass-landing-frame" +
+          (self._isDebug ? "" : ".min") +
+          ".html",
+      },
+      function (service) {
+        self._frameService = service;
+        clearTimeout(failureTimeout);
+        analytics.sendEvent(self._client, "masterpass.load.succeeded");
+        resolve(self);
+      }
+    );
+  });
+};
+
+/**
+ * Launches the Masterpass flow and returns a nonce payload. Only one Masterpass flow should be active at a time. One way to achieve this is to disable your Masterpass button while the flow is open.
+ *
+ * Braintree will apply these properties in `options.config`. Merchants should not override these values, except for advanced usage.
+ *  - `environment`
+ *  - `requestToken`
+ *  - `callbackUrl`
+ *  - `merchantCheckoutId`
+ *  - `allowedCardTypes`
+ *  - `version`
+ *
+ * @public
+ * @param {object} options All options for initiating the Masterpass payment flow.
+ * @param {string} options.currencyCode The currency code to process the payment.
+ * @param {string} options.subtotal The amount to authorize for the transaction.
+ * @param {object} [options.config] All configuration parameters accepted by Masterpass lightbox, except `function` data type. These options will override the values set by Braintree server. Please see {@link Masterpass Lightbox Parameters|https://developer.mastercard.com/page/masterpass-lightbox-parameters} for more information.
+ * @param {object} [options.frameOptions] Used to configure the window that contains the Masterpass login.
+ * @param {number} [options.frameOptions.width] Popup width to be used instead of default value (450px).
+ * @param {number} [options.frameOptions.height] Popup height to be used instead of default value (660px).
+ * @param {number} [options.frameOptions.top] The top position of the popup window to be used instead of default value, that is calculated based on provided height, and parent window size.
+ * @param {number} [options.frameOptions.left] The left position to the popup window to be used instead of default value, that is calculated based on provided width, and parent window size.
+ * @param {callback} [callback] The second argument, <code>data</code>, is a {@link Masterpass~tokenizePayload|tokenizePayload}. If no callback is provided, the method will return a Promise that resolves with a {@link Masterpass~tokenizePayload|tokenizePayload}.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * button.addEventListener('click', function () {
+ *   // Disable the button so that we don't attempt to open multiple popups.
+ *   button.setAttribute('disabled', 'disabled');
+ *
+ *   // Because tokenize opens a new window, this must be called
+ *   // as a result of a user action, such as a button click.
+ *   masterpassInstance.tokenize({
+ *     currencyCode: 'USD',
+ *     subtotal: '10.00'
+ *   }).then(function (payload) {
+ *     button.removeAttribute('disabled');
+ *     // Submit payload.nonce to your server
+ *   }).catch(function (tokenizeError) {
+ *     button.removeAttribute('disabled');
+ *     // Handle flow errors or premature flow closure
+ *
+ *     switch (tokenizeErr.code) {
+ *       case 'MASTERPASS_POPUP_CLOSED':
+ *         console.error('Customer closed Masterpass popup.');
+ *         break;
+ *       case 'MASTERPASS_ACCOUNT_TOKENIZATION_FAILED':
+ *         console.error('Masterpass tokenization failed. See details:', tokenizeErr.details);
+ *         break;
+ *       case 'MASTERPASS_FLOW_FAILED':
+ *         console.error('Unable to initialize Masterpass flow. Are your options correct?', tokenizeErr.details);
+ *         break;
+ *       default:
+ *         console.error('Error!', tokenizeErr);
+ *     }
+ *   });
+ * });
+ */
+Masterpass.prototype.tokenize = function (options) {
+  var self = this;
+
+  if (!options || hasMissingOption(options)) {
+    return Promise.reject(
+      new BraintreeError(errors.MASTERPASS_TOKENIZE_MISSING_REQUIRED_OPTION)
+    );
+  }
+
+  if (self._authInProgress) {
+    return Promise.reject(
+      new BraintreeError(errors.MASTERPASS_TOKENIZATION_ALREADY_IN_PROGRESS)
+    );
+  }
+
+  return new Promise(function (resolve, reject) {
+    self._navigateFrameToLoadingPage(options).catch(reject);
+    // This MUST happen after _navigateFrameToLoadingPage for Metro browsers to work.
+    self._frameService.open(
+      options.frameOptions,
+      self._createFrameOpenHandler(resolve, reject)
+    );
+  });
+};
+
+Masterpass.prototype._navigateFrameToLoadingPage = function (options) {
+  var self = this;
+
+  this._authInProgress = true;
+
+  return this._client
+    .request({
+      method: "post",
+      endpoint: "masterpass/request_token",
+      data: {
+        requestToken: {
+          originUrl: window.location.protocol + "//" + window.location.hostname,
+          subtotal: options.subtotal,
+          currencyCode: options.currencyCode,
+          callbackUrl: this._callbackUrl,
+        },
+      },
+    })
+    .then(function (response) {
+      var redirectUrl =
+        self._assetsUrl +
+        "/html/masterpass-loading-frame" +
+        (self._isDebug ? "" : ".min") +
+        ".html?";
+      var gatewayConfiguration =
+        self._client.getConfiguration().gatewayConfiguration;
+      var config = options.config || {};
+      var queryParams;
+
+      queryParams = {
+        environment: gatewayConfiguration.environment,
+        requestToken: response.requestToken,
+        callbackUrl: self._callbackUrl,
+        merchantCheckoutId: gatewayConfiguration.masterpass.merchantCheckoutId,
+        allowedCardTypes: gatewayConfiguration.masterpass.supportedNetworks,
+        version: constants.MASTERPASS_VERSION,
+      };
+
+      Object.keys(config).forEach(function (key) {
+        if (typeof config[key] !== "function") {
+          queryParams[key] = config[key];
+        }
+      });
+
+      redirectUrl += Object.keys(queryParams)
+        .map(function (key) {
+          return key + "=" + queryParams[key];
+        })
+        .join("&");
+
+      self._frameService.redirect(redirectUrl);
+    })
+    .catch(function (err) {
+      var status = err.details && err.details.httpStatus;
+
+      self._closeWindow();
+
+      if (status === 422) {
+        return Promise.reject(
+          convertToBraintreeError(err, errors.MASTERPASS_INVALID_PAYMENT_OPTION)
+        );
+      }
+
+      return Promise.reject(
+        convertToBraintreeError(err, errors.MASTERPASS_FLOW_FAILED)
+      );
+    });
+};
+
+Masterpass.prototype._createFrameOpenHandler = function (resolve, reject) {
+  var self = this;
+
+  if (window.popupBridge) {
+    return function (popupBridgeErr, payload) {
+      self._authInProgress = false;
+
+      if (popupBridgeErr) {
+        analytics.sendEvent(
+          self._client,
+          "masterpass.tokenization.closed-popupbridge.by-user"
+        );
+        reject(
+          convertToBraintreeError(
+            popupBridgeErr,
+            errors.MASTERPASS_POPUP_CLOSED
+          )
+        );
+
+        return;
+      } else if (!payload.queryItems) {
+        analytics.sendEvent(
+          self._client,
+          "masterpass.tokenization.failed-popupbridge"
+        );
+        reject(new BraintreeError(errors.MASTERPASS_FLOW_FAILED));
+
+        return;
+      }
+
+      self._tokenizeMasterpass(payload.queryItems).then(resolve).catch(reject);
+    };
+  }
+
+  return function (frameServiceErr, payload) {
+    if (frameServiceErr) {
+      self._authInProgress = false;
+
+      if (frameServiceErr.code === "FRAME_SERVICE_FRAME_CLOSED") {
+        analytics.sendEvent(
+          self._client,
+          "masterpass.tokenization.closed.by-user"
+        );
+        reject(new BraintreeError(errors.MASTERPASS_POPUP_CLOSED));
+
+        return;
+      }
+
+      if (
+        frameServiceErr.code &&
+        frameServiceErr.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED") > -1
+      ) {
+        analytics.sendEvent(
+          self._client,
+          "masterpass.tokenization.failed.to-open"
+        );
+        reject(
+          new BraintreeError({
+            code: errors.MASTERPASS_POPUP_OPEN_FAILED.code,
+            type: errors.MASTERPASS_POPUP_OPEN_FAILED.type,
+            message: errors.MASTERPASS_POPUP_OPEN_FAILED.message,
+            details: {
+              originalError: frameServiceErr,
+            },
+          })
+        );
+
+        return;
+      }
+
+      analytics.sendEvent(self._client, "masterpass.tokenization.failed");
+      self._closeWindow();
+      reject(
+        convertToBraintreeError(frameServiceErr, errors.MASTERPASS_FLOW_FAILED)
+      );
+
+      return;
+    }
+
+    self._tokenizeMasterpass(payload).then(resolve).catch(reject);
+  };
+};
+
+Masterpass.prototype._tokenizeMasterpass = function (payload) {
+  var self = this;
+
+  if (payload.mpstatus !== "success") {
+    analytics.sendEvent(self._client, "masterpass.tokenization.closed.by-user");
+    self._closeWindow();
+
+    return Promise.reject(new BraintreeError(errors.MASTERPASS_POPUP_CLOSED));
+  }
+
+  if (isMissingRequiredPayload(payload)) {
+    analytics.sendEvent(
+      self._client,
+      "masterpass.tokenization.closed.missing-payload"
+    );
+    self._closeWindow();
+
+    return Promise.reject(
+      new BraintreeError(errors.MASTERPASS_POPUP_MISSING_REQUIRED_PARAMETERS)
+    );
+  }
+
+  return self._client
+    .request({
+      endpoint: "payment_methods/masterpass_cards",
+      method: "post",
+      data: {
+        masterpassCard: {
+          checkoutResourceUrl: payload.checkout_resource_url,
+          requestToken: payload.oauth_token,
+          verifierToken: payload.oauth_verifier,
+        },
+      },
+    })
+    .then(function (response) {
+      self._closeWindow();
+      if (window.popupBridge) {
+        analytics.sendEvent(
+          self._client,
+          "masterpass.tokenization.success-popupbridge"
+        );
+      } else {
+        analytics.sendEvent(self._client, "masterpass.tokenization.success");
+      }
+
+      return response.masterpassCards[0];
+    })
+    .catch(function (tokenizeErr) {
+      self._closeWindow();
+      if (window.popupBridge) {
+        analytics.sendEvent(
+          self._client,
+          "masterpass.tokenization.failed-popupbridge"
+        );
+      } else {
+        analytics.sendEvent(self._client, "masterpass.tokenization.failed");
+      }
+
+      return Promise.reject(
+        convertToBraintreeError(
+          tokenizeErr,
+          errors.MASTERPASS_ACCOUNT_TOKENIZATION_FAILED
+        )
+      );
+    });
+};
+
+function isMissingRequiredPayload(payload) {
+  return [
+    payload.oauth_verifier,
+    payload.oauth_token,
+    payload.checkout_resource_url,
+  ].some(function (element) {
+    return element == null || element === "null";
+  });
+}
+
+Masterpass.prototype._closeWindow = function () {
+  this._authInProgress = false;
+  this._frameService.close();
+};
+
+/**
+ * Cleanly tear down anything set up by {@link module:braintree-web/masterpass.create|create}.
+ * @public
+ * @param {callback} [callback] Called on completion. If no callback is provided, `teardown` returns a promise.
+ * @example
+ * masterpassInstance.teardown();
+ * @example <caption>With callback</caption>
+ * masterpassInstance.teardown(function () {
+ *   // teardown is complete
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+Masterpass.prototype.teardown = function () {
+  var self = this;
+
+  return new Promise(function (resolve) {
+    self._frameService.teardown();
+
+    convertMethodsToError(self, methods(Masterpass.prototype));
+
+    analytics.sendEvent(self._client, "masterpass.teardown-completed");
+
+    resolve();
+  });
+};
+
+function hasMissingOption(options) {
+  var i, option;
+
+  for (i = 0; i < constants.REQUIRED_OPTIONS_FOR_TOKENIZE.length; i++) {
+    option = constants.REQUIRED_OPTIONS_FOR_TOKENIZE[i];
+
+    if (!options.hasOwnProperty(option)) {
+      return true;
+    }
+  }
+
+  return false;
+}
+
+module.exports = wrapPromise.wrapPrototype(Masterpass);
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/masterpass_index.js.html b/3.111.1/masterpass_index.js.html new file mode 100644 index 00000000..07ef4760 --- /dev/null +++ b/3.111.1/masterpass_index.js.html @@ -0,0 +1,246 @@ + + + + + + + + + + + masterpass/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ masterpass/index.js +

+ + + + + +
+
+
"use strict";
+/** @module braintree-web/masterpass
+ * @description Processes Masterpass. *This component is currently in beta and is subject to change.*
+ */
+
+var BraintreeError = require("../lib/braintree-error");
+var basicComponentVerification = require("../lib/basic-component-verification");
+var browserDetection = require("./shared/browser-detection");
+var Masterpass = require("./external/masterpass");
+var createDeferredClient = require("../lib/create-deferred-client");
+var createAssetsUrl = require("../lib/create-assets-url");
+var VERSION = process.env.npm_package_version;
+var errors = require("./shared/errors");
+var wrapPromise = require("@braintree/wrap-promise");
+
+/**
+ * @static
+ * @function create
+ * @param {object} options Creation options:
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {callback} [callback] The second argument, `data`, is the {@link Masterpass} instance. If no callback is passed in, the create function returns a promise that resolves the {@link Masterpass} instance.
+ * @example
+ * braintree.masterpass.create({
+ *   client: clientInstance
+ * }, function (createErr, masterpassInstance) {
+ *   if (createErr) {
+ *     if (createErr.code === 'MASTERPASS_BROWSER_NOT_SUPPORTED') {
+ *       console.error('This browser is not supported.');
+ *     } else {
+ *       console.error('Error!', createErr);
+ *     }
+ *     return;
+ *   }
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+function create(options) {
+  var name = "Masterpass";
+
+  return basicComponentVerification
+    .verify({
+      name: name,
+      client: options.client,
+      authorization: options.authorization,
+    })
+    .then(function () {
+      if (!isSupported()) {
+        return Promise.reject(
+          new BraintreeError(errors.MASTERPASS_BROWSER_NOT_SUPPORTED)
+        );
+      }
+
+      return Promise.resolve();
+    })
+    .then(function () {
+      return createDeferredClient.create({
+        authorization: options.authorization,
+        client: options.client,
+        debug: options.debug,
+        assetsUrl: createAssetsUrl.create(options.authorization),
+        name: name,
+      });
+    })
+    .then(function (client) {
+      var masterpassInstance, configuration;
+
+      options.client = client;
+      configuration = options.client.getConfiguration().gatewayConfiguration;
+
+      if (!configuration.masterpass) {
+        return Promise.reject(
+          new BraintreeError(errors.MASTERPASS_NOT_ENABLED)
+        );
+      }
+
+      masterpassInstance = new Masterpass(options);
+
+      return masterpassInstance._initialize();
+    });
+}
+
+/**
+ * @static
+ * @function isSupported
+ * @description Returns true if Masterpass supports this browser.
+ * @example
+ * if (braintree.masterpass.isSupported()) {
+ *   // Add Masterpass button to the page
+ * } else {
+ *   // Hide Masterpass payment option
+ * }
+ * @returns {Boolean} Returns true if Masterpass supports this browser.
+ */
+function isSupported() {
+  return Boolean(window.popupBridge || browserDetection.supportsPopups());
+}
+
+module.exports = {
+  create: wrapPromise(create),
+  isSupported: isSupported,
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/masterpass_shared_errors.js.html b/3.111.1/masterpass_shared_errors.js.html new file mode 100644 index 00000000..433b2492 --- /dev/null +++ b/3.111.1/masterpass_shared_errors.js.html @@ -0,0 +1,217 @@ + + + + + + + + + + + masterpass/shared/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ masterpass/shared/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.Masterpass - Creation Error Codes
+ * @description Errors that occur when [creating the Masterpass component](./module-braintree-web_masterpass#.create).
+ * @property {CUSTOMER} MASTERPASS_BROWSER_NOT_SUPPORTED Occurs when browser is not a supported browser for Masterpass.
+ * @property {MERCHANT} MASTERPASS_NOT_ENABLED Occurs when Masterpass is not enabled in the Braintree control panel.
+ */
+
+/**
+ * @name BraintreeError.Masterpass - Tokenize Error Codes
+ * @description Errors that occur when [tokenizing](./Masterpass.html#tokenize).
+ * @property {MERCHANT} MASTERPASS_TOKENIZE_MISSING_REQUIRED_OPTION Occurs when tokenize is called without a required option.
+ * @property {MERCHANT} MASTERPASS_TOKENIZATION_ALREADY_IN_PROGRESS Occurs if tokenization flow is initialized while another flow is already in progress.
+ * @property {NETWORK} MASTERPASS_ACCOUNT_TOKENIZATION_FAILED Occurs when tokenization of Masterpass details fails.
+ * @property {MERCHANT} MASTERPASS_POPUP_OPEN_FAILED Occurs when the popup fails to open.
+ * @property {MERCHANT} MASTERPASS_POPUP_MISSING_REQUIRED_PARAMETERS Occurs when Masterpass is missing required parameters for tokenization.
+ * @property {CUSTOMER} MASTERPASS_POPUP_CLOSED Occurs when the popup is closed by the customer.
+ * @property {MERCHANT} MASTERPASS_INVALID_PAYMENT_OPTION Occurs when an invalid payment option is used to tokenize Masterpass.
+ * @property {NETWORK} MASTERPASS_FLOW_FAILED Occurs when an error is returned from request to tokenize.
+ */
+
+var BraintreeError = require("../../lib/braintree-error");
+
+module.exports = {
+  MASTERPASS_BROWSER_NOT_SUPPORTED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "MASTERPASS_BROWSER_NOT_SUPPORTED",
+    message: "Browser is not supported.",
+  },
+  MASTERPASS_NOT_ENABLED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "MASTERPASS_NOT_ENABLED",
+    message: "Masterpass is not enabled for this merchant.",
+  },
+  MASTERPASS_TOKENIZE_MISSING_REQUIRED_OPTION: {
+    type: BraintreeError.types.MERCHANT,
+    code: "MASTERPASS_TOKENIZE_MISSING_REQUIRED_OPTION",
+    message: "Missing required option for tokenize.",
+  },
+  MASTERPASS_TOKENIZATION_ALREADY_IN_PROGRESS: {
+    type: BraintreeError.types.MERCHANT,
+    code: "MASTERPASS_TOKENIZATION_ALREADY_IN_PROGRESS",
+    message: "Masterpass tokenization is already in progress.",
+  },
+  MASTERPASS_ACCOUNT_TOKENIZATION_FAILED: {
+    type: BraintreeError.types.NETWORK,
+    code: "MASTERPASS_ACCOUNT_TOKENIZATION_FAILED",
+    message: "Could not tokenize user's Masterpass account.",
+  },
+  MASTERPASS_POPUP_OPEN_FAILED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "MASTERPASS_POPUP_OPEN_FAILED",
+    message:
+      "Masterpass popup failed to open. Make sure to tokenize in response to a user action, such as a click.",
+  },
+  MASTERPASS_POPUP_MISSING_REQUIRED_PARAMETERS: {
+    type: BraintreeError.types.MERCHANT,
+    code: "MASTERPASS_POPUP_MISSING_REQUIRED_PARAMETERS",
+    message:
+      "Masterpass popup failed to return all required parameters needed to continue tokenization.",
+  },
+  MASTERPASS_POPUP_CLOSED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "MASTERPASS_POPUP_CLOSED",
+    message: "Customer closed Masterpass popup before authorizing.",
+  },
+  MASTERPASS_INVALID_PAYMENT_OPTION: {
+    type: BraintreeError.types.MERCHANT,
+    code: "MASTERPASS_INVALID_PAYMENT_OPTION",
+    message: "Masterpass payment options are invalid.",
+  },
+  MASTERPASS_FLOW_FAILED: {
+    type: BraintreeError.types.NETWORK,
+    code: "MASTERPASS_FLOW_FAILED",
+    message: "Could not initialize Masterpass flow.",
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/module-braintree-web.html b/3.111.1/module-braintree-web.html new file mode 100644 index 00000000..eb53ff6c --- /dev/null +++ b/3.111.1/module-braintree-web.html @@ -0,0 +1,1495 @@ + + + + + + + + + braintree-web - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web +

+ + + + +
+
+ + + +
+ +
+
+ + +
+

This is the top-level module exported by the Braintree JavaScript SDK. In a browser environment, this will be the global braintree object. In a CommonJS environment (like Browserify or Webpack), it will be the default export of the braintree-web package. In AMD environments (like RequireJS), it can be required like other modules.

+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ +

+ CommonJS +

+ + +
var braintree = require('braintree-web');
+
+braintree.client.create(...);
+ +

+ In the browser +

+ + +
<script src="https://js.braintreegateway.com/web/3.111.1/js/client.min.js"></script>
+<script>
+  window.braintree.client.create(...);
+</script>
+ +

+ AMD +

+ + +
// main.js
+require.config({
+  paths: {
+    braintreeClient: 'https://js.braintreegateway.com/web/3.111.1/js/client.min'
+  }
+});
+
+require(['braintreeClient'], function (braintreeClient) {
+  braintreeClient.create(...);
+});
+ + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) americanExpress :module:braintree-web/american-express +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) applePay :module:braintree-web/apple-pay +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) client :module:braintree-web/client +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) dataCollector :module:braintree-web/data-collector +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) fastlane :module:braintree-web/fastlane +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) googlePayment :module:braintree-web/google-payment +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) hostedFields :module:braintree-web/hosted-fields +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) localPayment :module:braintree-web/local-payment +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) masterpass :module:braintree-web/masterpass +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) paymentRequest :module:braintree-web/payment-request +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) paypal :module:braintree-web/paypal +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) paypalCheckout :module:braintree-web/paypal-checkout +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

+ (static) sepa :module:braintree-web/sepa +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) threeDSecure :module:braintree-web/three-d-secure +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

+ (static) usBankAccount :module:braintree-web/us-bank-account +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) vaultManager :module:braintree-web/vault-manager +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) venmo :module:braintree-web/venmo +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + +

+ (static) visaCheckout :module:braintree-web/visa-checkout +

+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_american-express.html b/3.111.1/module-braintree-web_american-express.html new file mode 100644 index 00000000..808ac515 --- /dev/null +++ b/3.111.1/module-braintree-web_american-express.html @@ -0,0 +1,614 @@ + + + + + + + + + braintree-web/american-express - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/american-express +

+ + + + +
+
+ + + +
+ +
+
+ + +
+

This module is for use with Amex Express Checkout. To accept American Express cards, use Hosted Fields.

+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

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

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the AmericanExpress instance. If no callback is provided, create returns a promise that resolves with the AmericanExpress instance.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_apple-pay.html b/3.111.1/module-braintree-web_apple-pay.html new file mode 100644 index 00000000..c71008c4 --- /dev/null +++ b/3.111.1/module-braintree-web_apple-pay.html @@ -0,0 +1,653 @@ + + + + + + + + + braintree-web/apple-pay - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/apple-pay +

+ + + + +
+
+ + + +
+ +
+
+ + +
+

Accept Apple Pay on the Web. This component is currently in beta and is subject to change.

+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

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

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
useDeferredClient + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+

Used in conjunction with authorization, allows the Apple Pay instance to be available right away by fetching the client configuration in the background. When this option is used, ApplePay#createPaymentRequest will return a promise that resolves with the configuration instead of returning synchronously.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the ApplePay instance. If no callback is provided, create returns a promise that resolves with the ApplePay instance.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_client.html b/3.111.1/module-braintree-web_client.html new file mode 100644 index 00000000..ddea2c7c --- /dev/null +++ b/3.111.1/module-braintree-web_client.html @@ -0,0 +1,520 @@ + + + + + + + + + braintree-web/client - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/client +

+ + + + +
+
+ + +
+ +
+
+ + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

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

+
+ + + + + +
+

This function is the entry point for the braintree.client module. It is used for creating Client instances that service communication to Braintree servers.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Object containing all Client options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
authorization + + + + string + + + + + + + +

A tokenizationKey or clientToken.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the Client instance.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
var createClient = require('braintree-web/client').create;
+
+createClient({
+  authorization: CLIENT_AUTHORIZATION
+}, function (createErr, clientInstance) {
+  if (createErr) {
+    if (createErr.code === 'CLIENT_AUTHORIZATION_INVALID') {
+      // either the client token has expired, and a new one should be generated
+      // or the tokenization key was deactivated or deleted
+    } else {
+      console.log('something went wrong creating the client instance', createErr);
+    }
+    return;
+  }
+
+ // set up other components
+});
+ + +
+ + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_data-collector.html b/3.111.1/module-braintree-web_data-collector.html new file mode 100644 index 00000000..04583ce5 --- /dev/null +++ b/3.111.1/module-braintree-web_data-collector.html @@ -0,0 +1,777 @@ + + + + + + + + + braintree-web/data-collector - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/data-collector +

+ + + + +
+
+ + +
+ +
+
+ + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

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

+
+ + + + + +
+

Creates a DataCollector instance and collects device data based on your merchant configuration. We recommend that you call this method as early as possible, e.g. as soon as your website loads. If that's too early, call it at the beginning of customer checkout. +Note: To use your own Kount ID, contact our support team (support@braintreepayments.com or 877.434.2894).

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
useDeferredClient + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+

Used in conjunction with authorization, allows the Data Collector instance to be available right away by fetching the client configuration in the background. When this option is used, GooglePayment#getDeviceData must be used to collect the device data.

+ +
kount + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+

Kount fraud data collection will occur if the merchant configuration has it enabled. +Note: the data sent to Kount is asynchronous and may not have completed by the time the data collector create call is complete. In most cases, this will not matter, but if you create the data collector instance and immediately navigate away from the page, the device information may fail to be sent to Kount.

+ +
paypal + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+

Deprecated: PayPal fraud data collection will occur when the DataCollector instance is created.

+ +
riskCorrelationId + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Pass a custom risk correlation id when creating the data collector.

+ +
clientMetadataId + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Deprecated. Use options.riskCorrelationId instead.

+ +
correlationId + + + + string + + + + + + + + + <optional>
+ + + + + +
+

Deprecated. Use options.riskCorrelationId instead.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the DataCollector instance.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_fastlane.html b/3.111.1/module-braintree-web_fastlane.html new file mode 100644 index 00000000..2f3c309f --- /dev/null +++ b/3.111.1/module-braintree-web_fastlane.html @@ -0,0 +1,564 @@ + + + + + + + + + braintree-web/fastlane - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/fastlane +

+ + + + +
+
+ + +
+ +
+
+ + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ (static) create(options) → {Promise|void} +

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
deviceData + + + + string + + + + + + + + + <optional>
+ + + + + +
+

A DataCollector instance.

+ +
+ + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
braintree.fastlane.create({
+  client: clientInstance,
+  deviceData: dataCollectorInstance
+}).then(function (fastlaneInstance) {
+  // fastlaneInstance is ready to create an identity instance.
+    identity = fastlaneInstance.identity
+}).catch(function (createErr) {
+  console.error('Error creating fastlane instance', createErr);
+});
+ +

+ Creating a fastlane component +

+ + +
braintree.fastlane.create({
+  client: clientInstance,
+  deviceData: dataCollectorInstance
+}).then(function (fastlaneInstance) {
+  // fastlaneInstance is ready to create an identity instance.
+    identity = fastlaneInstance.identity
+}).catch(function (createErr) {
+  console.error('Error creating fastlane instance', createErr);
+});
+ + +
+ + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_google-payment.html b/3.111.1/module-braintree-web_google-payment.html new file mode 100644 index 00000000..67dca065 --- /dev/null +++ b/3.111.1/module-braintree-web_google-payment.html @@ -0,0 +1,851 @@ + + + + + + + + + braintree-web/google-payment - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/google-payment +

+ + + + +
+
+ + + +
+ +
+
+ + +
+

A component to integrate with Google Pay. The majority of the integration uses Google's pay.js JavaScript file. The Braintree component generates the configuration object necessary for Google Pay to initiate the Payment Request and parse the returned data to retrieve the payment method nonce which is used to process the transaction on the server.

+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

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

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
useDeferredClient + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+

Used in conjunction with authorization, allows the Google Payment instance to be available right away by fetching the client configuration in the background. When this option is used, GooglePayment#createPaymentDataRequest will return a promise that resolves with the configuration instead of returning synchronously.

+ +
googlePayVersion + + + + number + + + + + + + + + <optional>
+ + + + + +
+

The version of the Google Pay API to use. Value of 2 is required to accept parameters documented by Google. Omit this parameter to use the deprecated Google Pay Version 1.

+ +
googleMerchantId + + + + string + + + + + + + + + <optional>
+ + + + + +
+

A Google merchant identifier issued after your website is approved by Google. Required when PaymentsClient is initialized with an environment property of PRODUCTION, but may be omitted in TEST environment.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the GooglePayment instance. If no callback is provided, create returns a promise that resolves with the GooglePayment instance.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ +

+ Simple Example +

+ + +
// include https://pay.google.com/gp/p/js/pay.js in a script tag
+// on your page to load the `google.payments.api.PaymentsClient` global object.
+
+var paymentButton = document.querySelector('#google-pay-button');
+var paymentsClient = new google.payments.api.PaymentsClient({
+  environment: 'TEST' // or 'PRODUCTION'
+});
+
+braintree.client.create({
+  authorization: 'tokenization-key-or-client-token'
+}).then(function (clientInstance) {
+  return braintree.googlePayment.create({
+    client: clientInstance,
+     googlePayVersion: 2,
+     googleMerchantId: 'your-merchant-id-from-google'
+  });
+}).then(function (googlePaymentInstance) {
+  paymentButton.addEventListener('click', function (event) {
+    var paymentDataRequest;
+
+    event.preventDefault();
+
+    paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
+      transactionInfo: {
+        currencyCode: 'USD',
+        totalPriceStatus: 'FINAL',
+        totalPrice: '100.00'
+      }
+    });
+
+    paymentsClient.loadPaymentData(paymentDataRequest).then(function (paymentData) {
+      return googlePaymentInstance.parseResponse(paymentData);
+    }).then(function (result) {
+      // send result.nonce to your server
+    }).catch(function (err) {
+      // handle err
+    });
+  });
+});
+ +

+ Check Browser and Customer Compatibility +

+ + +
var paymentsClient = new google.payments.api.PaymentsClient({
+  environment: 'TEST' // or 'PRODUCTION'
+});
+
+function setupGooglePayButton(googlePaymentInstance) {
+  var button = document.createElement('button');
+
+  button.id = 'google-pay';
+  button.appendChild(document.createTextNode('Google Pay'));
+  button.addEventListener('click', function (event) {
+    var paymentRequestData;
+
+    event.preventDefault();
+
+    paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
+      transactionInfo: {
+        currencyCode: 'USD',
+        totalPriceStatus: 'FINAL',
+        totalPrice: '100.00' // your amount
+      }
+    });
+
+    paymentsClient.loadPaymentData(paymentDataRequest).then(function (paymentData) {
+      return googlePaymentInstance.parseResponse(paymentData);
+      }).then(function (result) {
+      // send result.nonce to your server
+    }).catch(function (err) {
+      // handle errors
+    });
+  });
+
+  document.getElementById('container').appendChild(button);
+}
+
+braintree.client.create({
+  authorization: 'tokenization-key-or-client-token'
+}).then(function (clientInstance) {
+  return braintree.googlePayment.create({
+    client: clientInstance,
+    googlePayVersion: 2,
+    googleMerchantId: 'your-merchant-id-from-google'
+  });
+}).then(function (googlePaymentInstance) {
+
+  return paymentsClient.isReadyToPay({
+    // see https://developers.google.com/pay/api/web/reference/object#IsReadyToPayRequest for all options
+    apiVersion: 2,
+    apiVersionMinor: 0,
+    allowedPaymentMethods: googlePaymentInstance.createPaymentDataRequest().allowedPaymentMethods,
+    existingPaymentMethodRequired: true
+  });
+}).then(function (response) {
+  if (response.result) {
+    setupGooglePayButton(googlePaymentInstance);
+  }
+}).catch(function (err) {
+  // handle setup errors
+});
+ + +
+ + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_hosted-fields.html b/3.111.1/module-braintree-web_hosted-fields.html new file mode 100644 index 00000000..f3a269b7 --- /dev/null +++ b/3.111.1/module-braintree-web_hosted-fields.html @@ -0,0 +1,2548 @@ + + + + + + + + + braintree-web/hosted-fields - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/hosted-fields +

+ + + + +
+
+ + +
+ +
+
+ + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ (static) create(options, callbackopt) → {void} +

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+ + +

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
fields + + + + fieldOptions + + + + + + + + + + + + + + + +

A set of options for each field.

+ +
styles + + + + styleOptions + + + + + + + + + <optional>
+ + + + + +
+ + +

Styles applied to each field.

+ +
preventAutofill + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + false + + +

When true, browsers will not try to prompt the customer to autofill their credit card information.

+ +
sessionId + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

Used in specific cases where associating SDK events with a specific external id is required.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the HostedFields instance. If no callback is provided, create returns a promise that resolves with the HostedFields instance.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
braintree.hostedFields.create({
+  client: clientInstance,
+  styles: {
+    'input': {
+      'font-size': '16pt',
+      'color': '#3A3A3A'
+    },
+    '.number': {
+      'font-family': 'monospace'
+    },
+    '.valid': {
+      'color': 'green'
+    }
+  },
+  fields: {
+    number: {
+      container: '#card-number'
+    },
+    cvv: {
+      container: '#cvv',
+      placeholder: '•••'
+    },
+    expirationDate: {
+      container: '#expiration-date'
+    }
+  }
+}, callback);
+ +

+ With cardholder name +

+ + +
braintree.hostedFields.create({
+  client: clientInstance,
+  fields: {
+    number: {
+      container: '#card-number'
+    },
+    cardholderName: {
+      container: '#cardholder-name'
+    },
+    cvv: {
+      container: '#cvv',
+    },
+    expirationDate: {
+      container: '#expiration-date'
+    }
+  }
+}, callback);
+ +

+ Applying styles with a class name +

+ + +
// in document head
+<style>
+  .braintree-input-class {
+    color: black;
+  }
+  .braintree-valid-class {
+    color: green;
+  }
+  .braintree-invalid-class {
+    color: red;
+  }
+</style>
+// in a script tag
+braintree.hostedFields.create({
+  client: clientInstance,
+  styles: {
+    'input': 'braintree-input-class',
+    '.invalid': 'braintree-invalid-class',
+    '.valid': {
+      // you can also use the object syntax alongside
+      // the class name syntax
+      color: green;
+    }
+  },
+  fields: {
+    number: {
+      container: '#card-number'
+    },
+    // etc...
+  }
+}, callback);
+ +

+ Right to Left Language Support +

+ + +
braintree.hostedFields.create({
+  client: clientInstance,
+  styles: {
+    'input': {
+      // other styles
+      direction: 'rtl'
+    },
+  },
+  fields: {
+    number: {
+      container: '#card-number',
+      // Credit card formatting is not currently supported
+      // with RTL languages, so we need to turn it off for the number input
+      formatInput: false
+    },
+    cvv: {
+      container: '#cvv',
+      placeholder: '•••'
+    },
+    expirationDate: {
+      container: '#expiration-date',
+      type: 'month'
+    }
+  }
+}, callback);
+ +

+ Setting up Hosted Fields to tokenize CVV only +

+ + +
braintree.hostedFields.create({
+  client: clientInstance,
+  fields: {
+    // Only add the `cvv` option.
+    cvv: {
+      container: '#cvv',
+      placeholder: '•••'
+    }
+  }
+}, callback);
+ +

+ Creating an expiration date update form with prefilled data +

+ + +
var storedCreditCardInformation = {
+  // get this info from your server
+  // with a payment method lookup
+  month: '09',
+  year: '2017'
+};
+
+braintree.hostedFields.create({
+  client: clientInstance,
+  fields: {
+    expirationMonth: {
+      container: '#expiration-month',
+      prefill: storedCreditCardInformation.month
+    },
+    expirationYear: {
+      container: '#expiration-year',
+      prefill: storedCreditCardInformation.year
+    }
+  }
+}, callback);
+ +

+ Validate the card form for supported card types +

+ + +
braintree.hostedFields.create({
+  client: clientInstance,
+  fields: {
+    number: {
+      container: '#card-number',
+      supportedCardBrands: {
+        visa: false, // prevents Visas from showing up as valid even when the Braintree control panel is configured to allow them
+        'diners-club': true // allow Diners Club cards to be valid (processed as Discover cards on the Braintree backend)
+      }
+    },
+    cvv: {
+      container: '#cvv',
+      placeholder: '•••'
+    },
+    expirationDate: {
+      container: '#expiration-date',
+      type: 'month'
+    }
+  },
+}, callback);
+ + +
+ + + + + + + + + + + + + + +

+ (static) supportsInputFormatting() → {Boolean} +

+
+ + + + + +
+

Returns false if input formatting will be automatically disabled due to browser incompatibility. Otherwise, returns true. For a list of unsupported browsers, go here.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Conditionally choosing split expiration date inputs if formatting is unavailable +

+ + +
var canFormat = braintree.hostedFields.supportsInputFormatting();
+var fields = {
+  number: {
+    container: '#card-number'
+  },
+  cvv: {
+    container: '#cvv'
+  }
+};
+
+if (canFormat) {
+  fields.expirationDate = {
+    selection: '#expiration-date'
+  };
+  functionToCreateAndInsertExpirationDateDivToForm();
+} else {
+  fields.expirationMonth = {
+    selection: '#expiration-month'
+  };
+  fields.expirationYear = {
+    selection: '#expiration-year'
+  };
+  functionToCreateAndInsertExpirationMonthAndYearDivsToForm();
+}
+
+braintree.hostedFields.create({
+  client: clientInstance,
+  styles: {
+    // Styles
+  },
+  fields: fields
+}, callback);
+ + +
+ + + + + + +

Type Definitions

+ + + + + + + + + + + + + +

+ field :object +

+
+ + + + + +
+

Fields used in fields options

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
selector + + + + string + + + + + + + + + + + + + +

Deprecated: Now an alias for options.container.

+
container + + + + string + + + | + + + HTMLElement + + + + + + + + + + + + + +

A DOM node or CSS selector to find the container where the hosted field will be inserted.

+
placeholder + + + + string + + + + + + + + + <optional>
+ + + +
+ + +

Will be used as the placeholder attribute of the input. If placeholder is not natively supported by the browser, it will be polyfilled.

+
type + + + + string + + + + + + + + + <optional>
+ + + +
+ + +

Will be used as the type attribute of the input. To mask cvv input, for instance, type: "password" can be used.

+
iframeTitle + + + + string + + + + + + + + + <optional>
+ + + +
+ + +

The title used for the iframe containing the credit card input. By default, this will be Secure Credit Card Frame - <the name of the specific field>.

+
internalLabel + + + + string + + + + + + + + + <optional>
+ + + +
+ + +

Each Hosted Field iframe has a hidden label that is used by screen readers to identify the input. The internalLabel property can be used to customize the field for localization purposes. The default values are:

+
    +
  • number: Credit Card Number
  • +
  • cvv: CVV
  • +
  • expirationDate: Expiration Date
  • +
  • expirationMonth: Expiration Month
  • +
  • expirationYear: Expiration Year
  • +
  • postalCode: Postal Code
  • +
  • cardholderName: Cardholder Name
  • +
+
formatInput + + + + boolean + + + + + + + + + <optional>
+ + + +
+ + true + + +

Enable or disable automatic formatting on this field.

+
maskInput + + + + object + + + | + + + boolean + + + + + + + + + <optional>
+ + + +
+ + false + + +

Enable or disable input masking when input is not focused. If set to true instead of an object, the defaults for the maskInput parameters will be used.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
character + + + + string + + + + + + + + + <optional>
+ + + +
+ + • + + +

The character to use when masking the input. The default character ('•') uses a unicode symbol, so the webpage must support UTF-8 characters when using the default.

+
showLastFour + + + + Boolean + + + + + + + + + <optional>
+ + + +
+ + false + + +

Only applicable for the credit card field. Whether or not to show the last 4 digits of the card when masking.

+
+ +
select + + + + object + + + | + + + boolean + + + + + + + + + <optional>
+ + + +
+ + +

If truthy, this field becomes a <select> dropdown list. This can only be used for expirationMonth and expirationYear fields. If you do not use a placeholder property for the field, the current month/year will be the default selected value.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + Array.<string> + + + + + + + + + <optional>
+ + + +
+

An array of 12 strings, one per month. This can only be used for the expirationMonth field. For example, the array can look like ['01 - January', '02 - February', ...].

+
+ +
maxCardLength + + + + number + + + + + + + + + <optional>
+ + + +
+ + +

This option applies only to the number field. Allows a limit to the length of the card number, even if the card brand may support numbers of a greater length. If the value passed is greater than the max length for a card brand, the smaller number of the 2 values will be used. For example, is maxCardLength is set to 16, but an American Express card is entered (which has a max card length of 15), a max card length of 15 will be used.

+
maxlength + + + + number + + + + + + + + + <optional>
+ + + +
+ + +

This option applies only to the CVV and postal code fields. Will be used as the maxlength attribute of the input. The primary use cases for the maxlength option are: limiting the length of the CVV input for CVV-only verifications when the card type is known and setting the length of the postal code input when cards are coming from a known region. The default maxlength for the postal code input is 10.

+
minlength + + + + number + + + + + + + + + <optional>
+ + + +
+ + 3 + + +

This option applies only to the cvv and postal code fields. Will be used as the minlength attribute of the input. +For postal code fields, the default value is 3, representing the Icelandic postal code length. This option's primary use case is to increase the minlength, e.g. for US customers, the postal code minlength can be set to 5. +For cvv fields, the default value is 3. The minlength attribute only applies to integrations capturing a cvv without a number field.

+
prefill + + + + string + + + + + + + + + <optional>
+ + + +
+ + +

A value to prefill the field with. For example, when creating an update card form, you can prefill the expiration date fields with the old expiration date data.

+
rejectUnsupportedCards + + + + boolean + + + + + + + + + <optional>
+ + + +
+ + false + + +

Deprecated since version 3.46.0, use supportedCardBrands instead. Only allow card types that your merchant account is able to process. Unsupported card types will invalidate the card form. e.g. if you only process Visa cards, a customer entering a American Express card would get an invalid card field. This can only be used for the number field.

+
supportedCardBrands + + + + object + + + + + + + + + <optional>
+ + + +
+ + +

Override card brands that are supported by the card form. Pass 'card-brand-id': true to override the default in the merchant configuration and enable a card brand. Pass 'card-brand-id': false to disable a card brand. Unsupported card types will invalidate the card form. e.g. if you only process Visa cards, a customer entering an American Express card would get an invalid card field. This can only be used for the number field. (Note: only allow card types that your merchant account is actually able to process.)

+

Valid card brand ids are:

+
    +
  • visa
  • +
  • mastercard
  • +
  • american-express
  • +
  • diners-club
  • +
  • discover
  • +
  • jcb
  • +
  • union-pay
  • +
  • maestro
  • +
  • elo
  • +
  • mir
  • +
  • hiper
  • +
  • hipercard
  • +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ fieldOptions :object +

+
+ + + + + +
+

An object that has field objects for each field. Used in create.

+
+ + + + + + + + + + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
number + + + + field + + + + + + + + + <optional>
+ + + +
+

A field for card number.

+
expirationDate + + + + field + + + + + + + + + <optional>
+ + + +
+

A field for expiration date in MM/YYYY or MM/YY format. This should not be used with the expirationMonth and expirationYear properties.

+
expirationMonth + + + + field + + + + + + + + + <optional>
+ + + +
+

A field for expiration month in MM format. This should be used with the expirationYear property.

+
expirationYear + + + + field + + + + + + + + + <optional>
+ + + +
+

A field for expiration year in YYYY or YY format. This should be used with the expirationMonth property.

+
cvv + + + + field + + + + + + + + + <optional>
+ + + +
+

A field for 3 or 4 digit card verification code (like CVV or CID). If you wish to create a CVV-only payment method nonce to verify a card already stored in your Vault, omit all other fields to only collect CVV.

+
postalCode + + + + field + + + + + + + + + <optional>
+ + + +
+

A field for postal or region code.

+
cardholderName + + + + field + + + + + + + + + <optional>
+ + + +
+

A field for the cardholder name on the customer's credit card.

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +

+ styleOptions :object +

+
+ + + + + +
+

An object that represents CSS that will be applied in each hosted field. This object looks similar to CSS. Typically, these styles involve fonts (such as font-family or color).

+

You may also pass the name of a class on your site that contains the styles you would like to apply. The style properties will be automatically pulled off the class and applied to the Hosted Fields inputs. Note: this is recommended for input elements only. If using a select for the expiration date, unexpected styling may occur.

+

These are the CSS properties that Hosted Fields supports. Any other CSS should be specified on your page and outside of any Braintree configuration. Trying to set unsupported properties will fail and put a warning in the console.

+

Supported CSS properties are: +appearance +box-shadow +color +direction +font-family +font-size-adjust +font-size +font-stretch +font-style +font-variant-alternates +font-variant-caps +font-variant-east-asian +font-variant-ligatures +font-variant-numeric +font-variant +font-weight +font +letter-spacing +line-height +opacity +outline +margin +margin-top +margin-right +margin-bottom +margin-left +padding +padding-top +padding-right +padding-bottom +padding-left +text-align +text-shadow +transition +-moz-appearance +-moz-box-shadow +-moz-osx-font-smoothing +-moz-tap-highlight-color +-moz-transition +-webkit-appearance +-webkit-box-shadow +-webkit-font-smoothing +-webkit-tap-highlight-color +-webkit-transition

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_local-payment.html b/3.111.1/module-braintree-web_local-payment.html new file mode 100644 index 00000000..417099b5 --- /dev/null +++ b/3.111.1/module-braintree-web_local-payment.html @@ -0,0 +1,737 @@ + + + + + + + + + braintree-web/local-payment - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/local-payment +

+ + + + +
+
+ + + +
+ +
+
+ + +
+

A component to integrate with local payment methods. This component is currently in beta and is subject to change.

+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ (static) create(options, When, callback) → {Promise|void} +

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
merchantAccountId + + + + string + + + + + + + + + <optional>
+ + + + + +
+

A non-default merchant account ID to use for tokenization and creation of the authorizing transaction. Braintree strongly recommends specifying this parameter.

+ +
+ + +
When + + + + redirectUrl + + + + + + + +

provided, triggers full page redirect flow instead of popup flow.

+ +
callback + + + + callback + + + + + + + +

The second argument, data, is the LocalPayment instance.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ +

+ Using the local payment component to set up an iDEAL button +

+ + +
var idealButton = document.querySelector('.ideal-button');
+
+braintree.client.create({
+  authorization: CLIENT_AUTHORIZATION
+}, function (clientErr, clientInstance) {
+  if (clientErr) {
+    console.error('Error creating client:', clientErr);
+    return;
+  }
+
+  braintree.localPayment.create({
+    client: clientInstance,
+    merchantAccountId: 'merchantAccountEUR',
+  }, function (localPaymentErr, localPaymentInstance) {
+    if (localPaymentErr) {
+      console.error('Error creating local payment component:', localPaymentErr);
+      return;
+    }
+
+    idealButton.removeAttribute('disabled');
+
+    // When the button is clicked, attempt to start the payment flow.
+    idealButton.addEventListener('click', function (event) {
+      // Because this opens a popup, this has to be called as a result of
+      // customer action, like clicking a button. You cannot call this at any time.
+      localPaymentInstance.startPayment({
+        paymentType: 'ideal',
+        amount: '10.67',
+        city: 'Den Haag',
+        countryCode: 'NL',
+        firstName: 'Test',
+        lastName: 'McTester',
+        line1: '123 of 456 Fake Lane',
+        line2: 'Apartment 789',
+        payerEmail: 'payer@example.com',
+        phone: '123456789',
+        postalCode: '1234 AA',
+        currencyCode: 'EUR',
+        onPaymentStart: function (data, continueCallback) {
+          // Do any preprocessing to store the ID and setup webhook
+          // Call start to initiate the popup
+          continueCallback();
+        }
+*       }, function (startPaymentErr, payload) {
+        if (startPaymentErr) {
+          if (startPaymentErr.type !== 'CUSTOMER') {
+            console.error('Error starting payment:', startPaymentErr);
+          }
+          return;
+        }
+
+        idealButton.setAttribute('disabled', true);
+
+        console.log(payload.paymentId);
+      });
+    }, false);
+  });
+});
+ + +
+ + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_masterpass.html b/3.111.1/module-braintree-web_masterpass.html new file mode 100644 index 00000000..02a941e8 --- /dev/null +++ b/3.111.1/module-braintree-web_masterpass.html @@ -0,0 +1,748 @@ + + + + + + + + + braintree-web/masterpass - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/masterpass +

+ + + + +
+
+ + + +
+ +
+
+ + +
+

Processes Masterpass. This component is currently in beta and is subject to change.

+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

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

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the Masterpass instance. If no callback is passed in, the create function returns a promise that resolves the Masterpass instance.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
braintree.masterpass.create({
+  client: clientInstance
+}, function (createErr, masterpassInstance) {
+  if (createErr) {
+    if (createErr.code === 'MASTERPASS_BROWSER_NOT_SUPPORTED') {
+      console.error('This browser is not supported.');
+    } else {
+      console.error('Error!', createErr);
+    }
+    return;
+  }
+});
+ + +
+ + + + + + + + + + + + + + +

+ (static) isSupported() → {Boolean} +

+
+ + + + + +
+

Returns true if Masterpass supports this browser.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
if (braintree.masterpass.isSupported()) {
+  // Add Masterpass button to the page
+} else {
+  // Hide Masterpass payment option
+}
+ + +
+ + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_payment-request.html b/3.111.1/module-braintree-web_payment-request.html new file mode 100644 index 00000000..fbfdf13f --- /dev/null +++ b/3.111.1/module-braintree-web_payment-request.html @@ -0,0 +1,881 @@ + + + + + + + + + braintree-web/payment-request - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/payment-request +

+ + + + +
+
+ + + +
+ +
+
+ + +
+

A component to integrate with the Payment Request API.

+

Note: This component is currently in beta and the API may include breaking changes when upgrading. Please review the Changelog for upgrade steps whenever you upgrade the version of braintree-web.

+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

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

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+ + +

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
enabledPaymentMethods + + + + object + + + + + + + + + <optional>
+ + + + + +
+ + +

An object representing which payment methods to display.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
basicCard + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + true + + +

Whether or not to display credit card as an option in the Payment Request dialog. If left blank or set to true, credit cards will be displayed in the dialog if the merchant account is set up to process credit cards.

+ +
googlePay + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + true + + +

Whether or not to display Google Pay as an option in the Payment Request dialog. If left blank or set to true, Google Pay will be displayed in the dialog if the merchant account is set up to process Google Pay.

+ +
+ + +
googlePayVersion + + + + Number + + + + + + + + + <optional>
+ + + + + +
+ + 1 + + +

Ignored if options.enabledPaymentMethods.googlePay = false. If true, this option specifies the version of Google Pay to use. Choose either 1 (default) or 2.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the PaymentRequestComponent instance. If no callback is provided, create returns a promise that resolves with the PaymentRequestComponent instance.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
if (window.PaymentRequest) {
+  braintree.paymentRequest.create({
+    client: clientInstance
+  }, cb);
+} else {
+  // fall back to Hosted Fields if browser does not support Payment Request API
+  braintree.hostedFields.create(hostedFieldsOptions, cb);
+}
+ +

+ Explicitly turning off credit cards from Payment Request API dialog +

+ + +
braintree.paymentRequest.create({
+  client: clientInstance,
+  enabledPaymentMethods: {
+    googlePay: true,
+    basicCard: false
+  }
+}, cb);
+ +

+ Using Google Pay v2 or basic card +

+ + +
braintree.paymentRequest.create({
+  client: clientInstance,
+  enabledPaymentMethods: {
+    basicCard: true,
+    googlePay: true
+  },
+  googlePayVersion: 2
+}, cb);
+ + +
+ + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_paypal-checkout.html b/3.111.1/module-braintree-web_paypal-checkout.html new file mode 100644 index 00000000..f23732d7 --- /dev/null +++ b/3.111.1/module-braintree-web_paypal-checkout.html @@ -0,0 +1,843 @@ + + + + + + + + + braintree-web/paypal-checkout - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/paypal-checkout +

+ + + + +
+
+ + + +
+ +
+
+ + +
+

A component to integrate with the PayPal JS SDK.

+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

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

+
+ + + + + +
+

There are two ways to integrate the PayPal Checkout component. See the PayPal Checkout constructor documentation for more information and examples.

+
+ + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+ + +

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
merchantAccountId + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

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

+ +
autoSetDataUserIdToken + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + false + + +

Whether or not to render the PayPal SDK button with a customer's vaulted PayPal account. Must be used in conjunction with a Client Token generated with a customer id.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the PayPalCheckout instance.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
braintree.client.create({
+  authorization: 'authorization'
+}).then(function (clientInstance) {
+  return braintree.paypalCheckout.create({
+    client: clientInstance
+  });
+}).then(function (paypalCheckoutInstance) {
+  // set up the PayPal JS SDK
+}).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:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_paypal.html b/3.111.1/module-braintree-web_paypal.html new file mode 100644 index 00000000..5075a793 --- /dev/null +++ b/3.111.1/module-braintree-web_paypal.html @@ -0,0 +1,774 @@ + + + + + + + + + braintree-web/paypal - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/paypal +

+ + + + +
+
+ + + +
+ +
+
+ + +
+

A component to integrate with PayPal.

+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
+ +
+ +
+ +
+ + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

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

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
+ + +
callback + + + + callback + + + + + + + +

The second argument, data, is the PayPal instance.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
// We recommend creating your PayPal button with button.js
+// For an example, see https://codepen.io/braintree/pen/LNKJWa
+var paypalButton = document.querySelector('.paypal-button');
+
+braintree.client.create({
+  authorization: CLIENT_AUTHORIZATION
+}, function (clientErr, clientInstance) {
+  if (clientErr) {
+    console.error('Error creating client:', clientErr);
+    return;
+  }
+
+  braintree.paypal.create({
+    client: clientInstance
+  }, function (paypalErr, paypalInstance) {
+    if (paypalErr) {
+      console.error('Error creating PayPal:', paypalErr);
+      return;
+    }
+
+    paypalButton.removeAttribute('disabled');
+
+    // When the button is clicked, attempt to tokenize.
+    paypalButton.addEventListener('click', function (event) {
+      // Because tokenization opens a popup, this has to be called as a result of
+      // customer action, like clicking a button. You cannot call this at any time.
+      paypalInstance.tokenize({
+        flow: 'vault'
+        // For more tokenization options, see the full PayPal tokenization documentation
+        // https://braintree.github.io/braintree-web/current/PayPal.html#tokenize
+      }, function (tokenizeErr, payload) {
+        if (tokenizeErr) {
+          if (tokenizeErr.type !== 'CUSTOMER') {
+            console.error('Error tokenizing:', tokenizeErr);
+          }
+          return;
+        }
+
+        // Tokenization succeeded
+        paypalButton.setAttribute('disabled', true);
+        console.log('Got a nonce! You should submit this to your server.');
+        console.log(payload.nonce);
+      });
+    }, false);
+  });
+});
+ + +
+ + + + + + + + + + + + + + +

+ (static) isSupported() → {Boolean} +

+
+ + + + + +
+

Returns true if PayPal supports this browser.

+
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Example
+ + +
if (braintree.paypal.isSupported()) {
+  // Add PayPal button to the page
+} else {
+  // Hide PayPal payment option
+}
+ + +
+ + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_sepa.html b/3.111.1/module-braintree-web_sepa.html new file mode 100644 index 00000000..068a8391 --- /dev/null +++ b/3.111.1/module-braintree-web_sepa.html @@ -0,0 +1,648 @@ + + + + + + + + + braintree-web/sepa - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/sepa +

+ + + + +
+
+ + +
+ +
+
+ + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ (static) create(options, callbackopt) → {Promise.<(void|error)>} +

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
debug + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+

A debug flag.

+ +
redirectUrl + + + + string + + + + + + + + + <optional>
+ + + + + +
+

When provided, triggers full page redirect flow instead of popup flow.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

When provided, will be used instead of a promise. First argument is an error object, where the second is an instance of SEPA.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
braintree.sepa.create({
+  client: clientInstance
+}).then(function (sepaInstance) {
+  // sepaInstance is ready to be used.
+}).catch(function (createErr) {
+  console.error('Error creating SEPA instance', createErr);
+});
+ +

+ Creating a SEPA component +

+ + +
braintree.sepa.create({
+  client: clientInstance,
+}).then(function (sepaInstance) {
+  // sepaInstance is ready to be used.
+}).catch(function (createErr) {
+  console.error('Error creating SEPA instance', createErr);
+});
+ + +
+ + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_three-d-secure.html b/3.111.1/module-braintree-web_three-d-secure.html new file mode 100644 index 00000000..a34b5129 --- /dev/null +++ b/3.111.1/module-braintree-web_three-d-secure.html @@ -0,0 +1,936 @@ + + + + + + + + + braintree-web/three-d-secure - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/three-d-secure +

+ + + + +
+
+ + +
+ +
+
+ + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

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

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
cardinalSDKConfig + + + + object + + + + + + + + + <optional>
+ + + + + +
+ + +

A config for the underlying Cardinal SDK.

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
logging + + + + object + + + + + + + + + <optional>
+ + + + + +
+

The logging configuration for the Cardinal SDK. See Cardinal's documentation for the logging object for more information.

+ +
timeout + + + + number + + + + + + + + + <optional>
+ + + + + +
+

The time in milliseconds to wait before a request to Cardinal's API times out. See Cardinal's documentation for root level configuration for more information.

+ +
maxRequestRetries + + + + number + + + + + + + + + <optional>
+ + + + + +
+

How many times a request should be re-attempted to Cardinal's API before giving up as a failure. See Cardinal's documentation for root level configuration for more information.

+ +
payment + + + + object + + + + + + + + + <optional>
+ + + + + +
+

An object to describe how you want the user interactions to behave. Only a subset of the Cardinal SDK payment configuration object are supported: displayLoading and displayExitButton.

+ +
+ + +
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+ + +

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
version + + + + number + + + | + + + string + + + + + + + + + <optional>
+ + + + + +
+ + 1 + + +

The version of 3D Secure to use. Possible options:

+
    +
  • 1 - The legacy 3D Secure v1.0 integration.
  • +
  • 2 - A 3D Secure v2.0 integration that uses a modal to host the 3D Secure iframe.
  • +
  • 2-bootstrap3-modal - A 3D Secure v2.0 integration that uses a modal styled with Bootstrap 3 styles to host the 3D Secure iframe. Requires having the Bootstrap 3 script files and stylesheets on your page.
  • +
  • 2-inline-iframe - A 3D Secure v2.0 integration that provides the authentication iframe directly to the merchant.
  • +
+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the ThreeDSecure instance. If no callback is provided, it returns a promise that resolves the ThreeDSecure instance.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ +

+ Creating a v2 3D Secure component using 2 version (Cardinal modal) +

+ + +
braintree.threeDSecure.create({
+  client: clientInstance,
+  version: '2'
+}, function (createError, threeDSecure) {
+  // set up lookup-complete listener
+  threeDSecure.on('lookup-complete', function (data, next) {
+    // check lookup data
+
+    next();
+  });
+
+  // using Hosted Fields, use `tokenize` to get back a credit card nonce
+
+  threeDSecure.verifyCard({
+    nonce: nonceFromTokenizationPayload,,
+    bin: binFromTokenizationPayload,
+    amount: '100.00'
+  }, function (verifyError, payload) {
+    // inspect payload
+    // send payload.nonce to your server
+  });
+});
+ +

+ Creating a v2 3D Secure component using 2-bootstrap3-modal version +

+ + +
// must have the boostrap js, css and jquery files on your page
+braintree.threeDSecure.create({
+  client: clientInstance,
+  version: '2-bootstrap3-modal'
+}, function (createError, threeDSecure) {
+  // set up lookup-complete listener
+  threeDSecure.on('lookup-complete', function (data, next) {
+    // check lookup data
+
+    next();
+  });
+
+  // using Hosted Fields, use `tokenize` to get back a credit card nonce
+
+  // challenge will be presented in a bootstrap 3 modal
+  threeDSecure.verifyCard({
+    nonce: nonceFromTokenizationPayload,
+    bin: binFromTokenizationPayload,
+    amount: '100.00'
+  }, function (verifyError, payload) {
+    // inspect payload
+    // send payload.nonce to your server
+  });
+});
+ +

+ Creating a v2 3D Secure component using 2-inline-iframe version +

+ + +
braintree.threeDSecure.create({
+  client: clientInstance,
+  version: '2-inline-iframe'
+}, function (createError, threeDSecure) {
+  // set up lookup-complete listener
+  threeDSecure.on('lookup-complete', function (data, next) {
+    // check lookup data
+
+    next();
+  });
+  // set up iframe listener
+  threeDSecure.on('authentication-iframe-available', function (event, next) {
+    var element = event.element; // an html element that contains the iframe
+
+    document.body.appendChild(element); // put it on your page
+
+    next(); // let the sdk know the element has been added to the page
+  });
+
+  // using Hosted Fields, use `tokenize` to get back a credit card nonce
+
+  threeDSecure.verifyCard({
+    nonce: nonceFromTokenizationPayload,,
+    bin: binFromTokenizationPayload,
+    amount: '100.00'
+  }, function (verifyError, payload) {
+    // inspect payload
+    // send payload.nonce to your server
+  });
+});
+ + +
+ + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_us-bank-account.html b/3.111.1/module-braintree-web_us-bank-account.html new file mode 100644 index 00000000..88b0e910 --- /dev/null +++ b/3.111.1/module-braintree-web_us-bank-account.html @@ -0,0 +1,614 @@ + + + + + + + + + braintree-web/us-bank-account - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/us-bank-account +

+ + + + +
+
+ + + +
+ +
+
+ + +
+

This module is for accepting payments of US bank accounts.

+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

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

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the USBankAccount instance. If no callback is provided, create returns a promise that resolves with the USBankAccount instance.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_vault-manager.html b/3.111.1/module-braintree-web_vault-manager.html new file mode 100644 index 00000000..93e1e884 --- /dev/null +++ b/3.111.1/module-braintree-web_vault-manager.html @@ -0,0 +1,594 @@ + + + + + + + + + braintree-web/vault-manager - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/vault-manager +

+ + + + +
+
+ + + +
+ +
+
+ + +
+

Manages customer's payment methods.

+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

+ (static) create(options, callback) → {void} +

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + + + object + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
+ + +
callback + + + + callback + + + + + + + +

The second argument, data, is the VaultManager instance.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_venmo.html b/3.111.1/module-braintree-web_venmo.html new file mode 100644 index 00000000..9d248f83 --- /dev/null +++ b/3.111.1/module-braintree-web_venmo.html @@ -0,0 +1,1864 @@ + + + + + + + + + braintree-web/venmo - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/venmo +

+ + + + +
+
+ + +
+ +
+
+ + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

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

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+ + +

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
allowNewBrowserTab + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + true + + +

This should be set to false if your payment flow requires returning to the same tab, e.g. single page applications. Doing so causes isBrowserSupported to return true only for mobile web browsers that support returning from the Venmo app to the same tab.

+ +
allowWebviews + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + true + + +

This should be set to false if your payment flow does not occur from within a webview that you control. Doing so causes isBrowserSupported to return true only for mobile web browsers that are not webviews.

+ +
ignoreHistoryChanges + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + false + + +

When the Venmo app returns to the website, it will modify the hash of the url to include data about the tokenization. By default, the SDK will put the state of the hash back to where it was before the change was made. Pass true to handle the hash change instead of the SDK.

+ +
profileId + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

The Venmo profile ID to be used during payment authorization. Customers will see the business name and logo associated with this Venmo profile, and it will show up in the Venmo app as a "Connected Merchant". Venmo profile IDs can be found in the Braintree Control Panel. Omitting this value will use the default Venmo profile.

+ +
deepLinkReturnUrl + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

An override for the URL that the Venmo iOS app opens to return from an app switch.

+ +
requireManualReturn + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + false + + +

When true, the customer will have to manually switch back to the browser/webview that is presenting Venmo to complete the payment.

+ +
useRedirectForIOS + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + false + + +

Normally, the Venmo flow is launched using window.open and the Venmo app intercepts that call and opens the Venmo app instead. If the customer does not have the Venmo app installed, it opens the Venmo website in a new window and instructs the customer to install the app. +In iOS webviews and Safari View Controllers (a webview-like environment which is indistinguishable from Safari for JavaScript environments), this call to window.open will always fail to app switch to Venmo, resulting instead in a white screen. Because of this, an alternate approach is required to launch the Venmo flow.

+

When useRedirectForIOS is true and the Venmo flow is started in an iOS environment, the Venmo flow will be started by setting window.location.href to the Venmo website (which will still be intercepted by the Venmo app and should be the same behavior as if window.open was called). However, if the customer does not have the Venmo app installed, the merchant page will instead be replaced with the Venmo website and the customer will need to use the browser's back button to return to the merchant's website. Ensure that your customer's checkout information will not be lost if they are navigated away from the website and return using the browser back button.

+

Due to a bug in iOS's implementation of window.open in iOS webviews and Safari View Controllers, if useRedirectForIOS is not set to true and the flow is launched from an iOS webview or Safari View Controller, the customer will be presented with a blank screen, halting the flow and leaving the customer unable to return to the merchant's website. Setting useRedirectForIOS to true will allow the flow to continue, but the Venmo app will be unable to return back to the webview/Safari View Controller. It will instead open the merchant's site in a new window in the customer's browser, which means the merchant site must be able to process the Venmo payment. If the SDK is configured with allowNewBrowserTab = false, it is unlikely that the website is set up to process the Venmo payment from a new window.

+

If processing the payment from a new window is not possible, use this flag in conjunction with requireManualReturn so that the customer may start the flow from a webview/Safari View Controller or their Safari browser and manually return to the place that originated the flow once the Venmo app has authorized the payment and instructed them to do so.

+ +
paymentMethodUsage + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

The intended usage for the Venmo payment method nonce. Possible options are:

+
    +
  • single_use - intended as a one time transaction
  • +
  • multi_use - intended to be vaulted and used for multiple transactions
  • +
+ +
displayName + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

The business name that will be displayed in the Venmo app payment approval screen. Only applicable when used with paymentMethodUsage and used by merchants onboarded as PayFast channel partners.

+ +
allowDesktop + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + +

Used to support desktop users. When enabled, the default mode is to render a scannable QR-code customers scan with their phone's to approve via the mobile app.

+ +
allowDesktopWebLogin + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + false + + +

When true, the customer will authorize payment via a window popup that allows them to sign in to their Venmo account. This is used explicitly for customers operating from desktop browsers wanting to avoid the QR Code flow.

+ +
mobileWebFallBack + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + +

Use this option when you want to use a web-login experience, such as if on mobile and the Venmo app isn't installed.

+ +
allowAndroidRecreation + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + true + + +

This flag is for when your integration uses the Android PopupBridge. Setting this flag to false will avoid a page refresh when returning to your page after payment authorization. If not specified, it defaults to true and the Android activity will be recreated, resulting in a page refresh.

+ +
collectCustomerBillingAddress + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + +

When true, the customer's billing address will be collected and displayed on the Venmo paysheet (provided the Enriched Customer Data checkbox is also enabled for the merchant account).

+ +
collectCustomerShippingAddress + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + +

When true, the customer's shipping address will be collected and displayed on the Venmo paysheet (provided the Enriched Customer Data checkbox is also enabled for the merchant account).

+ +
isFinalAmount + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + false + + +

When true, it denotes that the purchase amount (totalAmount) is final and will not change.

+ +
lineItems + + + + Array.<lineItem> + + + + + + + + + <optional>
+ + + + + +
+ + +

The line items belonging to the transaction. It can include up to 249 line items.

+ +
subTotalAmount + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

The subtotal amount of the transaction, excluding taxes, discounts, and shipping.

+ +
discountAmount + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

The total discount amount applied on the transaction.

+ +
shippingAmount + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

Shipping amount to be charged for the transaction.

+ +
taxAmount + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

The total tax amount applied to the transaction. This value can't be negative or zero.

+ +
totalAmount + + + + string + + + + + + + + + <optional>
+ + + + + +
+ + +

The grand total amount of the transaction.

+

Note: This flow currently requires a full page redirect, which means to utilize this flow your page will need to be able to handle the checkout session across different pages.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the Venmo instance. If no callback is provided, create returns a promise that resolves with the Venmo instance.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
braintree.venmo.create({
+  client: clientInstance
+}).then(function (venmoInstance) {
+  // venmoInstance is ready to be used.
+}).catch(function (createErr) {
+  console.error('Error creating Venmo instance', createErr);
+});
+ +

+ Allow desktop flow to be used +

+ + +
braintree.venmo.create({
+  client: clientInstance,
+  allowDesktop: true
+}).then(function (venmoInstance) {
+  // venmoInstance is ready to be used.
+}).catch(function (createErr) {
+  console.error('Error creating Venmo instance', createErr);
+});
+ + +
+ + + + + + + + + + + + + + +

+ (static) isBrowserSupported(optionsopt) → {boolean} +

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + <optional>
+ + + + + +
+

browser support options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDefaultDescription
allowNewBrowserTab + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + true + + +

This should be set to false if your payment flow requires returning to the same tab, e.g. single page applications.

+ +
allowWebviews + + + + boolean + + + + + + + + + <optional>
+ + + + + +
+ + true + + +

This should be set to false if your payment flow does not occur from within a webview that you control.

+ +
+ + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + +
Examples
+ + +
if (braintree.venmo.isBrowserSupported()) {
+  // set up Venmo
+}
+ +

+ Explicitly require browser support returning to the same tab +

+ + +
if (braintree.venmo.isBrowserSupported({
+  allowNewBrowserTab: false
+})) {
+  // set up Venmo
+}
+ +

+ Explicitly set webviews as disallowed browsers +

+ + +
if (braintree.venmo.isBrowserSupported({
+  allowWebviews: false
+})) {
+  // set up Venmo
+}
+ + +
+ + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/module-braintree-web_visa-checkout.html b/3.111.1/module-braintree-web_visa-checkout.html new file mode 100644 index 00000000..8fd2dd1c --- /dev/null +++ b/3.111.1/module-braintree-web_visa-checkout.html @@ -0,0 +1,614 @@ + + + + + + + + + braintree-web/visa-checkout - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ braintree-web/visa-checkout +

+ + + + +
+
+ + + +
+ +
+
+ + +
+

Processes Visa Checkout. This component is currently in beta and is subject to change.

+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + + +

+ (static) VERSION :string +

+ + + + +
+

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

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + +

Methods

+ + + + + + + + + + + + + +

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

+
+ + + + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + + + object + + + + + + + + + + + + + +

Creation options:

+ +
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
client + + + + Client + + + + + + + + + <optional>
+ + + + + +
+

A Client instance.

+ +
authorization + + + + string + + + + + + + + + <optional>
+ + + + + +
+

A tokenizationKey or clientToken. Can be used in place of options.client.

+ +
+ + +
callback + + + + callback + + + + + + + + + <optional>
+ + + + + +
+

The second argument, data, is the VisaCheckout instance. If no callback is provided, create returns a promise that resolves with the VisaCheckout instance.

+ +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+ + + + +
+ +
+ + + + + + + + + + + + \ No newline at end of file diff --git a/3.111.1/payment-request_external_payment-request.js.html b/3.111.1/payment-request_external_payment-request.js.html new file mode 100644 index 00000000..1d315897 --- /dev/null +++ b/3.111.1/payment-request_external_payment-request.js.html @@ -0,0 +1,895 @@ + + + + + + + + + + + payment-request/external/payment-request.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ payment-request/external/payment-request.js +

+ + + + + +
+
+
"use strict";
+
+var analytics = require("../../lib/analytics");
+var assign = require("../../lib/assign").assign;
+var Bus = require("framebus");
+var convertMethodsToError = require("../../lib/convert-methods-to-error");
+var generateGooglePayConfiguration = require("../../lib/generate-google-pay-configuration");
+var iFramer = require("@braintree/iframer");
+var uuid = require("@braintree/uuid");
+var useMin = require("../../lib/use-min");
+var methods = require("../../lib/methods");
+var EventEmitter = require("@braintree/event-emitter");
+var BraintreeError = require("../../lib/braintree-error");
+var VERSION = process.env.npm_package_version;
+var constants = require("../shared/constants");
+var events = constants.events;
+var errors = constants.errors;
+var wrapPromise = require("@braintree/wrap-promise");
+
+/**
+ * @typedef {object} PaymentRequestComponent~tokenizePayload
+ * @property {string} nonce The payment method nonce.
+ * @property {object} details Additional account details.
+ * @property {string} details.bin The BIN number of the card..
+ * @property {string} details.cardType Type of card, ex: Visa, MasterCard.
+ * @property {string} details.lastFour Last four digits of card number.
+ * @property {string} details.lastTwo Last two digits of card number.
+ * @property {object} details.rawPaymentResponse The raw payment response from the payment request, with sensitive card details removed.
+ * @property {string} description A human-readable description.
+ * @property {string} type The payment method type, `CreditCard` or `AndroidPayCard`.
+ * @property {object} binData Information about the card based on the bin.
+ * @property {string} binData.commercial Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.countryOfIssuance The country of issuance.
+ * @property {string} binData.debit Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.durbinRegulated Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.healthcare Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.issuingBank The issuing bank.
+ * @property {string} binData.payroll Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.prepaid Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.productId The product id.
+ */
+
+/**
+ * @typedef {object} PaymentRequestComponent~paymentRequestConfiguration
+ * @property {object} configuration.details The payment details. For details on this object, see [Google's PaymentRequest API documentation](https://developers.google.com/web/fundamentals/discovery-and-monetization/payment-request/deep-dive-into-payment-request#defining_payment_details).
+ * @property {array} [configuration.supportedPaymentMethods] The supported payment methods. If not passed in, the supported payment methods from the merchant account that generated the authorization for the client will be used. For details on this array, see [Google's PaymentRequest API documentation](https://developers.google.com/web/fundamentals/discovery-and-monetization/payment-request/deep-dive-into-payment-request#defining_supported_payment_methods).
+ * @property {object} [configuration.options] Additional payment request options. For details on this object, see [Google's PaymentRequest API documentation](https://developers.google.com/web/fundamentals/discovery-and-monetization/payment-request/deep-dive-into-payment-request#defining_options_optional).
+ */
+
+/**
+ * @typedef {object} PaymentRequestComponent~shippingEventObject
+ * @description The event payload sent from {@link PaymentRequestComponent#on|on}.
+ * @property {object} target An object which contains data about the event.
+ * @property {function} updateWith A method to call with the updated Payment Request details.
+ */
+
+/**
+ * @name PaymentRequestComponent#on
+ * @function
+ * @param {string} event The name of the event to which you are subscribing.
+ * @param {function} handler A callback to handle the event.
+ * @description Subscribes a handler function to a named event. `event` should be {@link PaymentRequestComponent#event:shippingAddressChange|shippingAddressChange} or {@link PaymentRequestComponent#event:shippingOptionChange|shippingOptionChange}. For convenience, you can also listen on `shippingaddresschange` or `shippingoptionchange` to match the event listeners in the [Payment Request API documentation](https://developers.google.com/web/fundamentals/payments/deep-dive-into-payment-request#shipping_in_payment_request_api). Events will emit a {@link PaymentRequestComponent~shippingEventObject|shippingEventObject}.
+ * @example
+ * <caption>Listening to a Payment Request event, in this case 'shippingAddressChange'</caption>
+ * braintree.paymentRequest.create({ ... }, function (createErr, paymentRequestInstance) {
+ *   paymentRequestInstance.on('shippingAddressChange', function (event) {
+ *     console.log(event.target.shippingAddress);
+ *   });
+ * });
+ * @returns {void}
+ */
+
+/**
+ * @name PaymentRequestComponent#off
+ * @function
+ * @param {string} event The name of the event to which you are unsubscribing.
+ * @param {function} handler The callback for the event you are unsubscribing from.
+ * @description Unsubscribes the handler function to a named event.
+ * @example
+ * <caption>Subscribing and then unsubscribing from a Payment Request event, in this case 'shippingAddressChange'</caption>
+ * braintree.paymentRequest.create({ ... }, function (createErr, paymentRequestInstance) {
+ *   var callback = function (event) {
+ *     console.log(event.target.shippingAddress);
+ *   };
+ *   paymentRequestInstance.on('shippingAddressChange', callback);
+ *
+ *   // later on
+ *   paymentRequestInstance.off('shippingAddressChange', callback);
+ * });
+ * @returns {void}
+ */
+
+/**
+ * This event is emitted when the customer selects a shipping address.
+ * @event PaymentRequestComponent#shippingAddressChange
+ * @type {PaymentRequestComponent~shippingEventObject}
+ * @example
+ * <caption>Listening to a shipping address change event</caption>
+ * braintree.paymentRequest.create({ ... }, function (createErr, paymentRequestInstance) {
+ *   paymentRequestInstance.on('shippingAddressChange', function (event) {
+ *     // validate event.target.shippingAddress if needed
+ *
+ *     event.updateWith(paymentRequestDetails);
+ *   });
+ * });
+ */
+
+/**
+ * This event is emitted when the customer selects a shipping option.
+ * @event PaymentRequestComponent#shippingOptionChange
+ * @type {PaymentRequestComponent~shippingEventObject}
+ * @example
+ * <caption>Listening to a shipping option change event</caption>
+ * braintree.paymentRequest.create({ ... }, function (createErr, paymentRequestInstance) {
+ *   paymentRequestInstance.on('shippingOptionChange', function (event) {
+ *     // validate event.target.shippingOption if needed
+ *
+ *     paymentRequestDetails.shippingOptions.forEach(function (option) {
+ *       option.selected = option.id === event.target.shippingOption;
+ *     });
+ *
+ *     event.updateWith(paymentRequestDetails);
+ *   });
+ * });
+ */
+
+var CARD_TYPE_MAPPINGS = {
+  Visa: "visa",
+  MasterCard: "mastercard",
+  "American Express": "amex",
+  "Diners Club": "diners",
+  Discover: "discover",
+  JCB: "jcb",
+  UnionPay: "unionpay",
+  Maestro: "maestro",
+};
+
+var BRAINTREE_GOOGLE_PAY_MERCHANT_ID = "18278000977346790994";
+
+function composeUrl(assetsUrl, componentId, isDebug) {
+  var baseUrl = assetsUrl;
+
+  // removeIf(production)
+  if (process.env.BRAINTREE_JS_ENV === "development") {
+    // Pay with Google cannot tokenize in our dev environment
+    // so in development, we have to use a sandbox merchant
+    // but set the iFrame url to the development url
+    baseUrl = "https://" + process.env.BT_DEV_HOST + ":9000";
+  }
+  // endRemoveIf(production)
+
+  return (
+    baseUrl +
+    "/web/" +
+    VERSION +
+    "/html/payment-request-frame" +
+    useMin(isDebug) +
+    ".html#" +
+    componentId
+  );
+}
+
+/**
+ * @class PaymentRequestComponent
+ * @param {object} options The Payment Request Component {@link module:braintree-web/payment-request.create create} options.
+ * @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/payment-request.create|braintree-web.payment-request.create} instead.</strong>
+ *
+ * @classdesc This class represents a Payment Request component produced by {@link module:braintree-web/payment-request.create|braintree-web/payment-request.create}. Instances of this class have methods for initializing a Payment Request.
+ *
+ * **Note:** This component is currently in beta and the API may include breaking changes when upgrading. Please review the [Changelog](https://github.com/braintree/braintree-web/blob/main/CHANGELOG.md) for upgrade steps whenever you upgrade the version of braintree-web.
+ */
+function PaymentRequestComponent(options) {
+  var enabledPaymentMethods = options.enabledPaymentMethods || {};
+
+  EventEmitter.call(this);
+
+  this._componentId = uuid();
+  this._client = options.client;
+  this._enabledPaymentMethods = {
+    basicCard: enabledPaymentMethods.basicCard !== false,
+    googlePay: enabledPaymentMethods.googlePay !== false,
+  };
+  this._googlePayVersion = options.googlePayVersion === 2 ? 2 : 1;
+  this._googleMerchantId = BRAINTREE_GOOGLE_PAY_MERCHANT_ID;
+  this._supportedPaymentMethods =
+    this._constructDefaultSupportedPaymentMethods();
+  this._defaultSupportedPaymentMethods = Object.keys(
+    this._supportedPaymentMethods
+  ).map(
+    function (key) {
+      return this._supportedPaymentMethods[key];
+    }.bind(this)
+  );
+  this._bus = new Bus({ channel: this._componentId });
+}
+
+EventEmitter.createChild(PaymentRequestComponent);
+
+PaymentRequestComponent.prototype._constructDefaultSupportedPaymentMethods =
+  function () {
+    var configuration = this._client.getConfiguration();
+    var androidPayConfiguration = configuration.gatewayConfiguration.androidPay;
+    var cardConfiguration = configuration.gatewayConfiguration.creditCards;
+    var supportedPaymentMethods = {};
+
+    if (
+      this._enabledPaymentMethods.basicCard &&
+      cardConfiguration &&
+      cardConfiguration.supportedCardTypes.length > 0
+    ) {
+      supportedPaymentMethods.basicCard = {
+        supportedMethods: "basic-card",
+        data: {
+          supportedNetworks: cardConfiguration.supportedCardTypes.reduce(
+            function (types, cardType) {
+              if (cardType in CARD_TYPE_MAPPINGS) {
+                types.push(CARD_TYPE_MAPPINGS[cardType]);
+              }
+
+              return types;
+            },
+            []
+          ),
+        },
+      };
+    }
+
+    if (
+      this._enabledPaymentMethods.googlePay &&
+      androidPayConfiguration &&
+      androidPayConfiguration.enabled
+    ) {
+      supportedPaymentMethods.googlePay = {
+        supportedMethods: "https://google.com/pay",
+        data: generateGooglePayConfiguration(
+          configuration,
+          this._googlePayVersion,
+          this._googleMerchantId
+        ),
+      };
+    }
+
+    return supportedPaymentMethods;
+  };
+
+PaymentRequestComponent.prototype.initialize = function () {
+  var clientConfiguration = this._client.getConfiguration();
+  var self = this;
+
+  this._frame = iFramer({
+    allowPaymentRequest: true,
+    name: "braintree-payment-request-frame",
+    class: "braintree-payment-request-frame",
+    height: 0,
+    width: 0,
+    style: {
+      position: "absolute",
+      left: "-9999px",
+    },
+    title: "Secure Payment Frame",
+  });
+
+  if (this._defaultSupportedPaymentMethods.length === 0) {
+    return Promise.reject(
+      new BraintreeError(
+        errors.PAYMENT_REQUEST_NO_VALID_SUPPORTED_PAYMENT_METHODS
+      )
+    );
+  }
+
+  return new Promise(function (resolve) {
+    self._bus.on(events.FRAME_READY, function (reply) {
+      reply(self._client);
+    });
+    self._bus.on(events.FRAME_CAN_MAKE_REQUESTS, function () {
+      analytics.sendEvent(self._client, "payment-request.initialized");
+      self._bus.on(events.SHIPPING_ADDRESS_CHANGE, function (shippingAddress) {
+        var shippingAddressChangeEvent = {
+          target: {
+            shippingAddress: shippingAddress,
+          },
+          updateWith: function (paymentDetails) {
+            self._bus.emit(events.UPDATE_SHIPPING_ADDRESS, paymentDetails);
+          },
+        };
+
+        self._emit("shippingAddressChange", shippingAddressChangeEvent);
+        self._emit("shippingaddresschange", shippingAddressChangeEvent);
+      });
+      self._bus.on(events.SHIPPING_OPTION_CHANGE, function (shippingOption) {
+        var shippingOptionChangeEvent = {
+          target: {
+            shippingOption: shippingOption,
+          },
+          updateWith: function (paymentDetails) {
+            self._bus.emit(events.UPDATE_SHIPPING_OPTION, paymentDetails);
+          },
+        };
+
+        self._emit("shippingOptionChange", shippingOptionChangeEvent);
+        self._emit("shippingoptionchange", shippingOptionChangeEvent);
+      });
+      resolve(self);
+    });
+
+    // TODO - We may need to apply the same setTimeout hack that Hosted Fields
+    // uses for iframes to load correctly in Edge. See:
+    // https://github.com/braintree/braintree-web/blob/0c951e5f9859c606652485de14188b6bd6656677/src/hosted-fields/external/hosted-fields.js#L449-L469
+    self._frame.src = composeUrl(
+      clientConfiguration.gatewayConfiguration.assetsUrl,
+      self._componentId,
+      clientConfiguration.isDebug
+    );
+    document.body.appendChild(self._frame);
+  });
+};
+
+/**
+ * Create an object to pass into tokenize to specify a custom configuration. If no overrides are provided, the default configuration will be provided.
+ * @public
+ * @param {string} type The supported payment method type. Possible values are `basicCard` and `googlePay`.
+ * If no type is provided, the function will throw an error. If the type provided is not an enabled payment method for the merchant account , the function will throw an error.
+ * @param {object} [overrides] The configuration overrides for the [data property on the supported payment methods objects](https://developers.google.com/web/fundamentals/payments/deep-dive-into-payment-request). If not passed in, the default configuration for the specified type will be provided. If a property is not provided, the value from the default configuration will be used.
+ * @example <caption>Getting the default configuration for a specified type</caption>
+ * var configuration = paymentRequestInstance.createSupportedPaymentMethodsConfiguration('basicCard');
+ *
+ * configuration.supportedMethods; // 'basic-card'
+ * configuration.data.supportedNetworks; // ['visa', 'mastercard', 'amex'] <- whatever the supported card networks for the merchant account are
+ * @example <caption>Specifying overrides</caption>
+ * var configuration = paymentRequestInstance.createSupportedPaymentMethodsConfiguration('basicCard', {
+ *   supportedNetworks: ['visa'],
+ *   supportedTypes: ['credit', 'debit']
+ * });
+ *
+ * configuration.supportedMethods; // 'basic-card'
+ * configuration.data.supportedNetworks; // ['visa']
+ * configuration.data.supportedTypes; // ['credit', 'debit']
+ * @returns {object} Returns a configuration object for use in the tokenize function.
+ */
+PaymentRequestComponent.prototype.createSupportedPaymentMethodsConfiguration =
+  function (type, overrides) {
+    var configuration;
+
+    if (!type) {
+      throw new BraintreeError(
+        errors.PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_MUST_INCLUDE_TYPE
+      );
+    }
+
+    if (!this._enabledPaymentMethods[type]) {
+      throw new BraintreeError(
+        errors.PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_TYPE_NOT_ENABLED
+      );
+    }
+
+    configuration = assign({}, this._supportedPaymentMethods[type]);
+    configuration.data = assign({}, configuration.data, overrides);
+
+    return configuration;
+  };
+
+/**
+ * Tokenizes a Payment Request
+ * @public
+ * @param {object} configuration A {@link PaymentRequestComponent~paymentRequestConfiguration|paymentRequestConfiguration}.
+ * @param {callback} [callback] The second argument, <code>data</code>, is a {@link PaymentRequest~paymentPayload|paymentPayload}. If no callback is provided, `tokenize` returns a function that resolves with a {@link PaymentRequestComponent~tokenizePayload|tokenizePayload}.
+ * @example
+ * paymentRequestInstance.tokenize({
+ *   details: {
+ *     total: {
+ *       label: 'Price',
+ *       amount: {
+ *         currency: 'USD',
+ *         value: '100.00'
+ *       }
+ *     }
+ *   }
+ * }).then(function (payload) {
+ *   // send payload.nonce to server
+ *
+ *   // examine the raw response (with card details removed for security) from the payment request
+ *   console.log(payload.details.rawPaymentResponse);
+ * }).catch(function (err) {
+ *   if (err.code === 'PAYMENT_REQUEST_CANCELED') {
+ *     // payment request was canceled by user
+ *   } else {
+ *     // an error occurred while processing
+ *   }
+ * });
+ * @example <caption>Tokenize only Visa cards</caption>
+ * var basicCardConfiguration = paymentRequestInstance.createSupportedPaymentMethodsConfiguration('basicCard', {
+ *   supportedNetworks: ['visa']
+ * };
+ *
+ * paymentRequestInstance.tokenize({
+ *   supportedPaymentMethods: [basicCardConfiguration],
+ *   details: {
+ *     total: {
+ *       label: 'Price',
+ *       amount: {
+ *         currency: 'USD',
+ *         value: '100.00'
+ *       }
+ *     }
+ *   }
+ * }).then(function (payload) {
+ *   // send payload.nonce to your server
+ * });
+ * @example <caption>Include payment request options</caption>
+ * paymentRequestInstance.tokenize({
+ *   details: {
+ *     total: {
+ *       label: 'Price',
+ *       amount: {
+ *         currency: 'USD',
+ *         value: '100.00'
+ *       }
+ *     }
+ *   },
+ *   options: {
+ *     requestPayerName: true,
+ *     requestPayerPhone: true,
+ *     requestPayerEmail: true
+ *   }
+ * }).then(function (payload) {
+ *   // send payload.nonce to your server
+ *   // collect additional info from the raw response
+ *   console.log(payload.details.rawPaymentResponse);
+ * });
+ * @example <caption>Request Shipping Information</caption>
+ * var shippingOptions = [
+ *   {
+ *     id: 'economy',
+ *     label: 'Economy Shipping (5-7 Days)',
+ *     amount: {
+ *       currency: 'USD',
+ *       value: '0',
+ *     },
+ *   }, {
+ *     id: 'express',
+ *     label: 'Express Shipping (2-3 Days)',
+ *     amount: {
+ *       currency: 'USD',
+ *       value: '5',
+ *     },
+ *   }, {
+ *     id: 'next-day',
+ *     label: 'Next Day Delivery',
+ *     amount: {
+ *       currency: 'USD',
+ *       value: '12',
+ *     },
+ *   },
+ * ];
+ * var paymentDetails = {
+ * 	 total: {
+ *     label: 'Total',
+ *     amount: {
+ *       currency: 'USD',
+ *       value: '10.00',
+ *     }
+ *   },
+ *   shippingOptions: shippingOptions
+ * };
+ *
+ * paymentRequestInstance.on('shippingAddressChange', function (event) {
+ *   // validate shipping address on event.target.shippingAddress
+ *   // make changes to the paymentDetails or shippingOptions if necessary
+ *
+ *   event.updateWith(paymentDetails)
+ * });
+ *
+ * paymentRequestInstance.on('shippingOptionChange', function (event) {
+ *   shippingOptions.forEach(function (option) {
+ *     option.selected = option.id === event.target.shippingOption;
+ *   });
+ *
+ *   event.updateWith(paymentDetails)
+ * });
+ *
+ * paymentRequestInstance.tokenize({
+ *   details: paymentDetails,
+ *   options: {
+ *     requestShipping: true
+ *   }
+ * }).then(function (payload) {
+ *   // send payload.nonce to your server
+ *   // collect shipping information from payload
+ *   console.log(payload.details.rawPaymentResponse.shippingAddress);
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+PaymentRequestComponent.prototype.tokenize = function (configuration) {
+  var self = this;
+
+  // NEXT_MAJOR_VERSION fail early if a payment method is passed in
+  // that the component does not support
+  return new Promise(function (resolve, reject) {
+    self._bus.emit(
+      events.PAYMENT_REQUEST_INITIALIZED,
+      {
+        supportedPaymentMethods:
+          configuration.supportedPaymentMethods ||
+          self._defaultSupportedPaymentMethods,
+        details: configuration.details,
+        options: configuration.options,
+      },
+      function (response) {
+        var rawError = response[0];
+        var payload = response[1];
+
+        if (rawError) {
+          reject(self._formatTokenizationError(rawError));
+
+          return;
+        }
+
+        analytics.sendEvent(self._client, "payment-request.tokenize.succeeded");
+        resolve({
+          nonce: payload.nonce,
+          type: payload.type,
+          description: payload.description,
+          details: {
+            rawPaymentResponse: payload.details.rawPaymentResponse,
+            cardType: payload.details.cardType,
+            lastFour: payload.details.lastFour,
+            lastTwo: payload.details.lastTwo,
+          },
+          binData: payload.binData,
+        });
+      }
+    );
+  });
+};
+
+/**
+ * Check if the customer can make payments.
+ * @public
+ * @param {object} configuration A {@link PaymentRequestComponent~paymentRequestConfiguration|paymentRequestConfiguration}.
+ * @param {callback} [callback] Called on completion.
+ * @example
+ * var paymentDetails = {
+ * 	 total: {
+ *     label: 'Total',
+ *     amount: {
+ *       currency: 'USD',
+ *       value: '10.00',
+ *     }
+ *   }
+ * };
+ *
+ * paymentRequestInstance.canMakePayment({
+ *   details: paymentDetails
+ * }).then(function (result) {
+ *   if (result) {
+ *     // set up payment request button
+ *   }
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+PaymentRequestComponent.prototype.canMakePayment = function (configuration) {
+  var self = this;
+  var unsupportedPaymentMethod;
+
+  // NEXT_MAJOR_VERSION Move this check to component creation
+  if (!window.PaymentRequest) {
+    analytics.sendEvent(
+      self._client,
+      "payment-request.can-make-payment.not-available"
+    );
+
+    return Promise.resolve(false);
+  }
+
+  if (configuration.supportedPaymentMethods) {
+    configuration.supportedPaymentMethods.forEach(function (config) {
+      var supportedMethods = config.supportedMethods;
+
+      if (!(supportedMethods in constants.SUPPORTED_METHODS)) {
+        unsupportedPaymentMethod = supportedMethods;
+      }
+    });
+
+    if (unsupportedPaymentMethod) {
+      return Promise.reject(
+        new BraintreeError({
+          type: errors.PAYMENT_REQUEST_UNSUPPORTED_PAYMENT_METHOD.type,
+          code: errors.PAYMENT_REQUEST_UNSUPPORTED_PAYMENT_METHOD.code,
+          message:
+            unsupportedPaymentMethod + " is not a supported payment method.",
+        })
+      );
+    }
+  }
+
+  return new Promise(function (resolve, reject) {
+    self._bus.emit(
+      events.CAN_MAKE_PAYMENT,
+      {
+        supportedPaymentMethods:
+          configuration.supportedPaymentMethods ||
+          self._defaultSupportedPaymentMethods,
+        details: configuration.details,
+        options: configuration.options,
+      },
+      function (response) {
+        var error = response[0];
+        var payload = response[1];
+
+        if (error) {
+          reject(self._formatCanMakePaymentError(error));
+
+          return;
+        }
+
+        analytics.sendEvent(
+          self._client,
+          "payment-request.can-make-payment." + payload
+        );
+
+        resolve(payload);
+      }
+    );
+  });
+};
+
+/**
+ * Cleanly remove anything set up by {@link module:braintree-web/payment-request.create|create}.
+ * @public
+ * @param {callback} [callback] Called on completion.
+ * @example
+ * paymentRequestInstance.teardown();
+ * @example <caption>With callback</caption>
+ * paymentRequestInstance.teardown(function () {
+ *   // teardown is complete
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+PaymentRequestComponent.prototype.teardown = function () {
+  this._bus.teardown();
+  this._frame.parentNode.removeChild(this._frame);
+
+  convertMethodsToError(this, methods(PaymentRequestComponent.prototype));
+
+  analytics.sendEvent(this._client, "payment-request.teardown-completed");
+
+  return Promise.resolve();
+};
+
+PaymentRequestComponent.prototype._formatTokenizationError = function (error) {
+  var formattedError;
+
+  switch (error.name) {
+    case "AbortError":
+      formattedError = new BraintreeError({
+        type: errors.PAYMENT_REQUEST_CANCELED.type,
+        code: errors.PAYMENT_REQUEST_CANCELED.code,
+        message: errors.PAYMENT_REQUEST_CANCELED.message,
+        details: {
+          originalError: error,
+        },
+      });
+
+      analytics.sendEvent(this._client, "payment-request.tokenize.canceled");
+
+      return formattedError;
+    case "PAYMENT_REQUEST_INITIALIZATION_FAILED":
+      formattedError = new BraintreeError({
+        type: errors.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.type,
+        code: errors.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.code,
+        message: errors.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.message,
+        details: {
+          originalError: error,
+        },
+      });
+      break;
+    case "BRAINTREE_GATEWAY_GOOGLE_PAYMENT_TOKENIZATION_ERROR":
+      formattedError = new BraintreeError({
+        type: errors.PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE.type,
+        code: errors.PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE.code,
+        message:
+          errors.PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE.message,
+        details: {
+          originalError: error,
+        },
+      });
+      break;
+    case "BRAINTREE_GATEWAY_GOOGLE_PAYMENT_PARSING_ERROR":
+      formattedError = new BraintreeError({
+        type: errors.PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR.type,
+        code: errors.PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR.code,
+        message: errors.PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR.message,
+        details: {
+          originalError: error,
+        },
+      });
+      break;
+    default:
+      formattedError = new BraintreeError({
+        code: errors.PAYMENT_REQUEST_NOT_COMPLETED.code,
+        type: error.type || BraintreeError.types.CUSTOMER,
+        message: errors.PAYMENT_REQUEST_NOT_COMPLETED.message,
+        details: {
+          originalError: error,
+        },
+      });
+  }
+
+  analytics.sendEvent(this._client, "payment-request.tokenize.failed");
+
+  return formattedError;
+};
+
+PaymentRequestComponent.prototype._formatCanMakePaymentError = function (
+  error
+) {
+  var formattedError;
+
+  switch (error.name) {
+    case "PAYMENT_REQUEST_INITIALIZATION_FAILED":
+      formattedError = new BraintreeError({
+        type: errors.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.type,
+        code: errors.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.code,
+        message: errors.PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED.message,
+        details: {
+          originalError: error,
+        },
+      });
+      break;
+    case "NotAllowedError":
+      formattedError = new BraintreeError({
+        type: errors.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED.type,
+        code: errors.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED.code,
+        message: errors.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED.message,
+        details: {
+          originalError: error,
+        },
+      });
+      break;
+    default:
+      formattedError = new BraintreeError({
+        code: errors.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED.code,
+        type: errors.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED.type,
+        message: errors.PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED.message,
+        details: {
+          originalError: error,
+        },
+      });
+  }
+
+  analytics.sendEvent(this._client, "payment-request.can-make-payment.failed");
+
+  return formattedError;
+};
+
+module.exports = wrapPromise.wrapPrototype(PaymentRequestComponent);
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/payment-request_index.js.html b/3.111.1/payment-request_index.js.html new file mode 100644 index 00000000..92f219ed --- /dev/null +++ b/3.111.1/payment-request_index.js.html @@ -0,0 +1,230 @@ + + + + + + + + + + + payment-request/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ payment-request/index.js +

+ + + + + +
+
+
"use strict";
+/**
+ * @module braintree-web/payment-request
+ * @description A component to integrate with the Payment Request API.
+ *
+ * **Note:** This component is currently in beta and the API may include breaking changes when upgrading. Please review the [Changelog](https://github.com/braintree/braintree-web/blob/main/CHANGELOG.md) for upgrade steps whenever you upgrade the version of braintree-web.
+ * */
+
+var PaymentRequestComponent = require("./external/payment-request");
+var basicComponentVerification = require("../lib/basic-component-verification");
+var createDeferredClient = require("../lib/create-deferred-client");
+var createAssetsUrl = require("../lib/create-assets-url");
+var wrapPromise = require("@braintree/wrap-promise");
+var VERSION = process.env.npm_package_version;
+
+/**
+ * @static
+ * @function create
+ * @param {object} options Creation options:
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {object} [options.enabledPaymentMethods] An object representing which payment methods to display.
+ * @param {boolean} [options.enabledPaymentMethods.basicCard=true] Whether or not to display credit card as an option in the Payment Request dialog. If left blank or set to true, credit cards will be displayed in the dialog if the merchant account is set up to process credit cards.
+ * @param {boolean} [options.enabledPaymentMethods.googlePay=true] Whether or not to display Google Pay as an option in the Payment Request dialog. If left blank or set to true, Google Pay will be displayed in the dialog if the merchant account is set up to process Google Pay.
+ * @param {Number} [options.googlePayVersion=1] Ignored if `options.enabledPaymentMethods.googlePay = false`. If `true`, this option specifies the version of Google Pay to use. Choose either 1 (default) or 2.
+ * @param {callback} [callback] The second argument, `data`, is the {@link PaymentRequestComponent} instance. If no callback is provided, `create` returns a promise that resolves with the {@link PaymentRequestComponent} instance.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * if (window.PaymentRequest) {
+ *   braintree.paymentRequest.create({
+ *     client: clientInstance
+ *   }, cb);
+ * } else {
+ *   // fall back to Hosted Fields if browser does not support Payment Request API
+ *   braintree.hostedFields.create(hostedFieldsOptions, cb);
+ * }
+ * @example <caption>Explicitly turning off credit cards from Payment Request API dialog</caption>
+ * braintree.paymentRequest.create({
+ *   client: clientInstance,
+ *   enabledPaymentMethods: {
+ *     googlePay: true,
+ *     basicCard: false
+ *   }
+ * }, cb);
+ * @example <caption>Using Google Pay v2 or basic card</caption>
+ * braintree.paymentRequest.create({
+ *   client: clientInstance,
+ *   enabledPaymentMethods: {
+ *     basicCard: true,
+ *     googlePay: true
+ *   },
+ *   googlePayVersion: 2
+ * }, cb);
+ *
+ */
+function create(options) {
+  var name = "Payment Request";
+
+  return basicComponentVerification
+    .verify({
+      name: name,
+      client: options.client,
+      authorization: options.authorization,
+    })
+    .then(function () {
+      return createDeferredClient.create({
+        authorization: options.authorization,
+        client: options.client,
+        debug: options.debug,
+        assetsUrl: createAssetsUrl.create(options.authorization),
+        name: name,
+      });
+    })
+    .then(function (client) {
+      var paymentRequestInstance;
+
+      options.client = client;
+      paymentRequestInstance = new PaymentRequestComponent(options);
+
+      return paymentRequestInstance.initialize();
+    });
+}
+
+module.exports = {
+  create: wrapPromise(create),
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/payment-request_shared_errors.js.html b/3.111.1/payment-request_shared_errors.js.html new file mode 100644 index 00000000..564de5fa --- /dev/null +++ b/3.111.1/payment-request_shared_errors.js.html @@ -0,0 +1,236 @@ + + + + + + + + + + + payment-request/shared/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ payment-request/shared/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.Payment Request - Creation Error Codes
+ * @description Errors that occur when [creating the Payment Request component](./module-braintree-web_payment-request.html#.create).
+ * @property {MERCHANT} PAYMENT_REQUEST_NO_VALID_SUPPORTED_PAYMENT_METHODS Occurs when there are no valid payment methods configured.
+ */
+
+/**
+ * @name BraintreeError.Payment Request - createSupportedPaymentMethodsConfiguration  Error Codes
+ * @description Errors that occur when using the [`createSupportedPaymentMethodsConfiguration` method](./PaymentRequestComponent.html#createSupportedPaymentMethodsConfiguration)
+ * @property {MERCHANT} PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_MUST_INCLUDE_TYPE Occurs when no type is supplied for method.
+ * @property {MERCHANT} PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_TYPE_NOT_ENABLED Occurs when configured type is not enabled.
+ */
+
+/**
+ * @name BraintreeError.Payment Request - tokenize  Error Codes
+ * @description Errors that occur when using the [`tokenize` method](./PaymentRequestComponent.html#tokenize)
+ * @property {CUSTOMER} PAYMENT_REQUEST_CANCELED Occurs when customer cancels the Payment Request.
+ * @property {MERCHANT} PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED Occurs when the Payment Request is closed do to the options being misconfigured.
+ * @property {MERCHANT} PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE Occurs when a Google Payment payment method is unable to be tokenized.
+ * @property {UNKNOWN} PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR Occurs when the result of tokenizing a Google Payment payment method could not be parsed.
+ * @property {CUSTOMER} PAYMENT_REQUEST_NOT_COMPLETED Occurs when an error prevented the Payment Request from being completed.
+ */
+
+/**
+ * @name BraintreeError.Payment Request - canMakePayment  Error Codes
+ * @description Errors that occur when using the [`canMakePayment` method](./PaymentRequestComponent.html#canMakePayment)
+ * @property {MERCHANT} PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED Occurs when the Payment Request is instantiated with misconfigured options.
+ * @property {MERCHANT} PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED Occurs when `canMakePayment` results in a `DomException` with a `NotAllowedError`. This usually occurs when `canMakePayment` is called multiple times with different supported payment options.
+ * @property {MERCHANT} PAYMENT_REQUEST_UNSUPPORTED_PAYMENT_METHOD Occurs when `canMakePayment` is called with a `supportedPaymentMethods` array that contains a payment method that is not supported by the Braintree SDK.
+ * @property {UNKNOWN} PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED Occurs when `canMakePayment` fails for any reason other than a misconfigured Payment Request object.
+ */
+
+var BraintreeError = require("../../lib/braintree-error");
+
+module.exports = {
+  PAYMENT_REQUEST_NO_VALID_SUPPORTED_PAYMENT_METHODS: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYMENT_REQUEST_NO_VALID_SUPPORTED_PAYMENT_METHODS",
+    message:
+      "There are no supported payment methods associated with this account.",
+  },
+  PAYMENT_REQUEST_CANCELED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "PAYMENT_REQUEST_CANCELED",
+    message: "Payment request was canceled.",
+  },
+  PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYMENT_REQUEST_INITIALIZATION_MISCONFIGURED",
+    message: "Something went wrong when configuring the payment request.",
+  },
+  PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "PAYMENT_REQUEST_CAN_MAKE_PAYMENT_FAILED",
+    message: "Something went wrong when calling `canMakePayment`",
+  },
+  PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYMENT_REQUEST_CAN_MAKE_PAYMENT_NOT_ALLOWED",
+    message:
+      "Something went wrong when calling `canMakePayment`. Most likely, `canMakePayment` was called multiple times with different supportedMethods configurations.",
+  },
+  PAYMENT_REQUEST_UNSUPPORTED_PAYMENT_METHOD: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYMENT_REQUEST_UNSUPPORTED_PAYMENT_METHOD",
+  },
+  PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYMENT_REQUEST_GOOGLE_PAYMENT_FAILED_TO_TOKENIZE",
+    message: "Something went wrong when tokenizing the Google Pay card.",
+  },
+  PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "PAYMENT_REQUEST_GOOGLE_PAYMENT_PARSING_ERROR",
+    message: "Something went wrong when tokenizing the Google Pay card.",
+  },
+  PAYMENT_REQUEST_NOT_COMPLETED: {
+    code: "PAYMENT_REQUEST_NOT_COMPLETED",
+    message: "Payment request could not be completed.",
+  },
+  PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_MUST_INCLUDE_TYPE:
+    {
+      type: BraintreeError.types.MERCHANT,
+      code: "PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_MUST_INCLUDE_TYPE",
+      message:
+        "createSupportedPaymentMethodsConfiguration must include a type parameter.",
+    },
+  PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_TYPE_NOT_ENABLED:
+    {
+      type: BraintreeError.types.MERCHANT,
+      code: "PAYMENT_REQUEST_CREATE_SUPPORTED_PAYMENT_METHODS_CONFIGURATION_TYPE_NOT_ENABLED",
+      message:
+        "createSupportedPaymentMethodsConfiguration type parameter must be valid or enabled.",
+    },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/paypal-checkout_errors.js.html b/3.111.1/paypal-checkout_errors.js.html new file mode 100644 index 00000000..95a152b3 --- /dev/null +++ b/3.111.1/paypal-checkout_errors.js.html @@ -0,0 +1,244 @@ + + + + + + + + + + + paypal-checkout/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ paypal-checkout/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.PayPal Checkout - Creation Error Codes
+ * @description Errors that occur when [creating the PayPal Checkout component](./module-braintree-web_paypal-checkout.html#.create).
+ * @property {MERCHANT} PAYPAL_NOT_ENABLED Occurs when PayPal is not enabled on the Braintree control panel.
+ * @property {MERCHANT} PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED Occurs only when testing in Sandbox, when a PayPal sandbox account is not linked to the merchant account in the Braintree control panel.
+ */
+
+/**
+ * @name BraintreeError.PayPal Checkout - createPayment Error Codes
+ * @description Errors that occur when using the [`createPayment` method](./PayPalCheckout.html#createPayment).
+ * @property {MERCHANT} PAYPAL_FLOW_OPTION_REQUIRED Occurs when a required option is missing.
+ * @property {MERCHANT} PAYPAL_INVALID_PAYMENT_OPTION Occurs when an option contains an invalid value.
+ * @property {NETWORK} PAYPAL_FLOW_FAILED Occurs when something goes wrong when initializing the flow.
+ */
+
+/**
+ * @name BraintreeError.PayPal Checkout - startVaultInitiatedCheckout Error Codes
+ * @description Errors that occur when using the [`startVaultInitiatedCheckout` method](./PayPalCheckout.html#startVaultInitiatedCheckout).
+ * @property {MERCHANT} PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED Occurs when a required param is missing when calling the method.
+ * @property {MERCHANT} PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED Occurs when PayPal window could not be opened. This often occurs because the call to start the vault initiated flow was not triggered from a click event.
+ * @property {CUSTOMER} PAYPAL_START_VAULT_INITIATED_CHECKOUT_CANCELED Occurs when a customer closes the PayPal flow before completion.
+ * @property {MERCHANT} PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS Occurs when the flow is initialized while an authorization is already in progress.
+ * @property {NETWORK} PAYPAL_START_VAULT_INITIATED_CHECKOUT_SETUP_FAILED Occurs when something went wrong setting up the flow.
+ */
+
+/**
+ * @name BraintreeError.PayPal Checkout - tokenizePayment Error Codes
+ * @description Errors that occur when using the [`tokenizePayment` method](./PayPalCheckout.html#tokenizePayment).
+ * @property {NETWORK} PAYPAL_ACCOUNT_TOKENIZATION_FAILED Occurs when PayPal account could not be tokenized.
+ */
+
+/**
+ * @name BraintreeError.Paypal Checkout - updatePayment Error Codes
+ * @description Errors that occur when using the [`updatePayment` method](./PayPalCheckout.html#updatePayment).
+ * @property {MERCHANT} PAYPAL_INVALID_PAYMENT_OPTION Occurs when an option contains an invalid value.
+ * @property {MERCHANT} PAYPAL_MISSING_REQUIRED_OPTION Occurs when a required option is missing.
+ * @property {NETWORK} PAYPAL_FLOW_FAILED Occurs when something goes wrong when initializing the flow or communicating with the server.
+ */
+var BraintreeError = require("../lib/braintree-error");
+
+module.exports = {
+  PAYPAL_NOT_ENABLED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYPAL_NOT_ENABLED",
+    message: "PayPal is not enabled for this merchant.",
+  },
+  PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED",
+    message:
+      "A linked PayPal Sandbox account is required to use PayPal Checkout in Sandbox. See https://developer.paypal.com/braintree/docs/guides/paypal/testing-go-live#linked-paypal-testing for details on linking your PayPal sandbox with Braintree.",
+  },
+  PAYPAL_ACCOUNT_TOKENIZATION_FAILED: {
+    type: BraintreeError.types.NETWORK,
+    code: "PAYPAL_ACCOUNT_TOKENIZATION_FAILED",
+    message: "Could not tokenize user's PayPal account.",
+  },
+  PAYPAL_FLOW_FAILED: {
+    type: BraintreeError.types.NETWORK,
+    code: "PAYPAL_FLOW_FAILED",
+    message: "Could not initialize PayPal flow.",
+  },
+  PAYPAL_FLOW_OPTION_REQUIRED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYPAL_FLOW_OPTION_REQUIRED",
+    message: "PayPal flow property is invalid or missing.",
+  },
+  PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED",
+  },
+  PAYPAL_START_VAULT_INITIATED_CHECKOUT_SETUP_FAILED: {
+    type: BraintreeError.types.NETWORK,
+    code: "PAYPAL_START_VAULT_INITIATED_CHECKOUT_SETUP_FAILED",
+    message: "Something went wrong when setting up the checkout workflow.",
+  },
+  PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED",
+    message:
+      "PayPal popup failed to open, make sure to initiate the vault checkout in response to a user action.",
+  },
+  PAYPAL_START_VAULT_INITIATED_CHECKOUT_CANCELED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "PAYPAL_START_VAULT_INITIATED_CHECKOUT_CANCELED",
+    message: "Customer closed PayPal popup before authorizing.",
+  },
+  PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS",
+    message: "Vault initiated checkout already in progress.",
+  },
+  PAYPAL_INVALID_PAYMENT_OPTION: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYPAL_INVALID_PAYMENT_OPTION",
+    message: "PayPal payment options are invalid.",
+  },
+  PAYPAL_MISSING_REQUIRED_OPTION: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYPAL_MISSING_REQUIRED_OPTION",
+    message: "Missing required option.",
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/paypal-checkout_index.js.html b/3.111.1/paypal-checkout_index.js.html new file mode 100644 index 00000000..4f963b41 --- /dev/null +++ b/3.111.1/paypal-checkout_index.js.html @@ -0,0 +1,211 @@ + + + + + + + + + + + paypal-checkout/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ paypal-checkout/index.js +

+ + + + + +
+
+
"use strict";
+/**
+ * @module braintree-web/paypal-checkout
+ * @description A component to integrate with the [PayPal JS SDK](https://github.com/paypal/paypal-checkout-components).
+ */
+
+var basicComponentVerification = require("../lib/basic-component-verification");
+var wrapPromise = require("@braintree/wrap-promise");
+var PayPalCheckout = require("./paypal-checkout");
+var VERSION = process.env.npm_package_version;
+
+/**
+ * @static
+ * @function create
+ * @description There are two ways to integrate the PayPal Checkout component. See the [PayPal Checkout constructor documentation](PayPalCheckout.html#PayPalCheckout) for more information and examples.
+ *
+ * @param {object} options Creation options:
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {string} [options.merchantAccountId] A non-default merchant account ID to use for tokenization.
+ * @param {boolean} [options.autoSetDataUserIdToken=false] Whether or not to render the PayPal SDK button with a customer's vaulted PayPal account. Must be used in conjunction with a Client Token generated with a customer id.
+ * @param {callback} [callback] The second argument, `data`, is the {@link PayPalCheckout} instance.
+ * @example
+ * braintree.client.create({
+ *   authorization: 'authorization'
+ * }).then(function (clientInstance) {
+ *   return braintree.paypalCheckout.create({
+ *     client: clientInstance
+ *   });
+ * }).then(function (paypalCheckoutInstance) {
+ *   // set up the PayPal JS SDK
+ * }).catch(function (err) {
+ *   console.error('Error!', err);
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+function create(options) {
+  var name = "PayPal Checkout";
+
+  return basicComponentVerification
+    .verify({
+      name: name,
+      client: options.client,
+      authorization: options.authorization,
+    })
+    .then(function () {
+      var instance = new PayPalCheckout(options);
+
+      return instance._initialize(options);
+    });
+}
+
+/**
+ * @static
+ * @function isSupported
+ * @description Returns true if PayPal Checkout [supports this browser](index.html#browser-support-webviews).
+ * @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.
+ * @returns {Boolean} Returns true if PayPal Checkout supports this browser.
+ */
+function isSupported() {
+  return true;
+}
+
+module.exports = {
+  create: wrapPromise(create),
+  isSupported: isSupported,
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/paypal-checkout_paypal-checkout.js.html b/3.111.1/paypal-checkout_paypal-checkout.js.html new file mode 100644 index 00000000..ca4e5cf6 --- /dev/null +++ b/3.111.1/paypal-checkout_paypal-checkout.js.html @@ -0,0 +1,1866 @@ + + + + + + + + + + + paypal-checkout/paypal-checkout.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ paypal-checkout/paypal-checkout.js +

+ + + + + +
+
+
"use strict";
+
+var analytics = require("../lib/analytics");
+var assign = require("../lib/assign").assign;
+var createDeferredClient = require("../lib/create-deferred-client");
+var createAssetsUrl = require("../lib/create-assets-url");
+var ExtendedPromise = require("@braintree/extended-promise");
+var wrapPromise = require("@braintree/wrap-promise");
+var BraintreeError = require("../lib/braintree-error");
+var convertToBraintreeError = require("../lib/convert-to-braintree-error");
+var errors = require("./errors");
+var constants = require("../paypal/shared/constants");
+var frameService = require("../lib/frame-service/external");
+var createAuthorizationData = require("../lib/create-authorization-data");
+var methods = require("../lib/methods");
+var useMin = require("../lib/use-min");
+var convertMethodsToError = require("../lib/convert-methods-to-error");
+var querystring = require("../lib/querystring");
+var camelCaseToSnakeCase = require("../lib/camel-case-to-snake-case");
+var VERSION = process.env.npm_package_version;
+var INTEGRATION_TIMEOUT_MS = require("../lib/constants").INTEGRATION_TIMEOUT_MS;
+
+var REQUIRED_PARAMS_FOR_START_VAULT_INITIATED_CHECKOUT = [
+  "amount",
+  "currency",
+  "vaultInitiatedCheckoutPaymentMethodToken",
+];
+
+var PAYPAL_SDK_PRELOAD_URL =
+  "https://www.{ENV}paypal.com/smart/buttons/preload";
+
+ExtendedPromise.suppressUnhandledPromiseMessage = true;
+
+/**
+ * PayPal Checkout tokenized payload. Returned in {@link PayPalCheckout#tokenizePayment}'s callback as the second argument, `data`.
+ * @typedef {object} PayPalCheckout~tokenizePayload
+ * @property {string} nonce The payment method nonce.
+ * @property {string} type The payment method type, always `PayPalAccount`.
+ * @property {object} details Additional PayPal account details.
+ * @property {string} details.email User's email address.
+ * @property {string} details.payerId User's payer ID, the unique identifier for each PayPal account.
+ * @property {string} details.firstName User's given name.
+ * @property {string} details.lastName User's surname.
+ * @property {?string} details.countryCode User's 2 character country code.
+ * @property {?string} details.phone User's phone number (e.g. 555-867-5309).
+ * @property {?object} details.shippingAddress User's shipping address details, only available if shipping address is enabled.
+ * @property {string} details.shippingAddress.recipientName Recipient of postage.
+ * @property {string} details.shippingAddress.line1 Street number and name.
+ * @property {string} details.shippingAddress.line2 Extended address.
+ * @property {string} details.shippingAddress.city City or locality.
+ * @property {string} details.shippingAddress.state State or region.
+ * @property {string} details.shippingAddress.postalCode Postal code.
+ * @property {string} details.shippingAddress.countryCode 2 character country code (e.g. US).
+ * @property {?object} details.billingAddress User's billing address details.
+ * Not available to all merchants; [contact support](https://developer.paypal.com/braintree/help) for details on eligibility and enabling this feature.
+ * Alternatively, see `shippingAddress` above as an available client option.
+ * @property {string} details.billingAddress.line1 Street number and name.
+ * @property {string} details.billingAddress.line2 Extended address.
+ * @property {string} details.billingAddress.city City or locality.
+ * @property {string} details.billingAddress.state State or region.
+ * @property {string} details.billingAddress.postalCode Postal code.
+ * @property {string} details.billingAddress.countryCode 2 character country code (e.g. US).
+ * @property {?object} creditFinancingOffered This property will only be present when the customer pays with PayPal Credit.
+ * @property {object} creditFinancingOffered.totalCost This is the estimated total payment amount including interest and fees the user will pay during the lifetime of the loan.
+ * @property {string} creditFinancingOffered.totalCost.value An amount defined by [ISO 4217](https://www.iso.org/iso/home/standards/currency_codes.htm) for the given currency.
+ * @property {string} creditFinancingOffered.totalCost.currency 3 letter currency code as defined by [ISO 4217](https://www.iso.org/iso/home/standards/currency_codes.htm).
+ * @property {number} creditFinancingOffered.term Length of financing terms in months.
+ * @property {object} creditFinancingOffered.monthlyPayment This is the estimated amount per month that the customer will need to pay including fees and interest.
+ * @property {string} creditFinancingOffered.monthlyPayment.value An amount defined by [ISO 4217](https://www.iso.org/iso/home/standards/currency_codes.htm) for the given currency.
+ * @property {string} creditFinancingOffered.monthlyPayment.currency 3 letter currency code as defined by [ISO 4217](https://www.iso.org/iso/home/standards/currency_codes.htm).
+ * @property {object} creditFinancingOffered.totalInterest Estimated interest or fees amount the payer will have to pay during the lifetime of the loan.
+ * @property {string} creditFinancingOffered.totalInterest.value An amount defined by [ISO 4217](https://www.iso.org/iso/home/standards/currency_codes.htm) for the given currency.
+ * @property {string} creditFinancingOffered.totalInterest.currency 3 letter currency code as defined by [ISO 4217](https://www.iso.org/iso/home/standards/currency_codes.htm).
+ * @property {boolean} creditFinancingOffered.payerAcceptance Status of whether the customer ultimately was approved for and chose to make the payment using the approved installment credit.
+ * @property {boolean} creditFinancingOffered.cartAmountImmutable Indicates whether the cart amount is editable after payer's acceptance on PayPal side.
+ */
+
+/**
+ * @class
+ * @param {object} options see {@link module:braintree-web/paypal-checkout.create|paypal-checkout.create}
+ * @classdesc This class represents a PayPal Checkout component that coordinates with the {@link https://developer.paypal.com/docs/checkout/integrate/#2-add-the-paypal-script-to-your-web-page|PayPal SDK}. Instances of this class can generate payment data and tokenize authorized payments.
+ *
+ * All UI (such as preventing actions on the parent page while authentication is in progress) is managed by the {@link https://developer.paypal.com/docs/checkout/integrate/#2-add-the-paypal-script-to-your-web-page|PayPal SDK}. You must provide your PayPal `client-id` as a query parameter. You can [retrieve this value from the PayPal Dashboard](https://developer.paypal.com/docs/checkout/integrate/#1-get-paypal-rest-api-credentials).
+ * @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/paypal-checkout.create|braintree-web.paypal-checkout.create} instead.</strong>
+ *
+ * #### Integrate Checkout Flow with PayPal SDK
+ *
+ * You must have [PayPal's script, configured with various query parameters](https://developer.paypal.com/docs/checkout/integrate/#2-add-the-paypal-script-to-your-web-page), loaded on your page:
+ *
+ * ```html
+ * <script src="https://www.paypal.com/sdk/js?client-id=your-sandbox-or-prod-client-id"></script>
+ * <div id="paypal-button"></div>
+ * ```
+ *
+ * When passing values in the `createPayment` method, make sure they match the [corresponding parameters in the query parameters for the PayPal SDK script](https://developer.paypal.com/docs/checkout/reference/customize-sdk/).
+ *
+ * ```javascript
+ * braintree.client.create({
+ *   authorization: 'authorization'
+ * }).then(function (clientInstance) {
+ *   return braintree.paypalCheckout.create({
+ *     client: clientInstance
+ *   });
+ * }).then(function (paypalCheckoutInstance) {
+ *   return paypal.Buttons({
+ *     createOrder: function () {
+ *       return paypalCheckoutInstance.createPayment({
+ *         flow: 'checkout',
+ *         currency: 'USD',
+ *         amount: '10.00',
+ *         intent: 'capture' // this value must either be `capture` or match the intent passed into the PayPal SDK intent query parameter
+ *         // your other createPayment options here
+ *       });
+ *     },
+ *
+ *     onApprove: function (data, actions) {
+ *       // some logic here before tokenization happens below
+ *       return paypalCheckoutInstance.tokenizePayment(data).then(function (payload) {
+ *         // Submit payload.nonce to your server
+ *       });
+ *     },
+ *
+ *     onCancel: function () {
+ *       // handle case where user cancels
+ *     },
+ *
+ *     onError: function (err) {
+ *       // handle case where error occurs
+ *     }
+ *   }).render('#paypal-button');
+ * }).catch(function (err) {
+ *  console.error('Error!', err);
+ * });
+ * ```
+ *
+ * #### Integrate Vault Flow with PayPal SDK
+ *
+ * You must have [PayPal's script, configured with various query parameters](https://developer.paypal.com/docs/checkout/integrate/#2-add-the-paypal-script-to-your-web-page), loaded on your page:
+ *
+ * ```html
+ * <script src="https://www.paypal.com/sdk/js?client-id=your-sandbox-or-prod-client-id&vault=true"></script>
+ * <div id="paypal-button"></div>
+ * ```
+ *
+ * When passing values in the `createPayment` method, make sure they match the [corresponding parameters in the query parameters for the PayPal SDK script](https://developer.paypal.com/docs/checkout/reference/customize-sdk/).
+ *
+ * ```javascript
+ * braintree.client.create({
+ *   authorization: 'authorization'
+ * }).then(function (clientInstance) {
+ *   return braintree.paypalCheckout.create({
+ *     client: clientInstance
+ *   });
+ * }).then(function (paypalCheckoutInstance) {
+ *   return paypal.Buttons({
+ *     createBillingAgreement: function () {
+ *       return paypalCheckoutInstance.createPayment({
+ *         flow: 'vault'
+ *         // your other createPayment options here
+ *       });
+ *     },
+ *
+ *     onApprove: function (data, actions) {
+ *       // some logic here before tokenization happens below
+ *       return paypalCheckoutInstance.tokenizePayment(data).then(function (payload) {
+ *         // Submit payload.nonce to your server
+ *       });
+ *     },
+ *
+ *     onCancel: function () {
+ *       // handle case where user cancels
+ *     },
+ *
+ *     onError: function (err) {
+ *       // handle case where error occurs
+ *     }
+ *   }).render('#paypal-button');
+ * }).catch(function (err) {
+ *  console.error('Error!', err);
+ * });
+ * ```
+ *
+ * #### Integrate with Checkout.js (deprecated PayPal SDK)
+ *
+ * If you are creating a new PayPal integration, please follow the previous integration guide to use the current version of the PayPal SDK. Use this integration guide only as a reference if you are already integrated with Checkout.js.
+ *
+ * You must have PayPal's Checkout.js script loaded on your page.
+ *
+ * ```html
+ * <script src="https://www.paypalobjects.com/api/checkout.js" data-version-4 log-level="warn"></script>
+ * ```
+ *
+ * ```javascript
+ * braintree.client.create({
+ *   authorization: 'authorization'
+ * }).then(function (clientInstance) {
+ *   return braintree.paypalCheckout.create({
+ *     client: clientInstance
+ *   });
+ * }).then(function (paypalCheckoutInstance) {
+ *   return paypal.Button.render({
+ *     env: 'production', // or 'sandbox'
+ *
+ *     payment: function () {
+ *       return paypalCheckoutInstance.createPayment({
+ *         // your createPayment options here
+ *       });
+ *     },
+ *
+ *     onAuthorize: function (data, actions) {
+ *       // some logic here before tokenization happens below
+ *       return paypalCheckoutInstance.tokenizePayment(data).then(function (payload) {
+ *         // Submit payload.nonce to your server
+ *       });
+ *     }
+ *   }, '#paypal-button');
+ * }).catch(function (err) {
+ *  console.error('Error!', err);
+ * });
+ * ```
+ */
+function PayPalCheckout(options) {
+  this._merchantAccountId = options.merchantAccountId;
+  // TODO remove this requirement for it to be opt in.
+  // This feature is not yet GA, so we're intentionally making
+  // it opt in and not publicly documenting it yet. Once it's
+  // GA, we can remove the requirement to opt in to it
+  this._autoSetDataUserIdToken = Boolean(options.autoSetDataUserIdToken);
+}
+
+PayPalCheckout.prototype._initialize = function (options) {
+  var config;
+
+  if (options.client) {
+    config = options.client.getConfiguration();
+    this._authorizationInformation = {
+      fingerprint: config.authorizationFingerprint,
+      environment: config.gatewayConfiguration.environment,
+    };
+  } else {
+    config = createAuthorizationData(options.authorization);
+    this._authorizationInformation = {
+      fingerprint: config.attrs.authorizationFingerprint,
+      environment: config.environment,
+    };
+  }
+
+  this._clientPromise = createDeferredClient
+    .create({
+      authorization: options.authorization,
+      client: options.client,
+      debug: options.debug,
+      assetsUrl: createAssetsUrl.create(options.authorization),
+      name: "PayPal Checkout",
+    })
+    .then(
+      function (client) {
+        this._configuration = client.getConfiguration();
+
+        // we skip these checks if a merchant account id is
+        // passed in, because the default merchant account
+        // may not have paypal enabled
+        if (!this._merchantAccountId) {
+          if (!this._configuration.gatewayConfiguration.paypalEnabled) {
+            this._setupError = new BraintreeError(errors.PAYPAL_NOT_ENABLED);
+          } else if (
+            this._configuration.gatewayConfiguration.paypal
+              .environmentNoNetwork === true
+          ) {
+            this._setupError = new BraintreeError(
+              errors.PAYPAL_SANDBOX_ACCOUNT_NOT_LINKED
+            );
+          }
+        }
+
+        if (this._setupError) {
+          return Promise.reject(this._setupError);
+        }
+
+        analytics.sendEvent(client, "paypal-checkout.initialized");
+        this._frameServicePromise = this._setupFrameService(client);
+
+        return client;
+      }.bind(this)
+    );
+
+  // if client was passed in, let config checks happen before
+  // resolving the instance. Otherwise, just resolve the instance
+  if (options.client) {
+    return this._clientPromise.then(
+      function () {
+        return this;
+      }.bind(this)
+    );
+  }
+
+  return Promise.resolve(this);
+};
+
+PayPalCheckout.prototype._setupFrameService = function (client) {
+  var frameServicePromise = new ExtendedPromise();
+  var config = client.getConfiguration();
+  var timeoutRef = setTimeout(function () {
+    analytics.sendEvent(client, "paypal-checkout.frame-service.timed-out");
+    frameServicePromise.reject(
+      new BraintreeError(
+        errors.PAYPAL_START_VAULT_INITIATED_CHECKOUT_SETUP_FAILED
+      )
+    );
+  }, INTEGRATION_TIMEOUT_MS);
+
+  this._assetsUrl =
+    config.gatewayConfiguration.paypal.assetsUrl + "/web/" + VERSION;
+  this._isDebug = config.isDebug;
+  // Note: this is using the static landing frame that the deprecated PayPal component builds and uses
+  this._loadingFrameUrl =
+    this._assetsUrl +
+    "/html/paypal-landing-frame" +
+    useMin(this._isDebug) +
+    ".html";
+
+  frameService.create(
+    {
+      name: "braintreepaypallanding",
+      dispatchFrameUrl:
+        this._assetsUrl +
+        "/html/dispatch-frame" +
+        useMin(this._isDebug) +
+        ".html",
+      openFrameUrl: this._loadingFrameUrl,
+    },
+    function (service) {
+      this._frameService = service;
+      clearTimeout(timeoutRef);
+
+      frameServicePromise.resolve();
+    }.bind(this)
+  );
+
+  return frameServicePromise;
+};
+
+/**
+ * @typedef {object} PayPalCheckout~lineItem
+ * @property {string} quantity Number of units of the item purchased. This value must be a whole number and can't be negative or zero.
+ * @property {string} unitAmount Per-unit price of the item. Can include up to 2 decimal places. This value can't be negative or zero.
+ * @property {string} name Item name. Maximum 127 characters.
+ * @property {string} kind Indicates whether the line item is a debit (sale) or credit (refund) to the customer. Accepted values: `debit` and `credit`.
+ * @property {?string} unitTaxAmount Per-unit tax price of the item. Can include up to 2 decimal places. This value can't be negative or zero.
+ * @property {?string} description Item description. Maximum 127 characters.
+ * @property {?string} productCode Product or UPC code for the item. Maximum 127 characters.
+ * @property {?string} url The URL to product information.
+ */
+
+/**
+ * @typedef {object} PayPalCheckout~shippingOption
+ * @property {string} id A unique ID that identifies a payer-selected shipping option.
+ * @property {string} label A description that the payer sees, which helps them choose an appropriate shipping option. For example, `Free Shipping`, `USPS Priority Shipping`, `Expédition prioritaire USPS`, or `USPS yōuxiān fā huò`. Localize this description to the payer's locale.
+ * @property {boolean} selected If `selected = true` is specified as part of the API request it represents the shipping option that the payee/merchant expects to be pre-selected for the payer when they first view the shipping options within the PayPal checkout experience. As part of the response if a shipping option has `selected = true` it represents the shipping option that the payer selected during the course of checkout with PayPal. Only 1 `shippingOption` can be set to `selected = true`.
+ * @property {string} type The method by which the payer wants to get their items. The possible values are:
+ * * `SHIPPING` - The payer intends to receive the items at a specified address.
+ * * `PICKUP` - The payer intends to pick up the items at a specified address. For example, a store address.
+ * @property {object} amount The shipping cost for the selected option.
+ * @property {string} amount.currency The three-character ISO-4217 currency code. PayPal does not support all currencies.
+ * @property {string} amount.value The amount the shipping option will cost. Includes the specified number of digits after decimal separator for the ISO-4217 currency code.
+ */
+
+/** @typedef {object} PayPalCheckout~pricingScheme
+ * @property {string} pricingModel The pricing model. Options are `FIXED`, `VARIABLE`, or `AUTO_RELOAD`.
+ * @property {string} price The price for the billing cycle.
+ * @property {string} reloadThresholdAmount The amount at which to reload on auto_reload plans.
+ */
+
+/**
+ * @typedef {Object} PayPalCheckout~billingCycles
+ * @property {(string|number)} billingFrequency The frequency of billing.
+ * @property {string} billingFrequencyUnit The unit of billing frequency. Options are `DAY`, `WEEK`, `MONTH`, or `YEAR`.
+ * @property {(string|number)} numberOfExecutions The number of executions for the billing cycle.
+ * @property {(string|number)} sequence The order in the upcoming billing cycles.
+ * @property {string} startDate The start date in ISO 8601 format (`2024-04-06T00:00:00Z`). If populated and the intent is to charge the buyer for the billing cycle at the checkout, it should be populated as current time in ISO 8601 format.
+ * @property {boolean} trial Indicates if the billing cycle is a trial.
+ * @property {pricingScheme} pricingScheme The {@link PayPalCheckout~pricingScheme|pricing scheme object} for this billing cycle.
+ */
+
+/**
+ * @typedef {Object} PayPalCheckout~planMetadata
+ * @property {billingCycles[]} [billingCycles] An array of {@link PayPalCheckout~billingCycles|billing cyles} for this plan.
+ * @property {string} currencyIsoCode The ISO code for the currency, for example `USD`.
+ * @property {string} name The name of the plan.
+ * @property {string} productDescription A description of the product. (Accepts only one element)
+ * @property {(string|number)} productQuantity The quantity of the product. (Accepts only one element)
+ * @property {(string|number)} oneTimeFeeAmount The one-time fee amount.
+ * @property {(string|number)} shippingAmount The amount for shipping.
+ * @property {(string|number)} productPrice The price of the product.
+ * @property {(string|number)} taxAmount The amount of tax.
+ */
+
+/**
+ * Creates a PayPal payment ID or billing token using the given options. This is meant to be passed to the PayPal JS SDK.
+ * When a {@link callback} is defined, the function returns undefined and invokes the callback with the id to be used with the PayPal JS SDK. Otherwise, it returns a Promise that resolves with the id.
+ * @public
+ * @param {object} options All options for the PayPalCheckout component.
+ * @param {string} options.flow Set to 'checkout' for one-time payment flow, or 'vault' for Vault flow. If 'vault' is used with a client token generated with a customer ID, the PayPal account will be added to that customer as a saved payment method.
+ * @param {string} [options.intent=authorize]
+ * * `authorize` - Submits the transaction for authorization but not settlement.
+ * * `order` - Validates the transaction without an authorization (i.e. without holding funds). Useful for authorizing and capturing funds up to 90 days after the order has been placed. Only available for Checkout flow.
+ * * `capture` - Payment will be immediately submitted for settlement upon creating a transaction. `sale` can be used as an alias for this value.
+ * @param {boolean} [options.offerCredit=false] Offers PayPal Credit as the default funding instrument for the transaction. If the customer isn't pre-approved for PayPal Credit, they will be prompted to apply for it.
+ * @param {(string|number)} [options.amount] The amount of the transaction. Required when using the Checkout flow. Should not include shipping cost.
+ * * Supports up to 2 digits after the decimal point
+ * @param {string} [options.currency] The currency code of the amount, such as 'USD'. Required when using the Checkout flow.
+ * @param {string} [options.displayName] The merchant name displayed inside of the PayPal lightbox; defaults to the company name on your Braintree account
+ * @param {boolean} [options.requestBillingAgreement] If `true` and `flow = checkout`, the customer will be prompted to consent to a billing agreement during the checkout flow. This value is ignored when `flow = vault`.
+ * @param {object} [options.billingAgreementDetails] When `requestBillingAgreement = true`, allows for details to be set for the billing agreement portion of the flow.
+ * @param {string} [options.billingAgreementDetails.description] Description of the billing agreement to display to the customer.
+ * @param {string} [options.vaultInitiatedCheckoutPaymentMethodToken] Use the payment method nonce representing a PayPal account with a Billing Agreement ID to create the payment and redirect the customer to select a new financial instrument. This option is only applicable to the `checkout` flow.
+ * @param {shippingOption[]} [options.shippingOptions] List of shipping options offered by the payee or merchant to the payer to ship or pick up their items.
+ * @param {boolean} [options.enableShippingAddress=false] Returns a shipping address object in {@link PayPal#tokenize}.
+ * @param {object} [options.shippingAddressOverride] Allows you to pass a shipping address you have already collected into the PayPal payment flow.
+ * @param {string} options.shippingAddressOverride.line1 Street address.
+ * @param {string} [options.shippingAddressOverride.line2] Street address (extended).
+ * @param {string} options.shippingAddressOverride.city City.
+ * @param {string} options.shippingAddressOverride.state State.
+ * @param {string} options.shippingAddressOverride.postalCode Postal code.
+ * @param {string} options.shippingAddressOverride.countryCode Country.
+ * @param {string} [options.shippingAddressOverride.phone] Phone number.
+ * @param {string} [options.shippingAddressOverride.recipientName] Recipient's name.
+ * @param {boolean} [options.shippingAddressEditable=true] Set to false to disable user editing of the shipping address.
+ * @param {string} [options.billingAgreementDescription] Use this option to set the description of the preapproved payment agreement visible to customers in their PayPal profile during Vault flows. Max 255 characters.
+ * @param {string} [options.landingPageType] Use this option to specify the PayPal page to display when a user lands on the PayPal site to complete the payment.
+ * * `login` - A PayPal account login page is used.
+ * * `billing` - A non-PayPal account landing page is used.
+ * @param {lineItem[]} [options.lineItems] The {@link PayPalCheckout~lineItem|line items} for this transaction. It can include up to 249 line items.
+ *
+ * @param {string} [options.planType] Determines the charge pattern for the Recurring Billing Agreement. Can be 'RECURRING', 'SUBSCRIPTION', 'UNSCHEDULED', or 'INSTALLMENTS'.
+ * @param {planMetadata} [options.planMetadata] When plan type is defined, allows for {@link PayPalCheckout~planMetadata|plan metadata} to be set for the Billing Agreement.
+ * @param {string} [options.userAuthenticationEmail] Optional merchant-provided buyer email, used to streamline the sign-in process for both one-time checkout and vault flows.
+ * @param {callback} [callback] The second argument is a PayPal `paymentId` or `billingToken` string, depending on whether `options.flow` is `checkout` or `vault`. This is also what is resolved by the promise if no callback is provided.
+ * @example
+ * // this paypal object is created by the PayPal JS SDK
+ * // see https://github.com/paypal/paypal-checkout-components
+ * paypal.Buttons({
+ *   createOrder: function () {
+ *     // when createPayment resolves, it is automatically passed to the PayPal JS SDK
+ *     return paypalCheckoutInstance.createPayment({
+ *       flow: 'checkout',
+ *       amount: '10.00',
+ *       currency: 'USD',
+ *       intent: 'capture' // this value must either be `capture` or match the intent passed into the PayPal SDK intent query parameter
+ *     });
+ *   },
+ *   // Add other options, e.g. onApproved, onCancel, onError
+ * }).render('#paypal-button');
+ *
+ * @example
+ * // shippingOptions are passed to createPayment. You can review the result from onAuthorize to determine which shipping option id was selected.
+ * ```javascript
+ * braintree.client.create({
+ *   authorization: 'authorization'
+ * }).then(function (clientInstance) {
+ *   return braintree.paypalCheckout.create({
+ *     client: clientInstance
+ *   });
+ * }).then(function (paypalCheckoutInstance) {
+ *   return paypal.Button.render({
+ *     env: 'production'
+ *
+ *     payment: function () {
+ *       return paypalCheckoutInstance.createPayment({
+ *         flow: 'checkout',
+ *         amount: '10.00',
+ *         currency: 'USD',
+ *         shippingOptions: [
+ *           {
+ *             id: 'UUID-9',
+ *             type: 'PICKUP',
+ *             label: 'Store Location Five',
+ *             selected: true,
+ *             amount: {
+ *               value: '1.00',
+ *               currency: 'USD'
+ *             }
+ *           },
+ *           {
+ *             id: 'shipping-speed-fast',
+ *             type: 'SHIPPING',
+ *             label: 'Fast Shipping',
+ *             selected: false,
+ *             amount: {
+ *               value: '1.00',
+ *               currency: 'USD'
+ *             }
+ *           },
+ *           {
+ *             id: 'shipping-speed-slow',
+ *             type: 'SHIPPING',
+ *             label: 'Slow Shipping',
+ *             selected: false,
+ *             amount: {
+ *               value: '1.00',
+ *               currency: 'USD'
+ *             }
+ *           }
+ *         ]
+ *       });
+ *     },
+ *
+ *     onAuthorize: function (data, actions) {
+ *       return paypalCheckoutInstance.tokenizePayment(data).then(function (payload) {
+ *         // Submit payload.nonce to your server
+ *       });
+ *     }
+ *   }, '#paypal-button');
+ * }).catch(function (err) {
+ *  console.error('Error!', err);
+ * });
+ *
+ * ```
+ *
+ * @example <caption>use the new plan features</caption>
+ * // Plan and plan metadata are passed to createPayment
+ * ```javascript
+ * braintree.client.create({
+ *   authorization: 'authorization'
+ * }).then(function (clientInstance) {
+ *   return braintree.paypalCheckout.create({
+ *     client: clientInstance
+ *   });
+ * }).then(function (paypalCheckoutInstance) {
+ *   return paypal.Button.render({
+ *     env: 'production'
+ *
+ *     payment: function () {
+ *       return paypalCheckoutInstance.createPayment({
+ *         flow: 'vault',
+ *         planType: 'RECURRING',
+ *         planMetadata: {
+ *           billingCycles: [
+ *             {
+ *                billingFrequency: "1",
+ *                billingFrequencyUnit: "MONTH",
+ *                numberOfExecutions: "1",
+ *                sequence: "1",
+ *                startDate: "2024-04-06T00:00:00Z",
+ *                trial: true,
+ *                pricingScheme: {
+ *                  pricingModel: "FIXED",
+ *              },
+ *            },
+ *            ],
+ *           currencyIsoCode: "USD",
+ *           name: "Netflix with Ads",
+ *           productDescription: "iPhone 13",
+ *           productQuantity: "1.0",
+ *           oneTimeFeeAmount: "10",
+ *           shippingAmount: "3.0",
+ *           productPrice: "200",
+ *           taxAmount: "20",
+ *        };
+ *       });
+ *     },
+ *
+ *     onAuthorize: function (data, actions) {
+ *       return paypalCheckoutInstance.tokenizePayment(data).then(function (payload) {
+ *         // Submit payload.nonce to your server
+ *       });
+ *     }
+ *   }, '#paypal-button');
+ * }).catch(function (err) {
+ *  console.error('Error!', err);
+ * });
+ *
+ * ```
+ *
+ * @returns {(promise|void)} returns a promise if no callback is provided.
+ */
+PayPalCheckout.prototype.createPayment = function (options) {
+  if (!options || !constants.FLOW_ENDPOINTS.hasOwnProperty(options.flow)) {
+    return Promise.reject(
+      new BraintreeError(errors.PAYPAL_FLOW_OPTION_REQUIRED)
+    );
+  }
+
+  analytics.sendEvent(this._clientPromise, "paypal-checkout.createPayment");
+
+  return this._createPaymentResource(options).then(function (response) {
+    var flowToken, urlParams;
+
+    if (options.flow === "checkout") {
+      urlParams = querystring.parse(response.paymentResource.redirectUrl);
+      flowToken = urlParams.token;
+    } else {
+      flowToken = response.agreementSetup.tokenId;
+    }
+
+    return flowToken;
+  });
+};
+
+PayPalCheckout.prototype._createPaymentResource = function (options, config) {
+  var self = this;
+  var endpoint = "paypal_hermes/" + constants.FLOW_ENDPOINTS[options.flow];
+
+  this._flow = options.flow;
+  delete this.intentFromCreatePayment;
+
+  config = config || {};
+
+  if (options.offerCredit === true) {
+    analytics.sendEvent(this._clientPromise, "paypal-checkout.credit.offered");
+  }
+
+  return this._clientPromise
+    .then(function (client) {
+      return client
+        .request({
+          endpoint: endpoint,
+          method: "post",
+          data: self._formatPaymentResourceData(options, config),
+        })
+        .then(function (data) {
+          self.intentFromCreatePayment = options.intent;
+
+          return data;
+        });
+    })
+    .catch(function (err) {
+      var status;
+
+      if (self._setupError) {
+        return Promise.reject(self._setupError);
+      }
+
+      status = err.details && err.details.httpStatus;
+
+      if (status === 422) {
+        return Promise.reject(
+          new BraintreeError({
+            type: errors.PAYPAL_INVALID_PAYMENT_OPTION.type,
+            code: errors.PAYPAL_INVALID_PAYMENT_OPTION.code,
+            message: errors.PAYPAL_INVALID_PAYMENT_OPTION.message,
+            details: {
+              originalError: err,
+            },
+          })
+        );
+      }
+
+      return Promise.reject(
+        convertToBraintreeError(err, {
+          type: errors.PAYPAL_FLOW_FAILED.type,
+          code: errors.PAYPAL_FLOW_FAILED.code,
+          message: errors.PAYPAL_FLOW_FAILED.message,
+        })
+      );
+    });
+};
+
+/**
+ * Use this function to update {@link PayPalCheckout~lineItem|line items} and/or {@link PayPalCheckout~shippingOption|shipping options} associated with a PayPalCheckout flow (`paymentId`).
+ * When a {@link callback} is defined, this function returns undefined and invokes the callback. The second callback argument, <code>data</code>, is the returned server data. If no callback is provided, `updatePayment` returns a promise that resolves with the server data.
+ * @public
+ * @param {object} options All options for the PayPalCheckout component.
+ * @param {string} options.paymentId This should be PayPal `paymentId`.
+ * @param {(string|number)} options.amount The amount of the transaction, including the amount of the selected shipping option, and all `line_items`.
+ * * Supports up to 2 decimal digits.
+ * @param {string} options.currency The currency code of the amount, such as 'USD'. Required when using the Checkout flow.
+ * @param {shippingOption[]} [options.shippingOptions] List of {@link PayPalCheckout~shippingOption|shipping options} offered by the payee or merchant to the payer to ship or pick up their items.
+ * @param {lineItem[]} [options.lineItems] The {@link PayPalCheckout~lineItem|line items} for this transaction. It can include up to 249 line items.
+ * @param {object} [options.amountBreakdown] Optional collection of amounts that break down the total into individual pieces.
+ * @param {string} [options.amountBreakdown.itemTotal] Optional, item amount
+ * @param {string} [options.amountBreakdown.shipping] Optional, shipping amount
+ * @param {string} [options.amountBreakdown.handling] Optional, handling amount
+ * @param {string} [options.amountBreakdown.taxTotal] Optional, tax amount
+ * @param {string} [options.amountBreakdown.insurance] Optional, insurance amount
+ * @param {string} [options.amountBreakdown.shippingDiscount] Optional, shipping discount amount
+ * @param {string} [options.amountBreakdown.discount] Optional, discount amount
+ * @param {callback} [callback] The second argument is a PayPal `paymentId` or `billingToken` string, depending on whether `options.flow` is `checkout` or `vault`. This is also what is resolved by the promise if no callback is provided.
+ * @example
+ * // this paypal object is created by the PayPal JS SDK
+ * // see https://github.com/paypal/paypal-checkout-components
+ * paypal.Buttons({
+ *   createOrder: function () {
+ *     // when createPayment resolves, it is automatically passed to the PayPal JS SDK
+ *     return paypalCheckoutInstance.createPayment({
+ *       //
+ *     });
+ *   },
+ *   onShippingChange: function (data) {
+ *     // Examine data and determine if the payment needs to be updated.
+ *     // when updatePayment resolves, it is automatically passed to the PayPal JS SDK
+ *     return paypalCheckoutInstance.updatePayment({
+ *         paymentId: data.paymentId,
+ *         amount: '15.00',
+ *         currency: 'USD',
+ *         shippingOptions: [
+ *           {
+ *             id: 'shipping-speed-fast',
+ *             type: 'SHIPPING',
+ *             label: 'Fast Shipping',
+ *             selected: true,
+ *             amount: {
+ *               value: '5.00',
+ *               currency: 'USD'
+ *             }
+ *           },
+ *           {
+ *             id: 'shipping-speed-slow',
+ *             type: 'SHIPPING',
+ *             label: 'Slow Shipping',
+ *             selected: false,
+ *             amount: {
+ *               value: '1.00',
+ *               currency: 'USD'
+ *             }
+ *           }
+ *         ]
+ *     });
+ *   }
+ *   // Add other options, e.g. onApproved, onCancel, onError
+ * }).render('#paypal-button');
+ *
+ * ```
+ *
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+PayPalCheckout.prototype.updatePayment = function (options) {
+  var self = this;
+  var endpoint = "paypal_hermes/patch_payment_resource";
+
+  if (!options || this._hasMissingOption(options, constants.REQUIRED_OPTIONS)) {
+    analytics.sendEvent(
+      self._clientPromise,
+      "paypal-checkout.updatePayment.missing-options"
+    );
+
+    return Promise.reject(
+      new BraintreeError(errors.PAYPAL_MISSING_REQUIRED_OPTION)
+    );
+  }
+
+  if (!this._verifyConsistentCurrency(options)) {
+    analytics.sendEvent(
+      self._clientPromise,
+      "paypal-checkout.updatePayment.inconsistent-currencies"
+    );
+
+    return Promise.reject(
+      new BraintreeError({
+        type: errors.PAYPAL_INVALID_PAYMENT_OPTION.type,
+        code: errors.PAYPAL_INVALID_PAYMENT_OPTION.code,
+        message: errors.PAYPAL_INVALID_PAYMENT_OPTION.message,
+        details: {
+          originalError: new Error(
+            "One or more shipping option currencies differ from checkout currency."
+          ),
+        },
+      })
+    );
+  }
+
+  analytics.sendEvent(this._clientPromise, "paypal-checkout.updatePayment");
+
+  return this._clientPromise
+    .then(function (client) {
+      return client.request({
+        endpoint: endpoint,
+        method: "post",
+        data: self._formatUpdatePaymentData(options),
+      });
+    })
+    .catch(function (err) {
+      var status = err.details && err.details.httpStatus;
+
+      if (status === 422) {
+        analytics.sendEvent(
+          self._clientPromise,
+          "paypal-checkout.updatePayment.invalid"
+        );
+
+        return Promise.reject(
+          new BraintreeError({
+            type: errors.PAYPAL_INVALID_PAYMENT_OPTION.type,
+            code: errors.PAYPAL_INVALID_PAYMENT_OPTION.code,
+            message: errors.PAYPAL_INVALID_PAYMENT_OPTION.message,
+            details: {
+              originalError: err,
+            },
+          })
+        );
+      }
+
+      analytics.sendEvent(
+        self._clientPromise,
+        "paypal-checkout.updatePayment." + errors.PAYPAL_FLOW_FAILED.code
+      );
+
+      return Promise.reject(
+        convertToBraintreeError(err, {
+          type: errors.PAYPAL_FLOW_FAILED.type,
+          code: errors.PAYPAL_FLOW_FAILED.code,
+          message: errors.PAYPAL_FLOW_FAILED.message,
+        })
+      );
+    });
+};
+
+/**
+ * Initializes the PayPal checkout flow with a payment method nonce that represents a vaulted PayPal account.
+ * When a {@link callback} is defined, the function returns undefined and invokes the callback with the id to be used with the PayPal JS SDK. Otherwise, it returns a Promise that resolves with the id.
+ * @public
+ * @ignore
+ * @param {object} options These options are identical to the {@link PayPalCheckout#createPayment|options for creating a payment resource}, except for the following:
+ * * `flow` cannot be set (will always be `'checkout'`)
+ * * `amount`, `currency`, and `vaultInitiatedCheckoutPaymentMethodToken` are required instead of optional
+ * * Additional configuration is available (listed below)
+ * @param {boolean} [options.optOutOfModalBackdrop=false] By default, the webpage will darken and become unusable while the PayPal window is open. For full control of the UI, pass `true` for this option.
+ * @param {callback} [callback] The second argument, <code>payload</code>, is a {@link PayPalCheckout~tokenizePayload|tokenizePayload}. If no callback is provided, the promise resolves with a {@link PayPalCheckout~tokenizePayload|tokenizePayload}.
+ * @example
+ * paypalCheckoutInstance.startVaultInitiatedCheckout({
+ *   vaultInitiatedCheckoutPaymentMethodToken: 'nonce-that-represents-a-vaulted-paypal-account',
+ *   amount: '10.00',
+ *   currency: 'USD'
+ * }).then(function (payload) {
+ *   // send payload.nonce to your server
+ * }).catch(function (err) {
+ *   if (err.code === 'PAYPAL_POPUP_CLOSED') {
+ *     // indicates that customer canceled by
+ *     // manually closing the PayPal popup
+ *   }
+ *
+ *   // handle other errors
+ * });
+ *
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+PayPalCheckout.prototype.startVaultInitiatedCheckout = function (options) {
+  var missingRequiredParam;
+  var self = this;
+
+  if (this._vaultInitiatedCheckoutInProgress) {
+    analytics.sendEvent(
+      this._clientPromise,
+      "paypal-checkout.startVaultInitiatedCheckout.error.already-in-progress"
+    );
+
+    return Promise.reject(
+      new BraintreeError(
+        errors.PAYPAL_START_VAULT_INITIATED_CHECKOUT_IN_PROGRESS
+      )
+    );
+  }
+
+  REQUIRED_PARAMS_FOR_START_VAULT_INITIATED_CHECKOUT.forEach(function (param) {
+    if (!options.hasOwnProperty(param)) {
+      missingRequiredParam = param;
+    }
+  });
+
+  if (missingRequiredParam) {
+    return Promise.reject(
+      new BraintreeError({
+        type: errors.PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED.type,
+        code: errors.PAYPAL_START_VAULT_INITIATED_CHECKOUT_PARAM_REQUIRED.code,
+        message: "Required param " + missingRequiredParam + " is missing.",
+      })
+    );
+  }
+
+  this._vaultInitiatedCheckoutInProgress = true;
+  this._addModalBackdrop(options);
+
+  options = assign({}, options, {
+    flow: "checkout",
+  });
+
+  analytics.sendEvent(
+    this._clientPromise,
+    "paypal-checkout.startVaultInitiatedCheckout.started"
+  );
+
+  return this._waitForVaultInitiatedCheckoutDependencies()
+    .then(function () {
+      var frameCommunicationPromise = new ExtendedPromise();
+      var startVaultInitiatedCheckoutPromise = self
+        ._createPaymentResource(options, {
+          returnUrl: self._constructVaultCheckutUrl("redirect-frame"),
+          cancelUrl: self._constructVaultCheckutUrl("cancel-frame"),
+        })
+        .then(function (response) {
+          var redirectUrl = response.paymentResource.redirectUrl;
+
+          self._frameService.redirect(redirectUrl);
+
+          return frameCommunicationPromise;
+        });
+
+      self._frameService.open(
+        {},
+        self._createFrameServiceCallback(frameCommunicationPromise)
+      );
+
+      return startVaultInitiatedCheckoutPromise;
+    })
+    .catch(function (err) {
+      self._vaultInitiatedCheckoutInProgress = false;
+      self._removeModalBackdrop();
+
+      if (err.code === "FRAME_SERVICE_FRAME_CLOSED") {
+        analytics.sendEvent(
+          self._clientPromise,
+          "paypal-checkout.startVaultInitiatedCheckout.canceled.by-customer"
+        );
+
+        return Promise.reject(
+          new BraintreeError(
+            errors.PAYPAL_START_VAULT_INITIATED_CHECKOUT_CANCELED
+          )
+        );
+      }
+
+      if (self._frameService) {
+        self._frameService.close();
+      }
+
+      if (
+        err.code &&
+        err.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED") > -1
+      ) {
+        analytics.sendEvent(
+          self._clientPromise,
+          "paypal-checkout.startVaultInitiatedCheckout.failed.popup-not-opened"
+        );
+
+        return Promise.reject(
+          new BraintreeError({
+            code: errors.PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED
+              .code,
+            type: errors.PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED
+              .type,
+            message:
+              errors.PAYPAL_START_VAULT_INITIATED_CHECKOUT_POPUP_OPEN_FAILED
+                .message,
+            details: {
+              originalError: err,
+            },
+          })
+        );
+      }
+
+      return Promise.reject(err);
+    })
+    .then(function (response) {
+      self._frameService.close();
+      self._vaultInitiatedCheckoutInProgress = false;
+      self._removeModalBackdrop();
+      analytics.sendEvent(
+        self._clientPromise,
+        "paypal-checkout.startVaultInitiatedCheckout.succeeded"
+      );
+
+      return Promise.resolve(response);
+    });
+};
+
+PayPalCheckout.prototype._addModalBackdrop = function (options) {
+  if (options.optOutOfModalBackdrop) {
+    return;
+  }
+
+  if (!this._modalBackdrop) {
+    this._modalBackdrop = document.createElement("div");
+    this._modalBackdrop.setAttribute(
+      "data-braintree-paypal-vault-initiated-checkout-modal",
+      true
+    );
+    this._modalBackdrop.style.position = "fixed";
+    this._modalBackdrop.style.top = 0;
+    this._modalBackdrop.style.bottom = 0;
+    this._modalBackdrop.style.left = 0;
+    this._modalBackdrop.style.right = 0;
+    this._modalBackdrop.style.zIndex = 9999;
+    this._modalBackdrop.style.background = "black";
+    this._modalBackdrop.style.opacity = "0.7";
+    this._modalBackdrop.addEventListener(
+      "click",
+      function () {
+        this.focusVaultInitiatedCheckoutWindow();
+      }.bind(this)
+    );
+  }
+
+  document.body.appendChild(this._modalBackdrop);
+};
+
+PayPalCheckout.prototype._removeModalBackdrop = function () {
+  if (!(this._modalBackdrop && this._modalBackdrop.parentNode)) {
+    return;
+  }
+
+  this._modalBackdrop.parentNode.removeChild(this._modalBackdrop);
+};
+
+/**
+ * Closes the PayPal window if it is opened via `startVaultInitiatedCheckout`.
+ * @public
+ * @ignore
+ * @param {callback} [callback] Gets called when window is closed.
+ * @example
+ * paypalCheckoutInstance.closeVaultInitiatedCheckoutWindow();
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+PayPalCheckout.prototype.closeVaultInitiatedCheckoutWindow = function () {
+  if (this._vaultInitiatedCheckoutInProgress) {
+    analytics.sendEvent(
+      this._clientPromise,
+      "paypal-checkout.startVaultInitiatedCheckout.canceled.by-merchant"
+    );
+  }
+
+  return this._waitForVaultInitiatedCheckoutDependencies().then(
+    function () {
+      this._frameService.close();
+    }.bind(this)
+  );
+};
+
+/**
+ * Focuses the PayPal window if it is opened via `startVaultInitiatedCheckout`.
+ * @public
+ * @ignore
+ * @param {callback} [callback] Gets called when window is focused.
+ * @example
+ * paypalCheckoutInstance.focusVaultInitiatedCheckoutWindow();
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+PayPalCheckout.prototype.focusVaultInitiatedCheckoutWindow = function () {
+  return this._waitForVaultInitiatedCheckoutDependencies().then(
+    function () {
+      this._frameService.focus();
+    }.bind(this)
+  );
+};
+
+PayPalCheckout.prototype._createFrameServiceCallback = function (
+  frameCommunicationPromise
+) {
+  var self = this;
+
+  // TODO when a merchant integrates an iOS or Android integration
+  // with a webview using the web SDK, we will have to add popupbridge
+  // support
+  return function (err, payload) {
+    if (err) {
+      frameCommunicationPromise.reject(err);
+    } else if (payload) {
+      self._frameService.redirect(self._loadingFrameUrl);
+      self
+        .tokenizePayment({
+          paymentToken: payload.token,
+          payerID: payload.PayerID,
+          paymentID: payload.paymentId,
+          orderID: payload.orderId,
+        })
+        .then(function (res) {
+          frameCommunicationPromise.resolve(res);
+        })
+        .catch(function (tokenizationError) {
+          frameCommunicationPromise.reject(tokenizationError);
+        });
+    }
+  };
+};
+
+PayPalCheckout.prototype._waitForVaultInitiatedCheckoutDependencies =
+  function () {
+    var self = this;
+
+    return this._clientPromise.then(function () {
+      return self._frameServicePromise;
+    });
+  };
+
+PayPalCheckout.prototype._constructVaultCheckutUrl = function (frameName) {
+  var serviceId = this._frameService._serviceId;
+
+  return (
+    this._assetsUrl +
+    "/html/" +
+    frameName +
+    useMin(this._isDebug) +
+    ".html?channel=" +
+    serviceId
+  );
+};
+
+/**
+ * Tokenizes the authorize data from the PayPal JS SDK when completing a buyer approval flow.
+ * When a {@link callback} is defined, invokes the callback with {@link PayPalCheckout~tokenizePayload|tokenizePayload} and returns undefined. Otherwise, returns a Promise that resolves with a {@link PayPalCheckout~tokenizePayload|tokenizePayload}.
+ * @public
+ * @param {object} tokenizeOptions Tokens and IDs required to tokenize the payment.
+ * @param {string} tokenizeOptions.payerId Payer ID returned by PayPal `onApproved` callback.
+ * @param {string} [tokenizeOptions.paymentId] Payment ID returned by PayPal `onApproved` callback.
+ * @param {string} [tokenizeOptions.billingToken] Billing Token returned by PayPal `onApproved` callback.
+ * @param {boolean} [tokenizeOptions.vault=true] Whether or not to vault the resulting PayPal account (if using a client token generated with a customer id and the vault flow).
+ * @param {callback} [callback] The second argument, <code>payload</code>, is a {@link PayPalCheckout~tokenizePayload|tokenizePayload}. If no callback is provided, the promise resolves with a {@link PayPalCheckout~tokenizePayload|tokenizePayload}.
+ * @example <caption>Opt out of auto-vaulting behavior</caption>
+ * // create the paypalCheckoutInstance with a client token generated with a customer id
+ * paypal.Buttons({
+ *   createBillingAgreement: function () {
+ *     return paypalCheckoutInstance.createPayment({
+ *       flow: 'vault'
+ *       // your other createPayment options here
+ *     });
+ *   },
+ *   onApproved: function (data) {
+ *     data.vault = false;
+ *
+ *     return paypalCheckoutInstance.tokenizePayment(data);
+ *   },
+ *   // Add other options, e.g. onCancel, onError
+ * }).render('#paypal-button');
+ *
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+PayPalCheckout.prototype.tokenizePayment = function (tokenizeOptions) {
+  var self = this;
+  var shouldVault = true;
+  var payload;
+  var options = {
+    flow: this._flow,
+    intent: tokenizeOptions.intent || this.intentFromCreatePayment,
+  };
+  var params = {
+    // The paymentToken provided by the PayPal JS SDK is the EC Token
+    ecToken: tokenizeOptions.paymentToken,
+    billingToken: tokenizeOptions.billingToken,
+    payerId: tokenizeOptions.payerID,
+    paymentId: tokenizeOptions.paymentID,
+    orderId: tokenizeOptions.orderID,
+    shippingOptionsId: tokenizeOptions.shippingOptionsId,
+  };
+
+  if (tokenizeOptions.hasOwnProperty("vault")) {
+    shouldVault = tokenizeOptions.vault;
+  }
+
+  options.vault = shouldVault;
+
+  analytics.sendEvent(
+    this._clientPromise,
+    "paypal-checkout.tokenization.started"
+  );
+
+  return this._clientPromise
+    .then(function (client) {
+      return client.request({
+        endpoint: "payment_methods/paypal_accounts",
+        method: "post",
+        data: self._formatTokenizeData(options, params),
+      });
+    })
+    .then(function (response) {
+      payload = self._formatTokenizePayload(response);
+
+      analytics.sendEvent(
+        self._clientPromise,
+        "paypal-checkout.tokenization.success"
+      );
+      if (payload.creditFinancingOffered) {
+        analytics.sendEvent(
+          self._clientPromise,
+          "paypal-checkout.credit.accepted"
+        );
+      }
+
+      return payload;
+    })
+    .catch(function (err) {
+      if (self._setupError) {
+        return Promise.reject(self._setupError);
+      }
+
+      analytics.sendEvent(
+        self._clientPromise,
+        "paypal-checkout.tokenization.failed"
+      );
+
+      return Promise.reject(
+        convertToBraintreeError(err, {
+          type: errors.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.type,
+          code: errors.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.code,
+          message: errors.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.message,
+        })
+      );
+    });
+};
+
+/**
+ * Resolves with the PayPal client id to be used when loading the PayPal SDK.
+ * @public
+ * @param {callback} [callback] The second argument, <code>id</code>, is a the PayPal client id. If no callback is provided, the promise resolves with the PayPal client id.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * paypalCheckoutInstance.getClientId().then(function (id) {
+ *  var script = document.createElement('script');
+ *
+ *  script.src = 'https://www.paypal.com/sdk/js?client-id=' + id;
+ *  script.onload = function () {
+ *    // setup the PayPal SDK
+ *  };
+ *
+ *  document.body.appendChild(script);
+ * });
+ */
+PayPalCheckout.prototype.getClientId = function () {
+  return this._clientPromise.then(function (client) {
+    return client.getConfiguration().gatewayConfiguration.paypal.clientId;
+  });
+};
+
+/**
+ * Resolves when the PayPal SDK has been successfully loaded onto the page.
+ * @public
+ * @param {object} [options] A configuration object to modify the query params and data-attributes on the PayPal SDK. A subset of the parameters are listed below. For a full list of query params, see the [PayPal docs](https://developer.paypal.com/docs/checkout/reference/customize-sdk/?mark=query#query-parameters).
+ * @param {string} [options.client-id] By default, this will be the client id associated with the authorization used to create the Braintree component. When used in conjunction with passing `authorization` when creating the PayPal Checkout component, you can speed up the loading of the PayPal SDK.
+ * @param {string} [options.intent="authorize"] By default, the PayPal SDK defaults to an intent of `capture`. Since the default intent when calling {@link PayPalCheckout#createPayment|`createPayment`} is `authorize`, the PayPal SDK will be loaded with `intent=authorize`. If you wish to use a different intent when calling {@link PayPalCheckout#createPayment|`createPayment`}, make sure it matches here. If `sale` is used, it will be converted to `capture` for the PayPal SDK. If the `vault: true` param is used, `tokenize` will be passed as the default intent.
+ * @param {string} [options.locale=en_US] Use this option to change the language, links, and terminology used in the PayPal flow. This locale will be used unless the buyer has set a preferred locale for their account. If an unsupported locale is supplied, a fallback locale (determined by buyer preference or browser data) will be used and no error will be thrown.
+ *
+ * Supported locales are:
+ * `da_DK`,
+ * `de_DE`,
+ * `en_AU`,
+ * `en_GB`,
+ * `en_US`,
+ * `es_ES`,
+ * `fr_CA`,
+ * `fr_FR`,
+ * `id_ID`,
+ * `it_IT`,
+ * `ja_JP`,
+ * `ko_KR`,
+ * `nl_NL`,
+ * `no_NO`,
+ * `pl_PL`,
+ * `pt_BR`,
+ * `pt_PT`,
+ * `ru_RU`,
+ * `sv_SE`,
+ * `th_TH`,
+ * `zh_CN`,
+ * `zh_HK`,
+ * and `zh_TW`.
+ *
+ * @param {string} [options.currency="USD"] If a currency is passed in {@link PayPalCheckout#createPayment|`createPayment`}, it must match the currency passed here.
+ * @param {boolean} [options.vault] Must be `true` when using `flow: vault` in {@link PayPalCheckout#createPayment|`createPayment`}.
+ * @param {string} [options.components=buttons] By default, the Braintree SDK will only load the PayPal smart buttons component. If you would like to load just the [messages component](https://developer.paypal.com/docs/business/checkout/add-capabilities/credit-messaging/), pass `messages`. If you would like to load both, pass `buttons,messages`
+ * @param {object} [options.dataAttributes] The data attributes to apply to the script. Any data attribute can be passed. A subset of the parameters are listed below. For a full list of data attributes, see the [PayPal docs](https://developer.paypal.com/docs/checkout/reference/customize-sdk/#script-parameters).
+ * @param {string} [options.dataAttributes.client-token] The client token to use in the script. (usually not needed)
+ * @param {string} [options.dataAttributes.csp-nonce] See the [PayPal docs about content security nonces](https://developer.paypal.com/docs/checkout/reference/customize-sdk/#csp-nonce).
+ * @param {callback} [callback] Called when the PayPal SDK has been loaded onto the page. The second argument is the PayPal Checkout instance. If no callback is provided, the promise resolves with the PayPal Checkout instance when the PayPal SDK has been loaded onto the page.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example <caption>Without options</caption>
+ * paypalCheckoutInstance.loadPayPalSDK().then(function () {
+ *   // window.paypal.Buttons is now available to use
+ * });
+ * @example <caption>With options</caption>
+ * paypalCheckoutInstance.loadPayPalSDK({
+ *   'client-id': 'PayPal Client Id', // Can speed up rendering time to hardcode this value
+ *
+ *   intent: 'capture', // Make sure this value matches the value in createPayment
+ *   currency: 'USD', // Make sure this value matches the value in createPayment
+ * }).then(function () {
+ *   // window.paypal.Buttons is now available to use
+ * });
+ * @example <caption>With Vaulting</caption>
+ * paypalCheckoutInstance.loadPayPalSDK({
+ *   vault: true
+ * }).then(function () {
+ *   // window.paypal.Buttons is now available to use
+ * });
+ */
+PayPalCheckout.prototype.loadPayPalSDK = function (options) {
+  var idPromise, src;
+  var loadPromise = new ExtendedPromise();
+  var dataAttributes = (options && options.dataAttributes) || {};
+  var userIdToken =
+    dataAttributes["user-id-token"] || dataAttributes["data-user-id-token"];
+
+  if (this._configuration) {
+    dataAttributes["client-metadata-id"] = dataAttributes["client-metadata-id"]
+      ? dataAttributes["client-metadata-id"]
+      : this._configuration.analyticsMetadata.sessionId;
+  }
+
+  if (!userIdToken) {
+    userIdToken =
+      this._authorizationInformation.fingerprint &&
+      this._authorizationInformation.fingerprint.split("?")[0];
+  }
+
+  this._paypalScript = document.createElement("script");
+
+  // NEXT_MAJOR_VERSION
+  // this options object should have 2 properties:
+  // * queryParams
+  // * dataAttributes
+  // should make organizing this better than squashing
+  // all the query params at the top level and extracting
+  // the data attributes
+  options = assign(
+    {},
+    {
+      components: "buttons",
+    },
+    options
+  );
+  delete options.dataAttributes;
+
+  // NEXT_MAJOR_VERSION if merchant passes an explicit intent,
+  // currency, amount, etc, save those for use in createPayment
+  // if no explicit param of that type is passed in when calling
+  // createPayment to reduce the number of items that need to be
+  // duplicated here and in createPayment
+  if (options.vault) {
+    options.intent = options.intent || "tokenize";
+  } else {
+    options.intent = options.intent || "authorize";
+    options.currency = options.currency || "USD";
+  }
+
+  src = "https://www.paypal.com/sdk/js?";
+  this._paypalScript.onload = function () {
+    loadPromise.resolve();
+  };
+
+  Object.keys(dataAttributes).forEach(
+    function (attribute) {
+      this._paypalScript.setAttribute(
+        "data-" + attribute.replace(/^data\-/, ""),
+        dataAttributes[attribute]
+      );
+    }.bind(this)
+  );
+
+  if (options["client-id"]) {
+    idPromise = Promise.resolve(options["client-id"]);
+  } else {
+    idPromise = this.getClientId();
+  }
+
+  idPromise.then(
+    function (id) {
+      options["client-id"] = id;
+
+      if (this._autoSetDataUserIdToken && userIdToken) {
+        this._paypalScript.setAttribute("data-user-id-token", userIdToken);
+
+        // preloading improves the rendering time of the PayPal button
+        this._attachPreloadPixel({
+          id: id,
+          userIdToken: userIdToken,
+          amount: dataAttributes.amount,
+          currency: options.currency,
+          merchantId: options["merchant-id"],
+        });
+      }
+
+      this._paypalScript.src = querystring.queryify(src, options);
+      document.head.insertBefore(
+        this._paypalScript,
+        document.head.firstElementChild
+      );
+    }.bind(this)
+  );
+
+  return loadPromise.then(
+    function () {
+      return this;
+    }.bind(this)
+  );
+};
+
+PayPalCheckout.prototype._attachPreloadPixel = function (options) {
+  var request;
+  var id = options.id;
+  var userIdToken = options.userIdToken;
+  var env = this._authorizationInformation.environment;
+  var subdomain = env === "production" ? "" : "sandbox.";
+  var url = PAYPAL_SDK_PRELOAD_URL.replace("{ENV}", subdomain);
+  var preloadOptions = {
+    "client-id": id,
+    "user-id-token": userIdToken,
+  };
+
+  if (options.amount) {
+    preloadOptions.amount = options.amount;
+  }
+  if (options.currency) {
+    preloadOptions.currency = options.currency;
+  }
+  if (options.merchantId) {
+    preloadOptions["merchant-id"] = options.merchantId;
+  }
+
+  request = new XMLHttpRequest();
+  request.open("GET", querystring.queryify(url, preloadOptions));
+  request.send();
+};
+
+PayPalCheckout.prototype._formatPaymentResourceData = function (
+  options,
+  config
+) {
+  var key;
+  var gatewayConfiguration = this._configuration.gatewayConfiguration;
+  // NEXT_MAJOR_VERSION default value for intent in PayPal SDK is capture
+  // but our integrations default value is authorize. Default this to capture
+  // in the next major version.
+  var intent = options.intent;
+  var paymentResource = {
+    // returnUrl and cancelUrl are required in hermes create_payment_resource route
+    // but are not used by the PayPal sdk, except to redirect to an error page
+    returnUrl: config.returnUrl || "https://www.paypal.com/checkoutnow/error",
+    cancelUrl: config.cancelUrl || "https://www.paypal.com/checkoutnow/error",
+    offerPaypalCredit: options.offerCredit === true,
+    merchantAccountId: this._merchantAccountId,
+    experienceProfile: {
+      brandName: options.displayName || gatewayConfiguration.paypal.displayName,
+      localeCode: options.locale,
+      noShipping: (!options.enableShippingAddress).toString(),
+      addressOverride: options.shippingAddressEditable === false,
+      landingPageType: options.landingPageType,
+    },
+    shippingOptions: options.shippingOptions,
+    payer_email: options.userAuthenticationEmail, // eslint-disable-line camelcase
+  };
+
+  if (options.flow === "checkout") {
+    paymentResource.amount = options.amount;
+    paymentResource.currencyIsoCode = options.currency;
+    paymentResource.requestBillingAgreement = options.requestBillingAgreement;
+
+    if (intent) {
+      // 'sale' has been changed to 'capture' in PayPal's backend, but
+      // we use an old version with 'sale'. We provide capture as an alias
+      // to match the PayPal SDK
+      if (intent === "capture") {
+        intent = "sale";
+      }
+      paymentResource.intent = intent;
+    }
+
+    if (options.hasOwnProperty("lineItems")) {
+      paymentResource.lineItems = options.lineItems;
+    }
+
+    if (options.hasOwnProperty("vaultInitiatedCheckoutPaymentMethodToken")) {
+      paymentResource.vaultInitiatedCheckoutPaymentMethodToken =
+        options.vaultInitiatedCheckoutPaymentMethodToken;
+    }
+
+    if (options.hasOwnProperty("shippingOptions")) {
+      paymentResource.shippingOptions = options.shippingOptions;
+    }
+
+    for (key in options.shippingAddressOverride) {
+      if (options.shippingAddressOverride.hasOwnProperty(key)) {
+        paymentResource[key] = options.shippingAddressOverride[key];
+      }
+    }
+
+    if (options.hasOwnProperty("billingAgreementDetails")) {
+      paymentResource.billingAgreementDetails = options.billingAgreementDetails;
+    }
+  } else {
+    // NOTE: This flow is "vault"
+    paymentResource.shippingAddress = options.shippingAddressOverride;
+
+    if (options.billingAgreementDescription) {
+      paymentResource.description = options.billingAgreementDescription;
+    }
+
+    if (options.planType) {
+      /* eslint-disable camelcase */
+      paymentResource.plan_type = options.planType;
+
+      if (options.planMetadata) {
+        paymentResource.plan_metadata = camelCaseToSnakeCase(
+          options.planMetadata
+        );
+      }
+      /* eslint-enable camelcase */
+    }
+  }
+
+  // this needs to be set outside of the block where add it to the
+  // payment request so that a follow up tokenization call can use it,
+  // but if a second create payment resource call is made without
+  // the correlation id, we want to reset it to undefined so that the
+  // tokenization call does not use a stale correlation id
+  this._riskCorrelationId = options.riskCorrelationId;
+  if (options.riskCorrelationId) {
+    paymentResource.correlationId = this._riskCorrelationId;
+  }
+
+  return paymentResource;
+};
+
+/**
+ * @ignore
+ * @static
+ * @function _verifyConsistentCurrency
+ * Verifies that `options.currency` and the currencies for each `shippingOption` the same.
+ * @param {object} options `options` provided for `updatePayment`.
+ * @returns {boolean} true is currencies match (or no shipping options); false if currencies do not match.
+ */
+
+PayPalCheckout.prototype._verifyConsistentCurrency = function (options) {
+  if (
+    options.currency &&
+    options.hasOwnProperty("shippingOptions") &&
+    Array.isArray(options.shippingOptions)
+  ) {
+    return options.shippingOptions.every(function (item) {
+      return (
+        item.amount &&
+        item.amount.currency &&
+        options.currency.toLowerCase() === item.amount.currency.toLowerCase()
+      );
+    });
+  }
+
+  return true;
+};
+
+/**
+ * @ignore
+ * @static
+ * @function _hasMissingOption
+ * @param {object} options All options provided for intiating the PayPal flow.
+ * @param {array} required A list of required inputs that must be include as part of the options.
+ * @returns {boolean} Returns a boolean.
+ */
+
+PayPalCheckout.prototype._hasMissingOption = function (options, required) {
+  var i, option;
+
+  required = required || [];
+
+  if (
+    !options.hasOwnProperty("amount") &&
+    !options.hasOwnProperty("lineItems")
+  ) {
+    return true;
+  }
+
+  for (i = 0; i < required.length; i++) {
+    option = required[i];
+
+    if (!options.hasOwnProperty(option)) {
+      return true;
+    }
+  }
+
+  return false;
+};
+
+PayPalCheckout.prototype._formatUpdatePaymentData = function (options) {
+  var self = this;
+  var paymentResource = {
+    merchantAccountId: this._merchantAccountId,
+    paymentId: options.paymentId || options.orderId,
+    currencyIsoCode: options.currency,
+  };
+
+  if (options.hasOwnProperty("amount")) {
+    paymentResource.amount = options.amount;
+  }
+
+  if (options.hasOwnProperty("lineItems")) {
+    paymentResource.lineItems = options.lineItems;
+  }
+
+  if (options.hasOwnProperty("shippingOptions")) {
+    paymentResource.shippingOptions = options.shippingOptions;
+  }
+
+  if (options.hasOwnProperty("amountBreakdown")) {
+    paymentResource.amountBreakdown = options.amountBreakdown;
+  }
+
+  /* shippingAddress not supported yet */
+  if (options.hasOwnProperty("shippingAddress")) {
+    analytics.sendEvent(
+      self._clientPromise,
+      "paypal-checkout.updatePayment.shippingAddress.provided.by-the-merchant"
+    );
+
+    paymentResource.line1 = options.shippingAddress.line1;
+
+    if (options.shippingAddress.hasOwnProperty("line2")) {
+      paymentResource.line2 = options.shippingAddress.line2;
+    }
+
+    paymentResource.city = options.shippingAddress.city;
+    paymentResource.state = options.shippingAddress.state;
+    paymentResource.postalCode = options.shippingAddress.postalCode;
+    paymentResource.countryCode = options.shippingAddress.countryCode;
+
+    if (options.shippingAddress.hasOwnProperty("phone")) {
+      paymentResource.phone = options.shippingAddress.phone;
+    }
+
+    if (options.shippingAddress.hasOwnProperty("recipientName")) {
+      paymentResource.recipientName = options.shippingAddress.recipientName;
+    }
+  }
+
+  return paymentResource;
+};
+
+PayPalCheckout.prototype._formatTokenizeData = function (options, params) {
+  var clientConfiguration = this._configuration;
+  var gatewayConfiguration = clientConfiguration.gatewayConfiguration;
+  var isTokenizationKey =
+    clientConfiguration.authorizationType === "TOKENIZATION_KEY";
+  var isVaultFlow = options.flow === "vault";
+  var correlationId =
+    this._riskCorrelationId || params.billingToken || params.ecToken;
+  var data = {
+    paypalAccount: {
+      correlationId: correlationId,
+      options: {
+        validate: isVaultFlow && !isTokenizationKey && options.vault,
+      },
+    },
+  };
+
+  if (isVaultFlow) {
+    data.paypalAccount.billingAgreementToken = params.billingToken;
+  } else {
+    data.paypalAccount.paymentToken = params.paymentId || params.orderId;
+    data.paypalAccount.payerId = params.payerId;
+    data.paypalAccount.unilateral =
+      gatewayConfiguration.paypal.unvettedMerchant;
+
+    if (options.intent) {
+      data.paypalAccount.intent = options.intent;
+    }
+  }
+
+  if (this._merchantAccountId) {
+    data.merchantAccountId = this._merchantAccountId;
+  }
+
+  return data;
+};
+
+PayPalCheckout.prototype._formatTokenizePayload = function (response) {
+  var payload;
+  var account = {};
+
+  if (response.paypalAccounts) {
+    account = response.paypalAccounts[0];
+  }
+
+  payload = {
+    nonce: account.nonce,
+    details: {},
+    type: account.type,
+  };
+
+  if (account.details && account.details.payerInfo) {
+    payload.details = account.details.payerInfo;
+  }
+
+  if (account.details && account.details.creditFinancingOffered) {
+    payload.creditFinancingOffered = account.details.creditFinancingOffered;
+  }
+
+  if (account.details && account.details.shippingOptionId) {
+    payload.shippingOptionId = account.details.shippingOptionId;
+  }
+
+  if (account.details && account.details.cobrandedCardLabel) {
+    payload.cobrandedCardLabel = account.details.cobrandedCardLabel;
+  }
+
+  return payload;
+};
+
+/**
+ * Cleanly tear down anything set up by {@link module:braintree-web/paypal-checkout.create|create}.
+ * @public
+ * @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
+ * @example
+ * paypalCheckoutInstance.teardown();
+ * @example <caption>With callback</caption>
+ * paypalCheckoutInstance.teardown(function () {
+ *   // teardown is complete
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+PayPalCheckout.prototype.teardown = function () {
+  var self = this;
+
+  convertMethodsToError(this, methods(PayPalCheckout.prototype));
+
+  if (this._paypalScript && this._paypalScript.parentNode) {
+    this._paypalScript.parentNode.removeChild(this._paypalScript);
+  }
+
+  return this._frameServicePromise
+    .catch(function () {
+      // no need to error in teardown for an error setting up the frame service
+    })
+    .then(function () {
+      if (!self._frameService) {
+        return Promise.resolve();
+      }
+
+      return self._frameService.teardown();
+    });
+};
+
+module.exports = wrapPromise.wrapPrototype(PayPalCheckout);
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/paypal_external_paypal.js.html b/3.111.1/paypal_external_paypal.js.html new file mode 100644 index 00000000..a5fb7cb0 --- /dev/null +++ b/3.111.1/paypal_external_paypal.js.html @@ -0,0 +1,812 @@ + + + + + + + + + + + paypal/external/paypal.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ paypal/external/paypal.js +

+ + + + + +
+
+
"use strict";
+
+var frameService = require("../../lib/frame-service/external");
+var BraintreeError = require("../../lib/braintree-error");
+var convertToBraintreeError = require("../../lib/convert-to-braintree-error");
+var useMin = require("../../lib/use-min");
+var once = require("../../lib/once");
+var VERSION = process.env.npm_package_version;
+var constants = require("../shared/constants");
+var INTEGRATION_TIMEOUT_MS =
+  require("../../lib/constants").INTEGRATION_TIMEOUT_MS;
+var analytics = require("../../lib/analytics");
+var methods = require("../../lib/methods");
+var deferred = require("../../lib/deferred");
+var errors = require("../shared/errors");
+var convertMethodsToError = require("../../lib/convert-methods-to-error");
+var querystring = require("../../lib/querystring");
+var wrapPromise = require("@braintree/wrap-promise");
+
+/**
+ * @typedef {object} PayPal~tokenizePayload
+ * @property {string} nonce The payment method nonce.
+ * @property {string} type The payment method type, always `PayPalAccount`.
+ * @property {object} details Additional PayPal account details.
+ * @property {string} details.email User's email address.
+ * @property {string} details.payerId User's payer ID, the unique identifier for each PayPal account.
+ * @property {string} details.firstName User's given name.
+ * @property {string} details.lastName User's surname.
+ * @property {?string} details.countryCode User's 2 character country code.
+ * @property {?string} details.phone User's phone number (e.g. 555-867-5309).
+ * @property {?object} details.shippingAddress User's shipping address details, only available if shipping address is enabled.
+ * @property {string} details.shippingAddress.recipientName Recipient of postage.
+ * @property {string} details.shippingAddress.line1 Street number and name.
+ * @property {string} details.shippingAddress.line2 Extended address.
+ * @property {string} details.shippingAddress.city City or locality.
+ * @property {string} details.shippingAddress.state State or region.
+ * @property {string} details.shippingAddress.postalCode Postal code.
+ * @property {string} details.shippingAddress.countryCode 2 character country code (e.g. US).
+ * @property {?object} details.billingAddress User's billing address details.
+ * Not available to all merchants; [contact support](https://developer.paypal.com/braintree/help) for details on eligibility and enabling this feature.
+ * Alternatively, see `shippingAddress` above as an available client option.
+ * @property {string} details.billingAddress.line1 Street number and name.
+ * @property {string} details.billingAddress.line2 Extended address.
+ * @property {string} details.billingAddress.city City or locality.
+ * @property {string} details.billingAddress.state State or region.
+ * @property {string} details.billingAddress.postalCode Postal code.
+ * @property {string} details.billingAddress.countryCode 2 character country code (e.g. US).
+ * @property {?object} creditFinancingOffered This property will only be present when the customer pays with PayPal Credit.
+ * @property {object} creditFinancingOffered.totalCost This is the estimated total payment amount including interest and fees the user will pay during the lifetime of the loan.
+ * @property {string} creditFinancingOffered.totalCost.value An amount defined by [ISO 4217](https://www.iso.org/iso/home/standards/currency_codes.htm) for the given currency.
+ * @property {string} creditFinancingOffered.totalCost.currency 3 letter currency code as defined by [ISO 4217](https://www.iso.org/iso/home/standards/currency_codes.htm).
+ * @property {number} creditFinancingOffered.term Length of financing terms in months.
+ * @property {object} creditFinancingOffered.monthlyPayment This is the estimated amount per month that the customer will need to pay including fees and interest.
+ * @property {string} creditFinancingOffered.monthlyPayment.value An amount defined by [ISO 4217](https://www.iso.org/iso/home/standards/currency_codes.htm) for the given currency.
+ * @property {string} creditFinancingOffered.monthlyPayment.currency 3 letter currency code as defined by [ISO 4217](https://www.iso.org/iso/home/standards/currency_codes.htm).
+ * @property {object} creditFinancingOffered.totalInterest Estimated interest or fees amount the payer will have to pay during the lifetime of the loan.
+ * @property {string} creditFinancingOffered.totalInterest.value An amount defined by [ISO 4217](https://www.iso.org/iso/home/standards/currency_codes.htm) for the given currency.
+ * @property {string} creditFinancingOffered.totalInterest.currency 3 letter currency code as defined by [ISO 4217](https://www.iso.org/iso/home/standards/currency_codes.htm).
+ * @property {boolean} creditFinancingOffered.payerAcceptance Status of whether the customer ultimately was approved for and chose to make the payment using the approved installment credit.
+ * @property {boolean} creditFinancingOffered.cartAmountImmutable Indicates whether the cart amount is editable after payer's acceptance on PayPal side.
+ *
+ */
+
+/**
+ * @typedef {object} PayPal~tokenizeReturn
+ * @property {Function} close A handle to close the PayPal checkout flow.
+ * @property {Function} focus A handle to focus the PayPal checkout flow. Note that some browsers (notably iOS Safari) do not support focusing popups. Firefox requires the focus call to occur as the result of a user interaction, such as a button click.
+ */
+
+/**
+ * @class
+ * @param {object} options see {@link module:braintree-web/paypal.create|paypal.create}
+ * @classdesc This class represents a PayPal component. Instances of this class can open a PayPal window for authenticating a PayPal account. Any additional UI, such as disabling the page while authentication is taking place, is up to the developer.
+ *
+ * This component has been deprecated in favor of the {@link PayPalCheckout|PayPal Checkout component}, which provides a fully managed UI. New features will not be added to this component.
+ * @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/paypal.create|braintree-web.paypal.create} instead.</strong>
+ */
+function PayPal(options) {
+  this._client = options.client;
+  this._assetsUrl =
+    options.client.getConfiguration().gatewayConfiguration.paypal.assetsUrl +
+    "/web/" +
+    VERSION;
+  this._isDebug = options.client.getConfiguration().isDebug;
+  this._loadingFrameUrl =
+    this._assetsUrl +
+    "/html/paypal-landing-frame" +
+    useMin(this._isDebug) +
+    ".html";
+  this._authorizationInProgress = false;
+}
+
+PayPal.prototype._initialize = function () {
+  var self = this;
+  var client = this._client;
+  var failureTimeout = setTimeout(function () {
+    analytics.sendEvent(client, "paypal.load.timed-out");
+  }, INTEGRATION_TIMEOUT_MS);
+
+  return new Promise(function (resolve) {
+    frameService.create(
+      {
+        name: constants.LANDING_FRAME_NAME,
+        dispatchFrameUrl:
+          self._assetsUrl +
+          "/html/dispatch-frame" +
+          useMin(self._isDebug) +
+          ".html",
+        openFrameUrl: self._loadingFrameUrl,
+      },
+      function (service) {
+        self._frameService = service;
+        clearTimeout(failureTimeout);
+        analytics.sendEvent(client, "paypal.load.succeeded");
+        resolve(self);
+      }
+    );
+  });
+};
+
+/**
+ * Launches the PayPal login flow and returns a nonce payload. Only one PayPal login flow should be active at a time. One way to achieve this is to disable your PayPal button while the flow is open.
+ * @public
+ * @param {object} options All tokenization options for the PayPal component.
+ * @param {string} options.flow Set to 'checkout' for one-time payment flow, or 'vault' for Vault flow. If 'vault' is used with a client token generated with a customer id, the PayPal account will be added to that customer as a saved payment method.
+ * @param {string} [options.intent=authorize]
+ * * `authorize` - Submits the transaction for authorization but not settlement.
+ * * `order` - Validates the transaction without an authorization (i.e. without holding funds). Useful for authorizing and capturing funds up to 90 days after the order has been placed. Only available for Checkout flow.
+ * * `sale` - Payment will be immediately submitted for settlement upon creating a transaction.
+ * @param {boolean} [options.offerCredit=false] Offers PayPal Credit as the default funding instrument for the transaction. If the customer isn't pre-approved for PayPal Credit, they will be prompted to apply for it.
+ * @param {boolean} [options.offerPayLater=false] Offers PayPal Pay Later if the customer qualifies. Defaults to false. Only available with `flow: 'checkout'`.
+ * @param {string} [options.useraction]
+ * Changes the call-to-action in the PayPal flow. By default the final button will show the localized
+ * word for "Continue" and implies that the final amount billed is not yet known.
+ *
+ * Setting this option to `commit` changes the button text to "Pay Now" and page text will convey to
+ * the user that billing will take place immediately.
+ * @param {(string|number)} [options.amount] The amount of the transaction. Required when using the Checkout flow.
+ * @param {string} [options.currency] The currency code of the amount, such as 'USD'. Required when using the Checkout flow.
+ * @param {string} [options.displayName] The merchant name displayed inside of the PayPal lightbox; defaults to the company name on your Braintree account
+ * @param {string} [options.locale=en_US] Use this option to change the language, links, and terminology used in the PayPal flow. This locale will be used unless the buyer has set a preferred locale for their account. If an unsupported locale is supplied, a fallback locale (determined by buyer preference or browser data) will be used and no error will be thrown.
+ *
+ * Supported locales are:
+ * `da_DK`,
+ * `de_DE`,
+ * `en_AU`,
+ * `en_GB`,
+ * `en_US`,
+ * `es_ES`,
+ * `fr_CA`,
+ * `fr_FR`,
+ * `id_ID`,
+ * `it_IT`,
+ * `ja_JP`,
+ * `ko_KR`,
+ * `nl_NL`,
+ * `no_NO`,
+ * `pl_PL`,
+ * `pt_BR`,
+ * `pt_PT`,
+ * `ru_RU`,
+ * `sv_SE`,
+ * `th_TH`,
+ * `zh_CN`,
+ * `zh_HK`,
+ * and `zh_TW`.
+ *
+ * @param {boolean} [options.enableShippingAddress=false] Returns a shipping address object in {@link PayPal#tokenize}.
+ * @param {object} [options.shippingAddressOverride] Allows you to pass a shipping address you have already collected into the PayPal payment flow.
+ * @param {string} options.shippingAddressOverride.line1 Street address.
+ * @param {string} [options.shippingAddressOverride.line2] Street address (extended).
+ * @param {string} options.shippingAddressOverride.city City.
+ * @param {string} options.shippingAddressOverride.state State.
+ * @param {string} options.shippingAddressOverride.postalCode Postal code.
+ * @param {string} options.shippingAddressOverride.countryCode Country.
+ * @param {string} [options.shippingAddressOverride.phone] Phone number.
+ * @param {string} [options.shippingAddressOverride.recipientName] Recipient's name.
+ * @param {boolean} [options.shippingAddressEditable=true] Set to false to disable user editing of the shipping address.
+ * @param {string} [options.billingAgreementDescription] Use this option to set the description of the preapproved payment agreement visible to customers in their PayPal profile during Vault flows. Max 255 characters.
+ * @param {string} [options.landingPageType] Use this option to specify the PayPal page to display when a user lands on the PayPal site to complete the payment.
+ * * `login` - A PayPal account login page is used.
+ * * `billing` - A non-PayPal account landing page is used.
+ * @param {callback} callback The second argument, <code>data</code>, is a {@link PayPal~tokenizePayload|tokenizePayload}.
+ * @example
+ * <caption>Tokenizing with the vault flow</caption>
+ * button.addEventListener('click', function () {
+ *   // Disable the button so that we don't attempt to open multiple popups.
+ *   button.setAttribute('disabled', 'disabled');
+ *
+ *   // if there is any other part of the page that must be disabled
+ *   // while authentication is in progress, do so now
+ *
+ *   // Because PayPal tokenization opens a popup, this must be called
+ *   // as a result of a user action, such as a button click.
+ *   paypalInstance.tokenize({
+ *     flow: 'vault' // Required
+ *     // Any other tokenization options
+ *   }, function (tokenizeErr, payload) {
+ *     button.removeAttribute('disabled');
+ *
+ *     // if any other part of the page was disabled, re-enable now
+ *
+ *     if (tokenizeErr) {
+ *       // Handle tokenization errors or premature flow closure
+ *
+ *       switch (tokenizeErr.code) {
+ *         case 'PAYPAL_POPUP_CLOSED':
+ *           console.error('Customer closed PayPal popup.');
+ *           break;
+ *         case 'PAYPAL_ACCOUNT_TOKENIZATION_FAILED':
+ *           console.error('PayPal tokenization failed. See details:', tokenizeErr.details);
+ *           break;
+ *         case 'PAYPAL_FLOW_FAILED':
+ *           console.error('Unable to initialize PayPal flow. Are your options correct?', tokenizeErr.details);
+ *           break;
+ *         default:
+ *           console.error('Error!', tokenizeErr);
+ *       }
+ *     } else {
+ *       // Submit payload.nonce to your server
+ *     }
+ *   });
+ * });
+
+ * @example
+ * <caption>Tokenizing with the checkout flow</caption>
+ * button.addEventListener('click', function () {
+ *   // Disable the button so that we don't attempt to open multiple popups.
+ *   button.setAttribute('disabled', 'disabled');
+ *
+ *   // Because PayPal tokenization opens a popup, this must be called
+ *   // as a result of a user action, such as a button click.
+ *   paypalInstance.tokenize({
+ *     flow: 'checkout', // Required
+ *     amount: '10.00', // Required
+ *     currency: 'USD' // Required
+ *     // Any other tokenization options
+ *   }, function (tokenizeErr, payload) {
+ *     button.removeAttribute('disabled');
+ *
+ *     if (tokenizeErr) {
+ *       // Handle tokenization errors or premature flow closure
+ *
+ *       switch (tokenizeErr.code) {
+ *         case 'PAYPAL_POPUP_CLOSED':
+ *           console.error('Customer closed PayPal popup.');
+ *           break;
+ *         case 'PAYPAL_ACCOUNT_TOKENIZATION_FAILED':
+ *           console.error('PayPal tokenization failed. See details:', tokenizeErr.details);
+ *           break;
+ *         case 'PAYPAL_FLOW_FAILED':
+ *           console.error('Unable to initialize PayPal flow. Are your options correct?', tokenizeErr.details);
+ *           break;
+ *         default:
+ *           console.error('Error!', tokenizeErr);
+ *       }
+ *     } else {
+ *       // Submit payload.nonce to your server
+ *     }
+ *   });
+ * });
+ * @returns {Promise|PayPal~tokenizeReturn} A handle to manage the PayPal checkout frame. If no callback is provided, returns a promise.
+ */
+PayPal.prototype.tokenize = function (options, callback) {
+  var self = this;
+  var client = this._client;
+  var tokenizePromise, optionError;
+
+  if (callback) {
+    callback = once(deferred(callback));
+  }
+
+  if (!options || !constants.FLOW_ENDPOINTS.hasOwnProperty(options.flow)) {
+    optionError = new BraintreeError(errors.PAYPAL_FLOW_OPTION_REQUIRED);
+
+    if (callback) {
+      callback(optionError);
+
+      return this._frameService.createNoopHandler();
+    }
+
+    return Promise.reject(optionError);
+  }
+
+  tokenizePromise = new Promise(function (resolve, reject) {
+    if (self._authorizationInProgress) {
+      analytics.sendEvent(client, "paypal.tokenization.error.already-opened");
+
+      reject(new BraintreeError(errors.PAYPAL_TOKENIZATION_REQUEST_ACTIVE));
+    } else {
+      self._authorizationInProgress = true;
+
+      if (!window.popupBridge) {
+        analytics.sendEvent(client, "paypal.tokenization.opened");
+      }
+
+      if (options.offerCredit === true) {
+        analytics.sendEvent(client, "paypal.credit.offered");
+      }
+
+      if (options.offerPayLater === true) {
+        analytics.sendEvent(client, "paypal.paylater.offered");
+      }
+
+      self._navigateFrameToAuth(options).catch(reject);
+      // self MUST happen after _navigateFrameToAuth for Metro browsers to work.
+      self._frameService.open(
+        {},
+        self._createFrameServiceCallback(options, resolve, reject)
+      );
+    }
+  });
+
+  if (callback) {
+    tokenizePromise
+      .then(function (res) {
+        callback(null, res);
+      })
+      .catch(callback);
+
+    return this._frameService.createHandler({
+      beforeClose: function () {
+        analytics.sendEvent(client, "paypal.tokenization.closed.by-merchant");
+      },
+    });
+  }
+
+  return tokenizePromise;
+};
+
+PayPal.prototype._createFrameServiceCallback = function (
+  options,
+  resolve,
+  reject
+) {
+  var self = this;
+  var client = this._client;
+
+  if (window.popupBridge) {
+    return function (err, payload) {
+      var canceled =
+        payload && payload.path && payload.path.substring(0, 7) === "/cancel";
+
+      self._authorizationInProgress = false;
+
+      // `err` exists when the user clicks "Done" button of browser view
+      if (err || canceled) {
+        analytics.sendEvent(
+          client,
+          "paypal.tokenization.closed-popupbridge.by-user"
+        );
+        // Call merchant's tokenize callback with an error
+        reject(new BraintreeError(errors.PAYPAL_POPUP_CLOSED));
+      } else if (payload) {
+        self
+          ._tokenizePayPal(options, payload.queryItems)
+          .then(resolve)
+          .catch(reject);
+      }
+    };
+  }
+
+  return function (err, params) {
+    self._authorizationInProgress = false;
+
+    if (err) {
+      if (err.code === "FRAME_SERVICE_FRAME_CLOSED") {
+        analytics.sendEvent(client, "paypal.tokenization.closed.by-user");
+        reject(new BraintreeError(errors.PAYPAL_POPUP_CLOSED));
+      } else if (
+        err.code &&
+        err.code.indexOf("FRAME_SERVICE_FRAME_OPEN_FAILED") > -1
+      ) {
+        reject(
+          new BraintreeError({
+            code: errors.PAYPAL_POPUP_OPEN_FAILED.code,
+            type: errors.PAYPAL_POPUP_OPEN_FAILED.type,
+            message: errors.PAYPAL_POPUP_OPEN_FAILED.message,
+            details: {
+              originalError: err,
+            },
+          })
+        );
+      }
+    } else if (params) {
+      self._tokenizePayPal(options, params).then(resolve).catch(reject);
+    }
+  };
+};
+
+PayPal.prototype._tokenizePayPal = function (options, params) {
+  var self = this;
+  var client = this._client;
+
+  if (!window.popupBridge) {
+    this._frameService.redirect(this._loadingFrameUrl);
+  }
+
+  return client
+    .request({
+      endpoint: "payment_methods/paypal_accounts",
+      method: "post",
+      data: this._formatTokenizeData(options, params),
+    })
+    .then(function (response) {
+      var payload = self._formatTokenizePayload(response);
+
+      if (window.popupBridge) {
+        analytics.sendEvent(client, "paypal.tokenization.success-popupbridge");
+      } else {
+        analytics.sendEvent(client, "paypal.tokenization.success");
+      }
+
+      if (payload.creditFinancingOffered) {
+        analytics.sendEvent(client, "paypal.credit.accepted");
+      }
+
+      self._frameService.close();
+
+      return payload;
+    })
+    .catch(function (err) {
+      if (window.popupBridge) {
+        analytics.sendEvent(client, "paypal.tokenization.failed-popupbridge");
+      } else {
+        analytics.sendEvent(client, "paypal.tokenization.failed");
+      }
+
+      self._frameService.close();
+
+      return Promise.reject(
+        convertToBraintreeError(err, {
+          type: errors.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.type,
+          code: errors.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.code,
+          message: errors.PAYPAL_ACCOUNT_TOKENIZATION_FAILED.message,
+        })
+      );
+    });
+};
+
+PayPal.prototype._formatTokenizePayload = function (response) {
+  var payload;
+  var account = {};
+
+  if (response.paypalAccounts) {
+    account = response.paypalAccounts[0];
+  }
+
+  payload = {
+    nonce: account.nonce,
+    details: {},
+    type: account.type,
+  };
+
+  if (account.details && account.details.payerInfo) {
+    payload.details = account.details.payerInfo;
+  }
+
+  if (account.details && account.details.creditFinancingOffered) {
+    payload.creditFinancingOffered = account.details.creditFinancingOffered;
+  }
+
+  return payload;
+};
+
+PayPal.prototype._formatTokenizeData = function (options, params) {
+  var clientConfiguration = this._client.getConfiguration();
+  var gatewayConfiguration = clientConfiguration.gatewayConfiguration;
+  var isTokenizationKey =
+    clientConfiguration.authorizationType === "TOKENIZATION_KEY";
+  var data = {
+    paypalAccount: {
+      correlationId: params.ba_token || params.token,
+      options: {
+        validate: options.flow === "vault" && !isTokenizationKey,
+      },
+    },
+  };
+
+  if (params.ba_token) {
+    data.paypalAccount.billingAgreementToken = params.ba_token;
+  } else {
+    data.paypalAccount.paymentToken = params.paymentId;
+    data.paypalAccount.payerId = params.PayerID;
+    data.paypalAccount.unilateral =
+      gatewayConfiguration.paypal.unvettedMerchant;
+
+    if (options.hasOwnProperty("intent")) {
+      data.paypalAccount.intent = options.intent;
+    }
+  }
+
+  return data;
+};
+
+PayPal.prototype._navigateFrameToAuth = function (options) {
+  var self = this;
+  var client = this._client;
+  var endpoint = "paypal_hermes/" + constants.FLOW_ENDPOINTS[options.flow];
+
+  return client
+    .request({
+      endpoint: endpoint,
+      method: "post",
+      data: this._formatPaymentResourceData(options),
+    })
+    .then(function (response) {
+      var redirectUrl;
+
+      if (options.flow === "checkout") {
+        redirectUrl = response.paymentResource.redirectUrl;
+      } else {
+        redirectUrl = response.agreementSetup.approvalUrl;
+      }
+
+      if (options.useraction === "commit") {
+        redirectUrl = querystring.queryify(redirectUrl, {
+          useraction: "commit",
+        });
+      }
+
+      if (window.popupBridge) {
+        analytics.sendEvent(client, "paypal.tokenization.opened-popupbridge");
+      }
+
+      self._frameService.redirect(redirectUrl);
+    })
+    .catch(function (err) {
+      var status = err.details && err.details.httpStatus;
+
+      self._frameService.close();
+      self._authorizationInProgress = false;
+
+      if (status === 422) {
+        return Promise.reject(
+          new BraintreeError({
+            type: errors.PAYPAL_INVALID_PAYMENT_OPTION.type,
+            code: errors.PAYPAL_INVALID_PAYMENT_OPTION.code,
+            message: errors.PAYPAL_INVALID_PAYMENT_OPTION.message,
+            details: {
+              originalError: err,
+            },
+          })
+        );
+      }
+
+      return Promise.reject(
+        convertToBraintreeError(err, {
+          type: errors.PAYPAL_FLOW_FAILED.type,
+          code: errors.PAYPAL_FLOW_FAILED.code,
+          message: errors.PAYPAL_FLOW_FAILED.message,
+        })
+      );
+    });
+};
+
+PayPal.prototype._formatPaymentResourceData = function (options) {
+  var key;
+  var gatewayConfiguration =
+    this._client.getConfiguration().gatewayConfiguration;
+  var serviceId = this._frameService._serviceId;
+  var paymentResource = {
+    returnUrl:
+      gatewayConfiguration.paypal.assetsUrl +
+      "/web/" +
+      VERSION +
+      "/html/redirect-frame" +
+      useMin(this._isDebug) +
+      ".html?channel=" +
+      serviceId,
+    cancelUrl:
+      gatewayConfiguration.paypal.assetsUrl +
+      "/web/" +
+      VERSION +
+      "/html/cancel-frame" +
+      useMin(this._isDebug) +
+      ".html?channel=" +
+      serviceId,
+    offerPaypalCredit: options.offerCredit === true,
+    offerPayLater: options.offerPayLater === true,
+    experienceProfile: {
+      brandName: options.displayName || gatewayConfiguration.paypal.displayName,
+      localeCode: options.locale,
+      noShipping: (!options.enableShippingAddress).toString(),
+      addressOverride: options.shippingAddressEditable === false,
+      landingPageType: options.landingPageType,
+    },
+  };
+
+  if (
+    window.popupBridge &&
+    typeof window.popupBridge.getReturnUrlPrefix === "function"
+  ) {
+    paymentResource.returnUrl =
+      window.popupBridge.getReturnUrlPrefix() + "return";
+    paymentResource.cancelUrl =
+      window.popupBridge.getReturnUrlPrefix() + "cancel";
+  }
+
+  if (options.flow === "checkout") {
+    paymentResource.amount = options.amount;
+    paymentResource.currencyIsoCode = options.currency;
+
+    if (options.hasOwnProperty("intent")) {
+      paymentResource.intent = options.intent;
+    }
+
+    for (key in options.shippingAddressOverride) {
+      if (options.shippingAddressOverride.hasOwnProperty(key)) {
+        paymentResource[key] = options.shippingAddressOverride[key];
+      }
+    }
+  } else {
+    paymentResource.shippingAddress = options.shippingAddressOverride;
+
+    if (options.billingAgreementDescription) {
+      paymentResource.description = options.billingAgreementDescription;
+    }
+  }
+
+  return paymentResource;
+};
+
+/**
+ * Closes the PayPal window if it is open.
+ * @public
+ * @example
+ * paypalInstance.closeWindow();
+ * @returns {void}
+ */
+PayPal.prototype.closeWindow = function () {
+  if (this._authorizationInProgress) {
+    analytics.sendEvent(this._client, "paypal.tokenize.closed.by-merchant");
+  }
+  this._frameService.close();
+};
+
+/**
+ * Focuses the PayPal window if it is open.
+ * @public
+ * @example
+ * paypalInstance.focusWindow();
+ * @returns {void}
+ */
+PayPal.prototype.focusWindow = function () {
+  this._frameService.focus();
+};
+
+/**
+ * Cleanly remove anything set up by {@link module:braintree-web/paypal.create|create}.
+ * @public
+ * @param {callback} [callback] Called on completion.
+ * @example
+ * paypalInstance.teardown();
+ * @example <caption>With callback</caption>
+ * paypalInstance.teardown(function () {
+ *   // teardown is complete
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+PayPal.prototype.teardown = wrapPromise(function () {
+  var self = this; // eslint-disable-line no-invalid-this
+
+  self._frameService.teardown();
+
+  convertMethodsToError(self, methods(PayPal.prototype));
+
+  analytics.sendEvent(self._client, "paypal.teardown-completed");
+
+  return Promise.resolve();
+});
+
+module.exports = PayPal;
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/paypal_index.js.html b/3.111.1/paypal_index.js.html new file mode 100644 index 00000000..a814ba6e --- /dev/null +++ b/3.111.1/paypal_index.js.html @@ -0,0 +1,273 @@ + + + + + + + + + + + paypal/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ paypal/index.js +

+ + + + + +
+
+
"use strict";
+/**
+ * @module braintree-web/paypal
+ * @description A component to integrate with PayPal.
+ * @deprecated Use the {@link PayPalCheckout|PayPal Checkout component} instead.
+ */
+
+var analytics = require("../lib/analytics");
+var basicComponentVerification = require("../lib/basic-component-verification");
+var createDeferredClient = require("../lib/create-deferred-client");
+var createAssetsUrl = require("../lib/create-assets-url");
+var BraintreeError = require("../lib/braintree-error");
+var errors = require("./shared/errors");
+var PayPal = require("./external/paypal");
+var VERSION = process.env.npm_package_version;
+var wrapPromise = require("@braintree/wrap-promise");
+
+/**
+ * @static
+ * @function create
+ * @param {object} options Creation options:
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {callback} callback The second argument, `data`, is the {@link PayPal} instance.
+ * @example
+ * // We recommend creating your PayPal button with button.js
+ * // For an example, see https://codepen.io/braintree/pen/LNKJWa
+ * var paypalButton = document.querySelector('.paypal-button');
+ *
+ * braintree.client.create({
+ *   authorization: CLIENT_AUTHORIZATION
+ * }, function (clientErr, clientInstance) {
+ *   if (clientErr) {
+ *     console.error('Error creating client:', clientErr);
+ *     return;
+ *   }
+ *
+ *   braintree.paypal.create({
+ *     client: clientInstance
+ *   }, function (paypalErr, paypalInstance) {
+ *     if (paypalErr) {
+ *       console.error('Error creating PayPal:', paypalErr);
+ *       return;
+ *     }
+ *
+ *     paypalButton.removeAttribute('disabled');
+ *
+ *     // When the button is clicked, attempt to tokenize.
+ *     paypalButton.addEventListener('click', function (event) {
+ *       // Because tokenization opens a popup, this has to be called as a result of
+ *       // customer action, like clicking a button. You cannot call this at any time.
+ *       paypalInstance.tokenize({
+ *         flow: 'vault'
+ *         // For more tokenization options, see the full PayPal tokenization documentation
+ *         // https://braintree.github.io/braintree-web/current/PayPal.html#tokenize
+ *       }, function (tokenizeErr, payload) {
+ *         if (tokenizeErr) {
+ *           if (tokenizeErr.type !== 'CUSTOMER') {
+ *             console.error('Error tokenizing:', tokenizeErr);
+ *           }
+ *           return;
+ *         }
+ *
+ *         // Tokenization succeeded
+ *         paypalButton.setAttribute('disabled', true);
+ *         console.log('Got a nonce! You should submit this to your server.');
+ *         console.log(payload.nonce);
+ *       });
+ *     }, false);
+ *   });
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+function create(options) {
+  var name = "PayPal";
+
+  return basicComponentVerification
+    .verify({
+      name: name,
+      client: options.client,
+      authorization: options.authorization,
+    })
+    .then(function () {
+      return createDeferredClient.create({
+        authorization: options.authorization,
+        client: options.client,
+        debug: options.debug,
+        assetsUrl: createAssetsUrl.create(options.authorization),
+        name: name,
+      });
+    })
+    .then(function (client) {
+      var pp;
+      var config = client.getConfiguration();
+
+      options.client = client;
+
+      if (config.gatewayConfiguration.paypalEnabled !== true) {
+        return Promise.reject(new BraintreeError(errors.PAYPAL_NOT_ENABLED));
+      }
+
+      analytics.sendEvent(options.client, "paypal.initialized");
+
+      pp = new PayPal(options);
+
+      return pp._initialize();
+    });
+}
+
+/**
+ * @static
+ * @function isSupported
+ * @description Returns true if PayPal [supports this browser](index.html#browser-support-webviews).
+ * @example
+ * if (braintree.paypal.isSupported()) {
+ *   // Add PayPal button to the page
+ * } else {
+ *   // Hide PayPal payment option
+ * }
+ * @returns {Boolean} Returns true if PayPal supports this browser.
+ */
+function isSupported() {
+  return true;
+}
+
+module.exports = {
+  create: wrapPromise(create),
+  isSupported: isSupported,
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/paypal_shared_errors.js.html b/3.111.1/paypal_shared_errors.js.html new file mode 100644 index 00000000..098cacbe --- /dev/null +++ b/3.111.1/paypal_shared_errors.js.html @@ -0,0 +1,204 @@ + + + + + + + + + + + paypal/shared/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ paypal/shared/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.PayPal - Creation Error Codes
+ * @description Errors that occur when [creating the PayPal component](./module-braintree-web_paypal.html#.create).
+ * @property {MERCHANT} PAYPAL_NOT_ENABLED Occurs when PayPal is not enabled on the Braintree control panel.
+ */
+
+/**
+ * @name BraintreeError.PayPal - tokenize Error Codes
+ * @description Errors that occur when using the [`tokenize` method](./PayPal.html#tokenize).
+ * @property {MERCHANT} PAYPAL_TOKENIZATION_REQUEST_ACTIVE Occurs when a tokenization request is already in progress.
+ * @property {MERCHANT} PAYPAL_FLOW_OPTION_REQUIRED Occurs when flow option is not provided.
+ * @property {NETWORK} PAYPAL_ACCOUNT_TOKENIZATION_FAILED Occurs when PayPal account could not be tokenized.
+ * @property {NETWORK} PAYPAL_FLOW_FAILED Occurs when PayPal flow could not be initiated.
+ * @property {MERCHANT} PAYPAL_POPUP_OPEN_FAILED Occurs when PayPal window could not be opened.
+ * @property {CUSTOMER} PAYPAL_POPUP_CLOSED Occurs when customer closes the PayPal window before completing the flow.
+ * @property {MERCHANT} PAYPAL_INVALID_PAYMENT_OPTION Occurs when an invalid payment option is passed.
+ */
+
+var BraintreeError = require("../../lib/braintree-error");
+
+module.exports = {
+  PAYPAL_NOT_ENABLED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYPAL_NOT_ENABLED",
+    message: "PayPal is not enabled for this merchant.",
+  },
+  PAYPAL_TOKENIZATION_REQUEST_ACTIVE: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYPAL_TOKENIZATION_REQUEST_ACTIVE",
+    message: "Another tokenization request is active.",
+  },
+  PAYPAL_ACCOUNT_TOKENIZATION_FAILED: {
+    type: BraintreeError.types.NETWORK,
+    code: "PAYPAL_ACCOUNT_TOKENIZATION_FAILED",
+    message: "Could not tokenize user's PayPal account.",
+  },
+  PAYPAL_FLOW_FAILED: {
+    type: BraintreeError.types.NETWORK,
+    code: "PAYPAL_FLOW_FAILED",
+    message: "Could not initialize PayPal flow.",
+  },
+  PAYPAL_FLOW_OPTION_REQUIRED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYPAL_FLOW_OPTION_REQUIRED",
+    message: "PayPal flow property is invalid or missing.",
+  },
+  PAYPAL_POPUP_OPEN_FAILED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYPAL_POPUP_OPEN_FAILED",
+    message:
+      "PayPal popup failed to open, make sure to tokenize in response to a user action.",
+  },
+  PAYPAL_POPUP_CLOSED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "PAYPAL_POPUP_CLOSED",
+    message: "Customer closed PayPal popup before authorizing.",
+  },
+  PAYPAL_INVALID_PAYMENT_OPTION: {
+    type: BraintreeError.types.MERCHANT,
+    code: "PAYPAL_INVALID_PAYMENT_OPTION",
+    message: "PayPal payment options are invalid.",
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/scripts/linenumber.js b/3.111.1/scripts/linenumber.js new file mode 100644 index 00000000..ff6c0693 --- /dev/null +++ b/3.111.1/scripts/linenumber.js @@ -0,0 +1,24 @@ +'use strict'; + +/* global document */ +(function () { + var lineId, lines, totalLines, anchorHash; + var source = document.getElementsByClassName('prettyprint source linenums'); + var i = 0; + var lineNumber = 0; + + if (source && source[0]) { + anchorHash = document.location.hash.substring(1); + lines = source[0].getElementsByTagName('li'); + totalLines = lines.length; + + for (; i < totalLines; i++) { + lineNumber++; + lineId = 'line' + lineNumber; + lines[i].id = lineId; + if (lineId === anchorHash) { + lines[i].className += ' selected'; + } + } + } +})(); diff --git a/3.111.1/scripts/pagelocation.js b/3.111.1/scripts/pagelocation.js new file mode 100644 index 00000000..e1383680 --- /dev/null +++ b/3.111.1/scripts/pagelocation.js @@ -0,0 +1,89 @@ +'use strict'; + +$(document).ready(function () { + var currentSectionNav, target; + + // If an anchor hash is in the URL highlight the menu item + highlightActiveHash(); + // If a specific page section is in the URL highlight the menu item + highlightActiveSection(); + + // If a specific page section is in the URL scroll that section up to the top + currentSectionNav = $('#' + getCurrentSectionName() + '-nav'); + + if (currentSectionNav.position()) { + $('nav').scrollTop(currentSectionNav.position().top); + } + + // function to scroll to anchor when clicking an anchor linl + $('a[href*="#"]:not([href="#"])').click(function () { + /* eslint-disable no-invalid-this */ + if (location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') && location.hostname === this.hostname) { + target = $(this.hash); + target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); + if (target.length) { + $('html, body').animate({ + scrollTop: target.offset().top + }, 1000); + } + } + /* eslint-enable no-invalid-this */ + }); +}); + +// If a new anchor section is selected, change the hightlighted menu item +$(window).bind('hashchange', function (event) { + highlightActiveHash(event); +}); + +function highlightActiveHash(event) { + var oldUrl, oldSubSectionElement; + + // check for and remove old hash active state + if (event && event.originalEvent.oldURL) { + oldUrl = event.originalEvent.oldURL; + + if (oldUrl.indexOf('#') > -1) { + oldSubSectionElement = $('#' + getCurrentSectionName() + '-' + oldUrl.substring(oldUrl.indexOf('#') + 1) + '-nav'); + + if (oldSubSectionElement) { + oldSubSectionElement.removeClass('active'); + } + } + } + + if (getCurrentHashName()) { + $('#' + getCurrentSectionName() + '-' + getCurrentHashName() + '-nav').addClass('active'); + } +} + +function highlightActiveSection() { + var pageId = getCurrentSectionName(); + + $('#' + pageId + '-nav').addClass('active'); +} + +function getCurrentSectionName() { + var path = window.location.pathname; + var pageUrl = path.split('/').pop(); + + var sectionName = pageUrl.substring(0, pageUrl.indexOf('.')); + + // remove the wodr module- if its in the url + sectionName = sectionName.replace('module-', ''); + + return sectionName; +} + +function getCurrentHashName() { + var pageSubSectionId; + var pageSubSectionHash = window.location.hash; + + if (pageSubSectionHash) { + pageSubSectionId = pageSubSectionHash.substring(1).replace('.', ''); + + return pageSubSectionId; + } + + return false; +} diff --git a/3.111.1/sepa_external_sepa.js.html b/3.111.1/sepa_external_sepa.js.html new file mode 100644 index 00000000..f88196dd --- /dev/null +++ b/3.111.1/sepa_external_sepa.js.html @@ -0,0 +1,290 @@ + + + + + + + + + + + sepa/external/sepa.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ sepa/external/sepa.js +

+ + + + + +
+
+
"use strict";
+
+var wrapPromise = require("@braintree/wrap-promise");
+var BraintreeError = require("../../lib/braintree-error");
+var sepaErrors = require("../shared/errors");
+var constants = require("../shared/constants");
+var mandates = require("./mandate");
+var hasMissingOption = require("../shared/has-missing-option");
+var analytics = require("../../lib/analytics");
+var VERSION = process.env.npm_package_version;
+var assign = require("../../lib/assign").assign;
+
+/**
+ * @class
+ * @param {object} options see {@link module:braintree-web/sepa.create|sepa.create}
+ * @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/sepa.create|braintree-web.sepa.create} instead.</strong>
+ * @classdesc This class represents a SEPA component produced by {@link module:braintree-web/sepa.create|braintree-web.sepa.create}. Instances provide methods for tokenizing SEPA payments.
+ */
+function SEPA(options) {
+  var getConfiguration = options.client.getConfiguration();
+
+  this._client = options.client;
+  this._assetsUrl =
+    getConfiguration.gatewayConfiguration.assetsUrl + "/web/" + VERSION;
+  this._isDebug = getConfiguration.isDebug;
+  if (options.redirectUrl) {
+    this._returnUrl = options.redirectUrl;
+    this._cancelUrl = options.redirectUrl + "?cancel=1";
+    this._isRedirectFlow = true;
+  } else {
+    this._returnUrl = this._assetsUrl + "/html/redirect-frame.html?success=1";
+    this._cancelUrl = this._assetsUrl + "/html/redirect-frame.html?cancel=1";
+  }
+  if (options.tokenizePayload) {
+    this.tokenizePayload = options.tokenizePayload;
+  }
+
+  analytics.sendEvent(this._client, "sepa.component.initialized");
+}
+
+/**
+ * SEPA tokenize payload.
+ * @typedef SEPA~tokenizePayload
+ * @property {string} nonce The payment nonce.
+ * @property {string} ibanLastFour The last four digits of the customer's IBAN.
+ * @property {string} mandateType The specified mandateType used.
+ * @property {string} customerId The provided customer id.
+ */
+
+/**
+ * @public
+ * @param {object} options All options for intiating the SEPA payment flow.
+ * @param {string} [options.accountHolderName] The account holder name.
+ * @param {string} [options.customerId] The customer's id.
+ * @param {string} [options.iban] The customer's International Bank Account Number.
+ * @param {string} [options.mandateType] Specify ONE_OFF or RECURRENT payment.
+ * @param {string} [options.countryCode] The customer's country code.
+ * @param {string} [options.merchantAccountId] The merchant's account id.
+ * @param {callback} [callback] The first argument is an error object, where the second is a {@link SEPA~tokenizePayload|tokenizePayload}
+ * @returns {(Promise<tokenizePayload|error>)} Returns a promise if no callback is provided.
+ *
+ * @example
+ * button.addEventListener('click', function () {
+ *   var tokenizeInputs = {
+ *     accountHolderName: "some-accnt-holder-name",
+ *     customerId: "a-customer-id",
+ *     iban: "a-full-iban",
+ *     mandateType: "ONE_OFF",
+ *     countryCode: "LI",
+ *     merchantAccountId: "a-merchant-account-id"
+ *   }
+ *   sepaInstance.tokenize(tokenizeInputs).then(function (payload) {
+ *      // Submit payload.nonce to your server
+ *   }).catch(function(tokenizationErr) {
+ *     // Handle errors in the flow
+ *   })
+ * })
+ */
+SEPA.prototype.tokenize = function (options) {
+  var self = this;
+  var popupPromise;
+  var createMandateOptions = assign(
+    { cancelUrl: self._cancelUrl, returnUrl: self._returnUrl },
+    options
+  );
+
+  if (!options || hasMissingOption(options, constants.REQUIRED_OPTIONS)) {
+    analytics.sendEvent(self._client, "sepa.input-validation.missing-options");
+
+    return Promise.reject(
+      new BraintreeError(sepaErrors.SEPA_TOKENIZE_MISSING_REQUIRED_OPTION)
+    );
+  }
+
+  if (!constants.MANDATE_TYPE_ENUM.includes(options.mandateType)) {
+    analytics.sendEvent(self._client, "sepa.input-validation.invalid-mandate");
+
+    return Promise.reject(
+      new BraintreeError(sepaErrors.SEPA_INVALID_MANDATE_TYPE)
+    );
+  }
+
+  popupPromise = mandates
+    .createMandate(self._client, createMandateOptions)
+    .then(function (mandateResponse) {
+      analytics.sendEvent(self._client, "sepa.create-mandate.success");
+
+      if (self._isRedirectFlow) {
+        return mandates.redirectPage(mandateResponse.approvalUrl);
+      }
+
+      options.last4 = mandateResponse.last4;
+      options.bankReferenceToken = mandateResponse.bankReferenceToken;
+
+      return mandates.openPopup(self._client, {
+        approvalUrl: mandateResponse.approvalUrl,
+        assetsUrl: self._assetsUrl,
+      });
+    });
+
+  // Must be outside of .then() to return from top-level function
+  if (self._isRedirectFlow) {
+    return Promise.resolve();
+  }
+
+  // At this point, we know the promise came from the popup flow
+  return popupPromise
+    .then(function () {
+      analytics.sendEvent(self._client, "sepa.mandate.approved");
+
+      return mandates.handleApproval(self._client, {
+        bankReferenceToken: options.bankReferenceToken,
+        last4: options.last4,
+        customerId: options.customerId,
+        mandateType: options.mandateType,
+        merchantAccountId: options.merchantAccountId,
+      });
+    })
+    .then(function (approval) {
+      analytics.sendEvent(self._client, "sepa.tokenization.success");
+
+      return Promise.resolve(approval);
+    })
+    .catch(function (err) {
+      analytics.sendEvent(self._client, "sepa." + err.details + ".failed");
+
+      return Promise.reject(err);
+    });
+};
+
+module.exports = wrapPromise.wrapPrototype(SEPA);
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/sepa_index.js.html b/3.111.1/sepa_index.js.html new file mode 100644 index 00000000..093f37e9 --- /dev/null +++ b/3.111.1/sepa_index.js.html @@ -0,0 +1,245 @@ + + + + + + + + + + + sepa/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ sepa/index.js +

+ + + + + +
+
+
"use strict";
+/** @module braintree-web/sepa */
+
+var analytics = require("../lib/analytics");
+var SEPA = require("./external/sepa");
+var createAssetsUrl = require("../lib/create-assets-url");
+var createDeferredClient = require("../lib/create-deferred-client");
+var basicComponentVerification = require("../lib/basic-component-verification");
+var wrapPromise = require("@braintree/wrap-promise");
+var VERSION = process.env.npm_package_version;
+var parse = require("../lib/querystring").parse;
+var assign = require("../lib/assign").assign;
+var mandate = require("./external/mandate");
+
+/**
+ * @static
+ * @function create
+ * @param {object} options Creation options:
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {boolean} [options.debug] A debug flag.
+ * @param {string} [options.redirectUrl] When provided, triggers full page redirect flow instead of popup flow.
+ * @param {callback} [callback] When provided, will be used instead of a promise. First argument is an error object, where the second is an instance of {@link SEPA|SEPA}.
+ * @returns {Promise<void|error>} Returns the SEPA instance.
+ * @example
+ * braintree.sepa.create({
+ *   client: clientInstance
+ * }).then(function (sepaInstance) {
+ *   // sepaInstance is ready to be used.
+ * }).catch(function (createErr) {
+ *   console.error('Error creating SEPA instance', createErr);
+ * });
+ * @example <caption>Creating a SEPA component</caption>
+ * braintree.sepa.create({
+ *   client: clientInstance,
+ * }).then(function (sepaInstance) {
+ *   // sepaInstance is ready to be used.
+ * }).catch(function (createErr) {
+ *   console.error('Error creating SEPA instance', createErr);
+ * });
+ */
+
+function create(options) {
+  var name = "SEPA";
+  var params = parse(window.location.href);
+
+  return basicComponentVerification
+    .verify({
+      name: name,
+      client: options.client,
+      authorization: options.authorization,
+    })
+    .then(function () {
+      return createDeferredClient.create({
+        authorization: options.authorization,
+        client: options.client,
+        debug: options.debug,
+        assetsUrl: createAssetsUrl.create(options.authorization),
+        name: name,
+      });
+    })
+    .then(function (client) {
+      options.client = client;
+
+      analytics.sendEvent(client, "sepa.client.initialized");
+
+      return new SEPA(options);
+    })
+    .then(function (sepaInstance) {
+      // This cart_id is actually a V2 orderId
+      var redirectComplete =
+        params.success && params.success === "true" && params.cart_id;
+
+      if (redirectComplete) {
+        options = assign(options, params);
+
+        // Pick up redirect flow where it left off
+        return mandate
+          .handleApprovalForFullPageRedirect(options.client, options)
+          .then(function (payload) {
+            sepaInstance.tokenizePayload = payload;
+
+            return sepaInstance;
+          })
+          .catch(function (err) {
+            console.error("Problem while finishing tokenizing: ", err);
+          });
+      } else if (params.cancel) {
+        analytics.sendEvent(
+          options.client,
+          "sepa.redirect.customer-canceled.failed"
+        );
+      }
+
+      return sepaInstance;
+    });
+}
+
+module.exports = {
+  create: wrapPromise(create),
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/sepa_shared_errors.js.html b/3.111.1/sepa_shared_errors.js.html new file mode 100644 index 00000000..f219cd50 --- /dev/null +++ b/3.111.1/sepa_shared_errors.js.html @@ -0,0 +1,191 @@ + + + + + + + + + + + sepa/shared/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ sepa/shared/errors.js +

+ + + + + +
+
+
"use strict";
+
+var BraintreeError = require("../../lib/braintree-error");
+
+/**
+ * @name BraintreeError.SEPA - tokenize Error Codes
+ * @description Errors that occur when using the {@link module:braintree-web/sepa.tokenize|sepa.tokenize} method.
+ * @property {MERCHANT} SEPA_CREATE_MANDATE_FAILED Occurs when there was an issue creating a mandate. This can occur if the request fails, or if the merchant does not have SEPA enabled.
+ * @property {CUSTOMER} SEPA_CUSTOMER_CANCELED Occurs when the customer has canceled the SEPA authorization process. This can be within the mandate approval popup, or by canceling the popup itself.
+ * @property {MERCHANT} SEPA_INVALID_MANDATE_TYPE Occurs when an invalid mandate type is provided.
+ * @property {UNKNOWN} SEPA_TOKENIZATION_FAILED Occurs when tokenization fails during the mandate approval process for unknown reasons.
+ * @property {MERCHANT} SEPA_TOKENIZE_MISSING_REQUIRED_OPTION Occurs when there are required input options not provided.
+ * @property {UNKNOWN} SEPA_TRANSACTION_FAILED Occurs when final tokenization fails.
+ */
+
+// Those with a "details" property are used in specific locations and this prop serves to identify where in the imlpementation the error originates.
+module.exports = {
+  SEPA_CREATE_MANDATE_FAILED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "SEPA_CREATE_MANDATE_FAILED",
+    message: "SEPA create mandate failed.",
+    details: "create-mandate",
+  },
+  SEPA_CUSTOMER_CANCELED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "SEPA_CUSTOMER_CANCELED",
+    message: "User canceled SEPA authorization",
+    details: "customer-canceled",
+  },
+  SEPA_INVALID_MANDATE_TYPE: {
+    type: BraintreeError.types.MERCHANT,
+    code: "SEPA_INVALID_MANDATE_TYPE",
+    message: "SEPA mandate type is invalid",
+  },
+  SEPA_TOKENIZATION_FAILED: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "SEPA_TOKENIZATION_FAILED",
+    message: "SEPA encountered a problem",
+    details: "open-popup",
+  },
+  SEPA_TOKENIZE_MISSING_REQUIRED_OPTION: {
+    type: BraintreeError.types.MERCHANT,
+    code: "SEPA_TOKENIZE_MISSING_REQUIRED_OPTION",
+    message: "Missing required option for tokenize.",
+  },
+  SEPA_TRANSACTION_FAILED: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "SEPA_TRANSACTION_FAILED",
+    message: "SEPA transaction failed",
+    details: "handle-approval",
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/styles/jsdoc-default.css b/3.111.1/styles/jsdoc-default.css new file mode 100644 index 00000000..f2bc6a9d --- /dev/null +++ b/3.111.1/styles/jsdoc-default.css @@ -0,0 +1,957 @@ +@font-face { + font-family: "Avenir Next W01"; + font-style: normal; + font-weight: 600; + src: url("https://fast.fonts.net/dv2/14/14c73713-e4df-4dba-933b-057feeac8dd1.woff2?d44f19a684109620e484167ba790e8180fd9e29df91d80ce3d096f014db863074e1ea706cf5ed4e1c042492e76df291ce1d24ec684d3d9da9684f55406b9f22bce02f0f30f556681593dafea074d7bd44e28a680d083ccfd44ed4f8a3087a20c56147c11f917ed1dbd85c4a18cf38da25e6ac78f008f472262304d50e7e0cb7541ef1642c676db6e4bde4924846f5daf486fbde9335e98f6a20f6664bc4525253d1d4fca42cf1c490483c8daf0237f6a0fd292563417ad80ca3e69321417747bdc6f0969f34b2a0401b5e2b9a4dfd5b06d9710850900c66b34870aef&projectId=f750d5c7-baa2-4767-afd7-45484f47fe17") format('woff2'); +} + +@font-face { + font-family: "Avenir Next W01"; + font-style: normal; + font-weight: 500; + src: url("https://fast.fonts.net/dv2/14/627fbb5a-3bae-4cd9-b617-2f923e29d55e.woff2?d44f19a684109620e484167ba790e8180fd9e29df91d80ce3d096f014db863074e1ea706cf5ed4e1c042492e76df291ce1d24ec684d3d9da9684f55406b9f22bce02f0f30f556681593dafea074d7bd44e28a680d083ccfd44ed4f8a3087a20c56147c11f917ed1dbd85c4a18cf38da25e6ac78f008f472262304d50e7e0cb7541ef1642c676db6e4bde4924846f5daf486fbde9335e98f6a20f6664bc4525253d1d4fca42cf1c490483c8daf0237f6a0fd292563417ad80ca3e69321417747bdc6f0969f34b2a0401b5e2b9a4dfd5b06d9710850900c66b34870aef&projectId=f750d5c7-baa2-4767-afd7-45484f47fe17") format('woff2'); +} + +@font-face { + font-family: "Avenir Next W01"; + font-style: normal; + font-weight: 400; + src: url("https://fast.fonts.net/dv2/14/2cd55546-ec00-4af9-aeca-4a3cd186da53.woff2?d44f19a684109620e484167ba790e8180fd9e29df91d80ce3d096f014db863074e1ea706cf5ed4e1c042492e76df291ce1d24ec684d3d9da9684f55406b9f22bce02f0f30f556681593dafea074d7bd44e28a680d083ccfd44ed4f8a3087a20c56147c11f917ed1dbd85c4a18cf38da25e6ac78f008f472262304d50e7e0cb7541ef1642c676db6e4bde4924846f5daf486fbde9335e98f6a20f6664bc4525253d1d4fca42cf1c490483c8daf0237f6a0fd292563417ad80ca3e69321417747bdc6f0969f34b2a0401b5e2b9a4dfd5b06d9710850900c66b34870aef&projectId=f750d5c7-baa2-4767-afd7-45484f47fe17") format('woff2'); +} + +@font-face { + font-family: 'bt_mono'; + font-style: normal; + font-weight: 400; + src: url('https://assets.braintreegateway.com/fonts/bt_mono_regular-webfont.eot'); + src: url('https://assets.braintreegateway.com/fonts/bt_mono_regular-webfont.woff2') format('woff2'), url('https://assets.braintreegateway.com/fonts/bt_mono_regular-webfont.woff') format('woff'), url('https://assets.braintreegateway.com/fonts/bt_mono_regular-webfont.ttf') format('truetype'), url('https://assets.braintreegateway.com/fonts/bt_mono_regular-webfont.svg#bt_mono_reqular-webfont') format('svg'); +} + +@font-face { + font-family: 'bt_mono'; + font-style: normal; + font-weight: 500; + src: url('https://assets.braintreegateway.com/fonts/bt_mono_medium-webfont.eot'); + src: url('https://assets.braintreegateway.com/fonts/bt_mono_medium-webfont.woff2') format('woff2'), url('https://assets.braintreegateway.com/fonts/bt_mono_medium-webfont.woff') format('woff'), url('https://assets.braintreegateway.com/fonts/bt_mono_medium-webfont.ttf') format('truetype'), url('https://assets.braintreegateway.com/fonts/bt_mono_medium-webfont.svg#bt_mono_medium-webfont') format('svg'); +} + +@font-face { + font-family: 'bt_mono'; + font-style: normal; + font-weight: 600; + src: url('https://assets.braintreegateway.com/fonts/bt_mono_bold-webfont.eot'); + src: url('https://assets.braintreegateway.com/fonts/bt_mono_bold-webfont.woff2') format('woff2'), url('https://assets.braintreegateway.com/fonts/bt_mono_bold-webfont.woff') format('woff'), url('https://assets.braintreegateway.com/fonts/bt_mono_bold-webfont.ttf') format('truetype'), url('https://assets.braintreegateway.com/fonts/bt_mono_bold-webfont.svg#bt_mono_bold-webfont') format('svg'); +} + +@font-face { + font-family: 'bt_mono'; + font-style: normal; + font-weight: 900; + src: url('https://assets.braintreegateway.com/fonts/bt_mono_heavy-webfont.eot'); + src: url('https://assets.braintreegateway.com/fonts/bt_mono_heavy-webfont.woff2') format('woff2'), url('https://assets.braintreegateway.com/fonts/bt_mono_heavy-webfont.woff') format('woff'), url('https://assets.braintreegateway.com/fonts/bt_mono_heavy-webfont.ttf') format('truetype'), url('https://assets.braintreegateway.com/fonts/bt_mono_heavy-webfont.svg#bt_mono_heavy-webfont') format('svg'); +} + +* { + box-sizing: border-box +} + +html, body { + height: 100%; + width: 100%; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + color: #3e3c42; + text-rendering: optimizeLegibility; + margin: 0; +} + +body { + color: #3e3c42; + background-color: #f3f3f3; + width: 100%; + font: 16px/1.875 "Avenir Next W01", "Avenir Next", "Helvetica Neue", Helvetica, sans-serif; + font-size: 16px; + line-height: 160%; +} + +a, a:active { + color: #0095dd; + text-decoration: none; +} + +a:hover { + text-decoration: underline +} + +p, ul, ol, blockquote { + margin-bottom: 1em; +} + +p { + max-width: 800px; +} + +h1, h2, h3, h4, h5, h6 { + color: #706d77; + font-weight: 500; + margin: 0; + line-height: 1; +} + +h1 { + color: #4b484f; + font-weight: 500; + font-size: 40px; + display: block; +} + +h1 span { + color: #999; + font-size: 32px; + display: block; + line-height: 1.5; +} + +h1.page-title { + border-bottom: 1px dashed #ccc; + margin-bottom: 20px; + padding-bottom: 30px; +} + +h2 { + font-size: 30px; + margin: 1.5em 0 0; +} + +h3 { + font-size: 20px; + margin: 1.5em 0 0; + text-transform: uppercase; +} + +h3.reference-title { + display: block; + font-weight: 400; + margin-top: 2em; + max-width: 200px; +} + +h3.reference-title small { + display: inline-block; + color: #0095dd; + margin-left: 5px; + font-weight: 500; +} + +h3.subsection-title { + border-bottom: 1px solid #ececec; + padding-bottom: 20px; + margin-top: 3em; + margin-bottom: 1em; +} + +h4 { + font-size: 16px; + margin: 1em 0 0; + font-weight: bold; +} + +h4.name { + font-size: 20px; + margin-top: 0; + font-weight: 500; +} + +h5 { + margin: 2em 0 0.5em 0; + font-size: 14px; + font-weight: 500; + text-transform: uppercase; +} + +.container-overview .subsection-title { + font-size: 14px; + text-transform: uppercase; + margin: 8px 0 15px 0; + font-weight: bold; + color: #4D4E53; + padding-top: 10px; +} + +h6 { + font-size: 100%; + letter-spacing: -0.01em; + margin: 6px 0 3px 0; + font-style: italic; + text-transform: uppercase; + font-weight: 500; +} + +tt, code, kbd, samp { + font-family: "Source Code Pro", monospace; + background: #f4f4f4; + padding: 1px 5px; + border-radius: 5px; +} + +.class-description { + margin-bottom: 1em; + margin-top: 1em; + padding: 10px 20px; + background-color: rgba(26, 159, 224, 0.1); +} + +.class-description:empty { + margin: 0 +} + +#main { + background-color: white; + float: right; + min-width: 360px; + width: calc(100% - 300px); + padding: 30px; + z-index: 100; +} + +header { + display: block; + max-width: 1400px; +} + +section { + display: block; + max-width: 1400px; + background-color: #fff; +} + +.variation { + display: none +} + +.signature-attributes { + font-size: 60%; + color: #aaa; + font-style: italic; + font-weight: lighter; +} + +.rule { + width: 100%; + margin-top: 20px; + display: block; + border-top: 1px solid #ccc; +} + +ul { + list-style-type: none; + padding-left: 0; +} + +ul li a { + font-weight: 500; +} + +ul ul { + padding-top: 5px; +} + +ul li ul { + padding-left: 20px; +} + +ul li ul li a { + font-weight: normal; +} + +nav { + float: left; + display: block; + width: 300px; + background: #f7f7f7; + overflow-x: visible; + overflow-y: auto; + height: 100%; + padding: 0px 30px 100px 30px; + height: 100%; + position: fixed; + transition: left 0.2s; + z-index: 998; + margin-top: 0px; + top: 43px; +} + +.navicon-button { + display: inline-block; + position: fixed; + bottom: 1.5em; + right: 1.5em; + z-index: 2; +} + +nav h3 { + font-size: 13px; + text-transform: uppercase; + letter-spacing: 1px; + font-weight: bold; + line-height: 24px; + margin: 40px 0 10px 0; + padding: 0; +} + +nav ul { + font-size: 100%; + line-height: 17px; + padding: 0; + margin: 0; + list-style-type: none; + border: none; + padding-left: 0; +} + +nav ul a { + font-size: 16px; +} + +nav ul a, nav ul a:active { + display: block; +} + +nav ul a:hover, nav ul a:active { + color: hsl(200, 100%, 43%); + text-decoration: none; +} + +nav>ul { + padding: 0 10px; +} + +nav>ul li:first-child { + padding-top: 0; +} + +nav ul li ul { + padding-left: 0; +} + +nav>ul>li { + border-bottom: 1px solid #e2e2e2; + padding: 10px 0 20px 0; +} + +nav>ul>li.active ul { + border-left: 3px solid #0095dd; + padding-left: 15px; +} + +nav>ul>li.active ul li.active a { + font-weight: bold; +} + +nav>ul>li.active a { + color: #0095dd; +} + +nav>ul>li>a { + color: #706d77; + padding: 20px 0; + font-size: 18px; +} + +nav ul ul { + margin-bottom: 10px padding-left: 0; +} + +nav ul ul a { + color: #5f5c63; +} + +nav ul ul a, nav ul ul a:active { + font-family: 'bt_mono', monospace; + font-size: 14px; + padding-left: 20px; + padding-top: 3px; + padding-bottom: 9px; +} + +nav h2 { + font-size: 12px; + margin: 0; + padding: 0; +} + +nav>h2>a { + color: hsl(202, 71%, 50%); + border-bottom: 1px solid hsl(202, 71%, 50%); + padding-bottom: 5px; +} + +nav>h2>a:hover { + font-weight: 500; + text-decoration: none; +} + +footer { + background-color: #fff; + color: hsl(0, 0%, 28%); + margin-left: 300px; + display: block; + font-style: italic; + font-size: 12px; + padding: 30px; + text-align: center; +} + +.ancestors { + color: #999; +} + +.ancestors a { + color: #999 !important; + text-decoration: none; +} + +.clear { + clear: both; +} + +.important { + font-weight: bold; + color: #950B02; +} + +.yes-def { + text-indent: -1000px; +} + +.type-signature { + color: #aaa; +} + +.name, .signature { + font-family: 'bt_mono', monospace; + word-wrap: break-word; +} + +.details { + margin-top: 14px; + font-size: 13px; + text-align: right; + background: #ffffff; + /* Old browsers */ + background: -moz-linear-gradient(left, #ffffff 0%, #fafafa 100%); + /* FF3.6-15 */ + background: -webkit-linear-gradient(left, #ffffff 0%, #fafafa 100%); + /* Chrome10-25,Safari5.1-6 */ + background: linear-gradient(to right, #ffffff 0%, #fafafa 100%); + /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ + filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#fafafa', GradientType=1); + padding-right: 5px; +} + +.details dt { + display: inline-block; +} + +.details dd { + display: inline-block; + margin: 0; +} + +.details dd a { + font-style: italic; + font-weight: normal; + line-height: 1; +} + +.details ul { + margin: 0 +} + +.details ul { + list-style-type: none +} + +.details li {} + +.details pre.prettyprint { + margin: 0 +} + +.details .object-value { + padding-top: 0 +} + +.description { + margin-bottom: 1em; + margin-top: 1em; +} + +.code-caption { + font-style: italic; + margin: 0; + font-size: 16px; + color: #545454; +} + +.prettyprint { + font-size: 13px; + border: 1px solid #ddd; + border-radius: 3px; + overflow: auto; + background-color: #fbfbfb; +} + +.prettyprint.source { + width: inherit; +} + +.prettyprint code { + font-size: 100%; + line-height: 18px; + display: block; + margin: 0 30px; + background-color: #fbfbfb; + color: #4D4E53; +} + +.prettyprint>code { + padding: 30px 15px; +} + +.prettyprint .linenums code { + padding: 0 15px; +} + +.prettyprint .linenums li:first-of-type code { + padding-top: 15px; +} + +.prettyprint code span.line { + display: inline-block; +} + +.prettyprint.linenums { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.prettyprint.linenums ol { + padding-left: 0 +} + +.prettyprint.linenums li { + border-left: 3px #ddd solid +} + +.prettyprint.linenums li.selected, .prettyprint.linenums li.selected * { + background-color: lightyellow +} + +.prettyprint.linenums li * { + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; +} + +.readme .prettyprint { + max-width: 800px; +} + +.params, .props { + border-spacing: 0; + border: 1px solid #ddd; + border-radius: 3px; + width: 100%; + font-size: 14px; +} + +.params .name, .props .name, .name code { + color: #4D4E53; + font-family: 'bt_mono', monospace; + font-size: 100%; +} + +.params td, .params th, .props td, .props th { + margin: 0px; + text-align: left; + vertical-align: top; + padding: 10px; + display: table-cell; +} + +.params td { + border-top: 1px solid #eee; +} + +.params thead tr, .props thead tr { + background-color: #fff; + font-weight: bold; +} + +.params .params thead tr, .props .props thead tr { + background-color: #fff; + font-weight: bold; +} + +.params td.description>p:first-child, .props td.description>p:first-child { + margin-top: 0; + padding-top: 0; +} + +.params td.description>p:last-child, .props td.description>p:last-child { + margin-bottom: 0; + padding-bottom: 0; +} + +dl.param-type { + margin-top: 5px; +} + +.param-type dt, .param-type dd { + display: inline-block +} + +.param-type dd { + font-family: Consolas, Monaco, 'Andale Mono', monospace +} + +.disabled { + color: #454545 +} + + +/* tag source style */ + +.tag-deprecated { + padding-right: 5px; +} + +.tag-source { + border-bottom: 1px solid rgba(28, 160, 224, 0.35); +} + +.tag-source:first-child { + border-bottom: 1px solid rgba(28, 160, 224, 1); +} + + +/* navicon button */ + +.navicon-button { + position: relative; + transition: 0.25s; + cursor: pointer; + user-select: none; + opacity: .8; + background-color: white; + border-radius: 100%; + width: 50px; + height: 50px; + -webkit-box-shadow: 0px 2px 9px 0px rgba(0, 0, 0, 0.31); + -moz-box-shadow: 0px 2px 9px 0px rgba(0, 0, 0, 0.31); + box-shadow: 0px 2px 9px 0px rgba(0, 0, 0, 0.31); +} + +.navicon-button .navicon:before, .navicon-button .navicon:after { + transition: 0.25s; +} + +.navicon-button:hover { + transition: 0.5s; + opacity: 1; +} + +.navicon-button:hover .navicon:before, .navicon-button:hover .navicon:after { + transition: 0.25s; +} + +.navicon-button:hover .navicon:before { + top: .425rem; +} + +.navicon-button:hover .navicon:after { + top: -.425rem; +} + + +/* navicon */ + +.navicon { + position: relative; + width: 1.5em; + height: .195rem; + background: #000; + top: calc(50% - .09rem); + left: calc(50% - .75rem); + transition: 0.3s; + border-radius: 5px; +} + +.navicon:before, .navicon:after { + display: block; + content: ""; + height: .195rem; + width: 1.5rem; + background: #000; + position: absolute; + z-index: -1; + transition: 0.3s 0.25s; +} + +.navicon:before { + top: 0.425rem; + height: .195rem; + border-radius: 5px; +} + +.navicon:after { + top: -0.425rem; + border-radius: 5px; +} + + +/* open */ + +.nav-trigger:checked+label:not(.steps) .navicon:before, .nav-trigger:checked+label:not(.steps) .navicon:after { + top: 0 !important; +} + +.nav-trigger:checked+label .navicon:before, .nav-trigger:checked+label .navicon:after { + transition: 0.5s; +} + + +/* Minus */ + +.nav-trigger:checked+label { + transform: scale(0.75); +} + + +/* × and + */ + +.nav-trigger:checked+label.plus .navicon, .nav-trigger:checked+label.x .navicon { + background: transparent; +} + +.nav-trigger:checked+label.plus .navicon:before, .nav-trigger:checked+label.x .navicon:before { + transform: rotate(-45deg); + background: #000; +} + +.nav-trigger:checked+label.plus .navicon:after, .nav-trigger:checked+label.x .navicon:after { + transform: rotate(45deg); + background: #000; +} + +.nav-trigger:checked+label.plus { + transform: scale(0.75) rotate(45deg); +} + +.nav-trigger:checked~nav { + left: 0 !important; +} + +.nav-trigger:checked~.overlay { + display: block; +} + +.nav-trigger { + position: fixed; + top: 0; + clip: rect(0, 0, 0, 0); +} + +.overlay { + display: none; + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + width: 100%; + height: 100%; + background: hsla(0, 0%, 0%, 0.5); + z-index: 1; +} + +table { + border-collapse: separate; + ; + display: block; + overflow-x: auto; + /*table-layout:fixed;*/ +} + +table tbody td { + border-top: 1px solid hsl(207, 10%, 86%); + border-right: 1px solid #eee; + padding: 5px; + /*word-wrap: break-word;*/ +} + +td table.params, td table.props { + border: 0; +} + +@media only screen and (min-width: 320px) and (max-width: 680px) { + body { + overflow-x: hidden; + } + #main { + padding: 30px 30px; + width: 100%; + min-width: 360px; + } + nav { + background: #FFF; + width: 300px; + height: 100%; + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: -300px; + z-index: 3; + padding: 0 10px; + transition: left 0.2s; + margin-top: 0; + } + .navicon-button { + display: inline-block; + position: fixed; + bottom: 1.5em; + right: 20px; + z-index: 1000; + } + .top-nav-wrapper { + display: none; + } + #main h1.page-title { + margin: 0.5em 0; + } + footer { + margin-left: 0; + margin-bottom: 30px; + } +} + +.top-nav-wrapper { + background-color: #ececec; + position: fixed; + top: 0px; + left: 0px; + padding: 10px 10px 0 10px; + z-index: 999; + width: 300px; +} + +.top-nav-wrapper ul { + margin: 0; +} + +.top-nav-wrapper ul li { + display: inline-block; + padding: 0 10px; + vertical-align: top; +} + +.top-nav-wrapper ul li.active { + border-bottom: 2px solid rgba(28, 160, 224, 1); +} + +.search-wrapper { + display: inline-block; + position: relative; +} + +.search-wrapper svg { + position: absolute; + left: 0px; +} + +input.search-input { + background: transparent; + box-shadow: 0; + border: 0; + border-bottom: 1px solid #c7c7c7; + padding: 7px 15px 12px 35px; + margin: 0 auto; +} + + +/* Smooth outline with box-shadow: */ + +input.search-input:focus { + border-bottom: 2px solid rgba(28, 160, 224, 1); + outline: none; +} + + +/* Hightlight JS Paradiso Light Theme */ + +.hljs-comment, .hljs-quote { + color: #776e71 +} + +.hljs-variable, .hljs-template-variable, .hljs-tag, .hljs-name, .hljs-selector-id, .hljs-selector-class, .hljs-regexp, .hljs-link, .hljs-meta { + color: #ef6155 +} + +.hljs-number, .hljs-built_in, .hljs-builtin-name, .hljs-literal, .hljs-type, .hljs-params, .hljs-deletion { + color: #f99b15 +} + +.hljs-title, .hljs-section, .hljs-attribute { + color: #fec418 +} + +.hljs-string, .hljs-symbol, .hljs-bullet, .hljs-addition { + color: #48b685 +} + +.hljs-keyword, .hljs-selector-tag { + color: #815ba4 +} + +.hljs { + display: block; + overflow-x: auto; + background: #e7e9db; + color: #4f424c; + padding: 0.5em +} + +.hljs-emphasis { + font-style: italic +} + +.hljs-strong { + font-weight: bold +} + +.link-icon { + opacity: 0; + position: absolute; + margin-left: -25px; + padding-right: 5px; + padding-top: 2px; +} + +.example-container .link-icon { + margin-top: -6px; +} + +.example-container:hover .link-icon, +.name-container:hover .link-icon { + opacity: .5; +} + +.name-container { + display: flex; + padding-top: 1em; +} diff --git a/3.111.1/styles/prettify-jsdoc.css b/3.111.1/styles/prettify-jsdoc.css new file mode 100644 index 00000000..834a866d --- /dev/null +++ b/3.111.1/styles/prettify-jsdoc.css @@ -0,0 +1,111 @@ +/* JSDoc prettify.js theme */ + +/* plain text */ +.pln { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* string content */ +.str { + color: hsl(104, 100%, 24%); + font-weight: normal; + font-style: normal; +} + +/* a keyword */ +.kwd { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a comment */ +.com { + font-weight: normal; + font-style: italic; +} + +/* a type name */ +.typ { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a literal value */ +.lit { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* punctuation */ +.pun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp open bracket */ +.opn { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp close bracket */ +.clo { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a markup tag name */ +.tag { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute name */ +.atn { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute value */ +.atv { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a declaration */ +.dec { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a variable name */ +.var { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a function name */ +.fun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; +} diff --git a/3.111.1/styles/prettify-tomorrow.css b/3.111.1/styles/prettify-tomorrow.css new file mode 100644 index 00000000..eaf12510 --- /dev/null +++ b/3.111.1/styles/prettify-tomorrow.css @@ -0,0 +1,138 @@ +/* Tomorrow Theme */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* Pretty printing styles. Used with prettify.js. */ +/* SPAN elements with the classes below are added by prettyprint. */ +/* plain text */ +.pln { + color: #4d4d4c; } + +@media screen { + /* string content */ + .str { + color: hsl(104, 100%, 24%); } + + /* a keyword */ + .kwd { + color: hsl(240, 100%, 50%); } + + /* a comment */ + .com { + color: hsl(0, 0%, 60%); } + + /* a type name */ + .typ { + color: hsl(240, 100%, 32%); } + + /* a literal value */ + .lit { + color: hsl(240, 100%, 40%); } + + /* punctuation */ + .pun { + color: #000000; } + + /* lisp open bracket */ + .opn { + color: #000000; } + + /* lisp close bracket */ + .clo { + color: #000000; } + + /* a markup tag name */ + .tag { + color: #c82829; } + + /* a markup attribute name */ + .atn { + color: #f5871f; } + + /* a markup attribute value */ + .atv { + color: #3e999f; } + + /* a declaration */ + .dec { + color: #f5871f; } + + /* a variable name */ + .var { + color: #c82829; } + + /* a function name */ + .fun { + color: #4271ae; } } +/* Use higher contrast and text-weight for printable form. */ +@media print, projection { + .str { + color: #060; } + + .kwd { + color: #006; + font-weight: bold; } + + .com { + color: #600; + font-style: italic; } + + .typ { + color: #404; + font-weight: bold; } + + .lit { + color: #044; } + + .pun, .opn, .clo { + color: #440; } + + .tag { + color: #006; + font-weight: bold; } + + .atn { + color: #404; } + + .atv { + color: #060; } } +/* Style */ +/* +pre.prettyprint { + background: white; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 12px; + line-height: 1.5; + border: 1px solid #ccc; + padding: 10px; } +*/ + +/* Get LI elements to show when they are in the main article */ +article ul li { + list-style-type: circle; + margin-left: 25px; +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; } + +/* IE indents via margin-left */ +li.L0, +li.L1, +li.L2, +li.L3, +li.L4, +li.L5, +li.L6, +li.L7, +li.L8, +li.L9 { + /* */ } + +/* Alternate shading for lines */ +li.L1, +li.L3, +li.L5, +li.L7, +li.L9 { + /* */ } diff --git a/3.111.1/three-d-secure_external_three-d-secure.js.html b/3.111.1/three-d-secure_external_three-d-secure.js.html new file mode 100644 index 00000000..a3a74ed6 --- /dev/null +++ b/3.111.1/three-d-secure_external_three-d-secure.js.html @@ -0,0 +1,905 @@ + + + + + + + + + + + three-d-secure/external/three-d-secure.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ three-d-secure/external/three-d-secure.js +

+ + + + + +
+
+
"use strict";
+
+var wrapPromise = require("@braintree/wrap-promise");
+var methods = require("../../lib/methods");
+var convertMethodsToError = require("../../lib/convert-methods-to-error");
+var EventEmitter = require("@braintree/event-emitter");
+var FRAMEWORKS = require("./frameworks");
+
+/**
+ * @deprecated
+ * @callback ThreeDSecure~addFrameCallback
+ * @param {?BraintreeError} [err] `null` or `undefined` if there was no error.
+ * @param {HTMLIFrameElement} iframe An iframe element containing the bank's authentication page that you must put on your page.
+ * @description **Deprecated** The callback used for options.addFrame in 3DS 1.0's {@link ThreeDSecure#verifyCard|verifyCard}.
+ * @returns {void}
+ */
+
+/**
+ * @deprecated
+ * @callback ThreeDSecure~removeFrameCallback
+ * @description **Deprecated** The callback used for options.removeFrame in 3DS 1.0's {@link ThreeDSecure#verifyCard|verifyCard}.
+ * @returns {void}
+ */
+
+/**
+ * @deprecated
+ * @typedef {object} ThreeDSecure~verifyCardCustomerObject
+ * @property {string} [customer.mobilePhoneNumber] The mobile phone number used for verification. Only numbers; remove dashes, parenthesis and other characters.
+ * @property {string} [customer.email] The email used for verification.
+ * @property {string} [customer.shippingMethod] The 2-digit string indicating the shipping method chosen for the transaction.
+ * @property {string} [customer.billingAddress.firstName] The first name associated with the address.
+ * @property {string} [customer.billingAddress.lastName] The last name associated with the address.
+ * @property {string} [customer.billingAddress.streetAddress] Line 1 of the Address (eg. number, street, etc).
+ * @property {string} [customer.billingAddress.extendedAddress] Line 2 of the Address (eg. suite, apt #, etc.).
+ * @property {string} [customer.billingAddress.locality] The locality (city) name associated with the address.
+ * @property {string} [customer.billingAddress.region] The 2 letter code for US states or an ISO-3166-2 country subdivision code of up to three letters.
+ * @property {string} [customer.billingAddress.postalCode] The zip code or equivalent for countries that have them.
+ * @property {string} [customer.billingAddress.countryCodeAlpha2] The 2 character country code.
+ * @property {string} [customer.billingAddress.phoneNumber] The phone number associated with the address. Only numbers; remove dashes, parenthesis and other characters.
+ * @description **Deprecated** Optional customer information to be passed to 3DS 1.0 for verification.
+ */
+
+/**
+ * @typedef {object} ThreeDSecure~verifyPayload
+ * @property {string} nonce The new payment method nonce produced by the 3D Secure lookup. The original nonce passed into {@link ThreeDSecure#verifyCard|verifyCard} was consumed. This new nonce should be used to transact on your server.
+ * @property {string} type The payment method type.
+ * @property {object} details Additional account details.
+ * @property {string} details.cardType Type of card, ex: Visa, MasterCard.
+ * @property {string} details.lastFour Last four digits of card number.
+ * @property {string} details.lastTwo Last two digits of card number.
+ * @property {string} description A human-readable description.
+ * @property {object} binData Information about the card based on the bin.
+ * @property {string} binData.commercial Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.countryOfIssuance The country of issuance.
+ * @property {string} binData.debit Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.durbinRegulated Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.healthcare Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.issuingBank The issuing bank.
+ * @property {string} binData.payroll Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.prepaid Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.productId The product id.
+ * @property {boolean} liabilityShiftPossible *Deprecated:* Use `threeDSecureInfo.liabilityShiftPossible` instead.
+ * @property {boolean} liabilityShifted *Deprecated:* Use `threeDSecureInfo.liabilityShifted` instead.
+ * @property {object} threeDSecureInfo 3DS information about the card. Note: This information should be verified on the server by using the [payment method nonce find method](https://developer.paypal.com/braintree/docs/reference/request/payment-method-nonce/find). The values provided here are merely for convenience. Only values looked up on the server should determine the logic about how to process a transaction.
+ * @property {string} threeDSecureInfo.acsTransactionId The transaction identifier from the issuing bank.
+ * @property {string} threeDSecureInfo.cavv Cardholder authentication verification value or CAVV. The main encrypted message issuers and card networks use to verify authentication has occurred. Mastercard uses an AVV message and American Express uses an AEVV message, each of which should also be passed in the cavv parameter.
+ * @property {string} threeDSecureInfo.dsTransactionId Transaction identifier resulting from 3D Secure 2 authentication.
+ * @property {string} threeDSecureInfo.eciFlag The value of the electronic commerce indicator (ECI) flag, which indicates the outcome of the 3DS authentication. This will be a two-digit value.
+ * @property {boolean} threeDSecureInfo.enrolled Indicates the status of 3D Secure authentication eligibility with the card issuer.
+ * @property {boolean} threeDSecureInfo.liabilityShifted Indicates whether the liability for fraud has been shifted away from the merchant.
+ * @property {boolean} threeDSecureInfo.liabilityShiftPossible Indicates whether liability shift is still possible on a retry.
+ * @property {string} threeDSecureInfo.paresStatus Transaction status result identifier.
+ * @property {string} threeDSecureInfo.status Indicates the outcome of the 3D Secure event.
+ * @property {string} threeDSecureInfo.threeDSecureAuthenticationId ID of the 3D Secure authentication performed for this transaction. Do not provide this field as a transaction sale parameter if you are using the returned payment method nonce from the payload.
+ * @property {string} threeDSecureInfo.threeDSecureServerTransactionId Transaction identifier provided by the issuing bank who recieved the 3D Secure event.
+ * @property {string} threeDSecureInfo.threeDSecureVersion The version of 3D Secure authentication used for the transaction.
+ * @property {string} threeDSecureInfo.xid Transaction identifier resulting from 3D Secure authentication. Uniquely identifies the transaction and sometimes required in the authorization message. This is a base64-encoded value. This field will no longer be used in 3D Secure 2 authentications for Visa and Mastercard, however it will be supported by American Express.
+ * @property {string} threeDSecureInfo.lookup.transStatus Error code returned from the 3D Secure MPI provider.
+ * @property {string} threeDSecureInfo.lookup.transStatusReason Description correlating to the transStatus error code.
+ * @property {string} threeDSecureInfo.authentication.transStatus Error code returned from the 3D Secure MPI provider.
+ * @property {string} threeDSecureInfo.authentication.transStatusReason Description correlating to the transStatus error code.
+ * @property {object} rawCardinalSDKVerificationData The response back from the Cardinal SDK after verification has completed. See [Cardinal's Documentation](https://cardinaldocs.atlassian.net/wiki/spaces/CC/pages/98315/Response+Objects) for more information. If the customer was not required to do a 3D Secure challenge, this object will not be available.
+ */
+
+/**
+ * @typedef {string} ThreeDSecure~prepareLookupPayload The client data to pass on when doing a server side lookup call.
+ */
+
+/**
+ * @typedef {object} ThreeDSecure~verificationData
+ * @property {boolean} requiresUserAuthentication When `true`, the user will be presented with a 3D Secure challenge when calling `next` in the {@link ThreeDSecure#event:lookup-complete|`lookup-complete` event}.
+ * @property {object} threeDSecureInfo Contains liability shift details.
+ * @property {boolean} threeDSecureInfo.liabilityShiftPossible Indicates whether the card was eligible for 3D Secure.
+ * @property {boolean} threeDSecureInfo.liabilityShifted Indicates whether the liability for fraud has been shifted away from the merchant.
+ * @property {object} paymentMethod A {@link ThreeDSecure~verifyPayload|verifyPayload} object.
+ * @property {object} lookup Details about the 3D Secure lookup.
+ * @property {string} lookup.threeDSecureVersion The version of 3D Secure that will be used for the 3D Secure challenge.
+ */
+
+/**
+ * @typedef {object} ThreeDSecure~billingAddress
+ * @property {string} [givenName] The first name associated with the billing address. (maximum length 50, ASCII characters)
+ * @property {string} [surname] The last name associated with the billing address. (maximum length 50, ASCII characters)
+ * @property {string} [phoneNumber] The phone number associated with the billing address. Only numbers; remove dashes, parenthesis and other characters.
+ * @property {string} [streetAddress] Line 1 of the billing address (eg. number, street, etc). (maximum length 50)
+ * @property {string} [extendedAddress] Line 2 of the billing address (eg. suite, apt #, etc.). (maximum length 50)
+ * @property {string} [line3] Line 3 of the billing address if needed (eg. suite, apt #, etc). (maximum length 50)
+ * @property {string} [locality] The locality (city) name associated with the billing address.
+ * @property {string} [region] This field expects an ISO3166-2 subdivision code. The subdivision code is what follows the hyphen separator in the full ISO 3166-2 code. For example, the state of Ohio in the United States we expect "OH" as opposed to the full ISO 3166-2 code "US-OH".
+ * @property {string} [postalCode] The zip code or equivalent for countries that have them.
+ * @property {string} [countryCodeAlpha2] The 2 character country code.
+ */
+
+/**
+ * @typedef {object} ThreeDSecure~additionalInformation
+ * @property {string} [workPhoneNumber] The work phone number used for verification. Only numbers; remove dashes, parenthesis and other characters. (maximum length 25)
+ * @property {string} [shippingGivenName] The first name associated with the shipping address. (maximum length 50, ASCII characters)
+ * @property {string} [shippingSurname] The last name associated with the shipping address. (maximum length 50, ASCII characters)
+ * @property {object} [shippingAddress]
+ * @property {string} [shippingAddress.streetAddress] Line 1 of the shipping address (eg. number, street, etc). (maximum length 50)
+ * @property {string} [shippingAddress.extendedAddress] Line 2 of the shipping address (eg. suite, apt #, etc.). (maximum length 50)
+ * @property {string} [shippingAddress.line3] Line 3 of the shipping address if needed (eg. suite, apt #, etc). (maximum length 50)
+ * @property {string} [shippingAddress.locality] The locality (city) name associated with the shipping address. (maximum length 50)
+ * @property {string} [shippingAddress.region] This field expects an ISO3166-2 subdivision code. The subdivision code is what follows the hyphen separator in the full ISO 3166-2 code. For example, the state of Ohio in the United States we expect "OH" as opposed to the full ISO 3166-2 code "US-OH".
+ * @property {string} [shippingAddress.postalCode] The zip code or equivalent for countries that have them. (maximum length 10)
+ * @property {string} [shippingAddress.countryCodeAlpha2] The 2 character country code. (maximum length 2)
+ * @property {string} [shippingPhone] The phone number associated with the shipping address. Only numbers; remove dashes, parenthesis and other characters. (maximum length 20)
+ * @property {string} [shippingMethod] The 2-digit string indicating the name of the shipping method chosen for the transaction. (maximum length 50) Possible values:
+ * - `01` Same Day
+ * - `02` Overnight / Expedited
+ * - `03` Priority (2-3 Days)
+ * - `04` Ground
+ * - `05` Electronic Delivery
+ * - `06` Ship to Store
+ * @property {string} [shippingMethodIndicator] The 2-digit string indicating the shipping method chosen for the transaction Possible values.
+ * - `01` Ship to cardholder billing address
+ * - `02` Ship to another verified address on file with merchant
+ * - `03` Ship to address that is different from billing address
+ * - `04` Ship to store (store address should be populated on request)
+ * - `05` Digital goods
+ * - `06` Travel and event tickets, not shipped
+ * - `07` Other
+ * @property {string} [productCode] The 3-letter string representing the merchant product code. Possible values:
+ * - `AIR` Airline
+ * - `GEN` General Retail
+ * - `DIG` Digital Goods
+ * - `SVC` Services
+ * - `RES` Restaurant
+ * - `TRA` Travel
+ * - `DSP` Cash Dispensing
+ * - `REN` Car Rental
+ * - `GAS` Fuel
+ * - `LUX` Luxury Retail
+ * - `ACC` Accommodation Retail
+ * - `TBD` Other
+ * @property {string} [deliveryTimeframe] The 2-digit number indicating the delivery time frame. Possible values:
+ * - `01` Electronic delivery
+ * - `02` Same day shipping
+ * - `03` Overnight shipping
+ * - `04` Two or more day shipping
+ * @property {string} [deliveryEmail] For electronic delivery, email address to which the merchandise was delivered. (maximum length 254)
+ * @property {string} [reorderindicator] The 2-digit number indicating whether the cardholder is reordering previously purchased merchandise. possible values:
+ * - `01` First time ordered
+ * - `02` Reordered
+ * @property {string} [preorderIndicator] The 2-digit number indicating whether cardholder is placing an order with a future availability or release date. possible values:
+ * - `01` Merchandise available
+ * - `02` Future availability
+ * @property {string} [preorderDate] The 8-digit number (format: YYYYMMDD) indicating expected date that a pre-ordered purchase will be available.
+ * @property {string} [giftCardAmount] The purchase amount total for prepaid gift cards in major units. (maximum length 15)
+ * @property {string} [giftCardCurrencyCode] ISO 4217 currency code for the gift card purchased. (maximum length 3)
+ * @property {string} [giftCardCount] Total count of individual prepaid gift cards purchased. (maximum length 2)
+ * @property {string} [accountAgeIndicator] The 2-digit value representing the length of time cardholder has had account. Possible values:
+ * - `01` No Account
+ * - `02` Created during transaction
+ * - `03` Less than 30 days
+ * - `04` 30-60 days
+ * - `05` More than 60 days
+ * @property {string} [accountCreateDate] The 8-digit number (format: YYYYMMDD) indicating the date the cardholder opened the account.
+ * @property {string} [accountChangeIndicator] The 2-digit value representing the length of time since the last change to the cardholder account. This includes shipping address, new payment account or new user added. Possible values:
+ * - `01` Changed during transaction
+ * - `02` Less than 30 days
+ * - `03` 30-60 days
+ * - `04` More than 60 days
+ * @property {string} [accountChangeDate] The 8-digit number (format: YYYYMMDD) indicating the date the cardholder's account was last changed. This includes changes to the billing or shipping address, new payment accounts or new users added.
+ * @property {string} [accountPwdChangeIndicator] The 2-digit value representing the length of time since the cardholder changed or reset the password on the account. Possible values:
+ * - `01` No change
+ * - `02` Changed during transaction
+ * - `03` Less than 30 days
+ * - `04` 30-60 days
+ * - `05` More than 60 days
+ * @property {string} [accountPwdChangeDate] The 8-digit number (format: YYYYMMDD) indicating the date the cardholder last changed or reset password on account.
+ * @property {string} [shippingAddressUsageIndicator] The 2-digit value indicating when the shipping address used for transaction was first used. Possible values:
+ * - `01` This transaction
+ * - `02` Less than 30 days
+ * - `03` 30-60 days
+ * - `04` More than 60 days
+ * @property {string} [shippingAddressUsageDate] The 8-digit number (format: YYYYMMDD) indicating the date when the shipping address used for this transaction was first used.
+ * @property {string} [transactionCountDay] Number of transactions (successful or abandoned) for this cardholder account within the last 24 hours. (maximum length 3)
+ * @property {string} [transactionCountYear] Number of transactions (successful or abandoned) for this cardholder account within the last year. (maximum length 3)
+ * @property {string} [addCardAttempts] Number of add card attempts in the last 24 hours. (maximum length 3)
+ * @property {string} [accountPurchases] Number of purchases with this cardholder account during the previous six months.
+ * @property {string} [fraudActivity] The 2-digit value indicating whether the merchant experienced suspicious activity (including previous fraud) on the account. Possible values:
+ * - `01` No suspicious activity
+ * - `02` Suspicious activity observed
+ * @property {string} [shippingNameIndicator] The 2-digit value indicating if the cardholder name on the account is identical to the shipping name used for the transaction. Possible values:
+ * - `01` Account and shipping name identical
+ * - `02` Account and shipping name differ
+ * @property {string} [paymentAccountIndicator] The 2-digit value indicating the length of time that the payment account was enrolled in the merchant account. Possible values:
+ * - `01` No account (guest checkout)
+ * - `02` During the transaction
+ * - `03` Less than 30 days
+ * - `04` 30-60 days
+ * - `05` More than 60 days
+ * @property {string} [paymentAccountAge] The 8-digit number (format: YYYYMMDD) indicating the date the payment account was added to the cardholder account.
+ * @property {string} [acsWindowSize] The 2-digit number to set the challenge window size to display to the end cardholder.  The ACS will reply with content that is formatted appropriately to this window size to allow for the best user experience.  The sizes are width x height in pixels of the window displayed in the cardholder browser window. Possible values:
+ * - `01` 250x400
+ * - `02` 390x400
+ * - `03` 500x600
+ * - `04` 600x400
+ * - `05` Full page
+ * @property {string} [sdkMaxTimeout] The 2-digit number of minutes (minimum 05) to set the maximum amount of time for all 3DS 2.0 messages to be communicated between all components.
+ * @property {string} [addressMatch] The 1-character value (Y/N) indicating whether cardholder billing and shipping addresses match.
+ * @property {string} [accountId] Additional cardholder account information. (maximum length 64)
+ * @property {string} [ipAddress] The IP address of the consumer. IPv4 and IPv6 are supported.
+ * - only one IP address supported
+ * - only numbers, letters, period '.' chars, or colons ':' are acceptable
+ * @property {string} [orderDescription] Brief description of items purchased. (maximum length 256)
+ * @property {string} [taxAmount] Unformatted tax amount without any decimalization (ie. $123.67 = 12367). (maximum length 20)
+ * @property {string} [userAgent] The exact content of the HTTP user agent header. (maximum length 500)
+ * @property {string} [authenticationIndicator] The 2-digit number indicating the type of authentication request. Possible values:
+ *  - `01` Payment
+ *  - `02` Recurring transaction
+ *  - `03` Installment
+ *  - `04` Add card
+ *  - `05` Maintain card
+ *  - `06` Cardholder verification as part of EMV token ID&V
+ *  - `08` Split Shipment
+ *  - `09` Delayed Shipment
+ *  - `85` Payment with multiple merchants
+ * @property {string} [installment] An integer value greater than 1 indicating the maximum number of permitted authorizations for installment payments. (maximum length 3)
+ * @property {string} [purchaseDate] The 14-digit number (format: YYYYMMDDHHMMSS) indicating the date in UTC of original purchase.
+ * @property {string} [recurringEnd] The 8-digit number (format: YYYYMMDD) indicating the date after which no further recurring authorizations should be performed.
+ * @property {string} [recurringFrequency] Integer value indicating the minimum number of days between recurring authorizations. A frequency of monthly is indicated by the value 28. Multiple of 28 days will be used to indicate months (ex. 6 months = 168). (maximum length 3)
+ */
+
+/**
+ * @name ThreeDSecure#on
+ * @function
+ * @param {string} event The name of the event to which you are subscribing.
+ * @param {function} handler A callback to handle the event.
+ * @description Subscribes a handler function to a named event. The following events are available:
+ *   * {@link ThreeDSecure#event:lookup-complete|lookup-complete}
+ *   * {@link ThreeDSecure#event:customer-canceled|customer-canceled}
+ *   * {@link ThreeDSecure#event:authentication-iframe-available|authentication-iframe-available}
+ *   * {@link ThreeDSecure#event:authentication-modal-render|authentication-modal-render}
+ *   * {@link ThreeDSecure#event:authentication-modal-close|authentication-modal-close}
+ * @example
+ * <caption>Listening to a 3D Secure event</caption>
+ * braintree.threeDSecure.create({ ... }, function (createErr, threeDSecureInstance) {
+ *   threeDSecureInstance.on('lookup-complete', function (data, next) {
+ *     console.log('data from the lookup', data);
+ *     next();
+ *   });
+ *   threeDSecureInstance.on('customer-canceled', function () {
+ *     console.log('log that the customer canceled');
+ *   });
+ * });
+ * @returns {void}
+ */
+
+/**
+ * @name ThreeDSecure#off
+ * @function
+ * @param {string} event The name of the event to which you are unsubscribing.
+ * @param {function} handler The callback for the event you are unsubscribing from.
+ * @description Unsubscribes the handler function to a named event.
+ * @example
+ * <caption>Subscribing and then unsubscribing from a 3D Secure eld event</caption>
+ * braintree.threeDSecure.create({ ... }, function (createErr, threeDSecureInstance) {
+ *   var lookupCallback = function (data, next) {
+ *     console.log(data);
+ *     next();
+ *   };
+ *   var cancelCallback = function () {
+ *     // log the cancelation
+ *     // or update UI
+ *   };
+ *
+ *   threeDSecureInstance.on('lookup-complete', lookupCallback);
+ *   threeDSecureInstance.on('customer-canceled', cancelCallback);
+ *
+ *   // later on
+ *   threeDSecureInstance.off('lookup-complete', lookupCallback);
+ *   threeDSecureInstance.off('customer-canceled', cancelCallback);
+ * });
+ * @returns {void}
+ */
+
+/**
+ * This event is emitted when the `2-inline-iframe` version is specified when creating the 3D Secure instance and the authentication iframe becomes available.
+ * @event ThreeDSecure#authentication-iframe-available
+ * @example
+ * <caption>Listening for the authentication iframe to be available</caption>
+ *   threeDSecureInstance.on('authentication-iframe-available', function (event, next) {
+ *     document.body.appendChild(event.element); // add iframe element to page
+ *
+ *     next(); // let the SDK know the iframe is ready
+ *   });
+ * });
+ */
+
+/**
+ * This event is emitted when using the 3D Secure 2.0 flow and the initial lookup request completes. If this is not used, a `onLookupComplete` callback must be passed into the `verifyCard` method.
+ * @event ThreeDSecure#lookup-complete
+ * @example
+ * <caption>Listening for when the lookup request is complete</caption>
+ * braintree.threeDSecure.create({
+ *   client: clientInstance,
+ *   version: '2'
+ * }, function (createErr, threeDSecureInstance) {
+ *   threeDSecureInstance.on('lookup-complete', function (data, next) {
+ *     // inspect the data
+ *
+ *     // call next when ready to proceed with the challenge
+ *     next();
+ *   });
+ * });
+ */
+
+/**
+ * This event is emitted when using the 3D Secure 2.0 flow and the customer cancels the 3D Secure challenge.
+ * @event ThreeDSecure#customer-canceled
+ * @example
+ * <caption>Listening for when the customer cancels the 3D Secure challenge</caption>
+ * braintree.threeDSecure.create({
+ *   client: clientInstance,
+ *   version: '2'
+ * }, function (createErr, threeDSecureInstance) {
+ *   threeDSecureInstance.on('customer-canceled', function () {
+ *     // the customer canceled the 3D Secure challenge
+ *   });
+ * });
+ */
+
+/**
+ * This event is emitted when using the 3D Secure 2.0 flow and the authentication modal closes, either because the authentication was completed or because the customer canceled the process.
+ * @event ThreeDSecure#authentication-modal-close
+ * @example
+ * braintree.threeDSecure.create({
+ *   client: clientInstance,
+ *   version: '2'
+ * }, function (createErr, threeDSecureInstance) {
+ *   threeDSecureInstance.on('authentication-modal-close', function () {
+ *     // the modal was closed
+ *   });
+ * });
+ */
+
+/**
+ * This event is emitted when using the 3D Secure 2.0 flow and the authentication modal is rendered.
+ * @event ThreeDSecure#authentication-modal-render
+ * @example
+ * braintree.threeDSecure.create({
+ *   client: clientInstance,
+ *   version: '2'
+ * }, function (createErr, threeDSecureInstance) {
+ *   threeDSecureInstance.on('authentication-modal-render', function () {
+ *     // the modal was rendered, presenting the authentication form to the customer
+ *   });
+ * });
+ */
+
+/**
+ * @class
+ * @param {object} options 3D Secure {@link module:braintree-web/three-d-secure.create create} options
+ * @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/three-d-secure.create|braintree.threeDSecure.create} instead.</strong>
+ * @classdesc This class represents a ThreeDSecure component produced by {@link module:braintree-web/three-d-secure.create|braintree.threeDSecure.create}. Instances of this class have a method for launching a 3D Secure authentication flow.
+ *
+ * If you use the Braintree SDK from within an iframe, you must not use the `sandbox` attribute on your iframe or the 3D Secure modal will not function correctly.
+ *
+ * **Note**: 3D Secure 2.0 is documented below and will become the default integration method in a future version of Braintree-web. Until then, version 1.0 will continue to be supported. To view 3D Secure 1.0 documentation, look at Braintree-web documentation from version [3.40.0](https://braintree.github.io/braintree-web/3.40.0/ThreeDSecure.html) and earlier, or upgrade your integration by referring to the [3D Secure 2.0 adoption guide](https://developer.paypal.com/braintree/docs/guides/3d-secure/migration/javascript/v3).
+ */
+function ThreeDSecure(options) {
+  var self = this;
+  var Framework = FRAMEWORKS[options.framework];
+
+  EventEmitter.call(this);
+
+  this._framework = new Framework(options);
+  this._framework.setUpEventListeners(function () {
+    self._emit.apply(self, arguments);
+  });
+}
+
+EventEmitter.createChild(ThreeDSecure);
+// NEXT_MAJOR_VERSION remove exemptionRequested entirely in favor of `requestedExemptionType`
+/**
+ * Launch the 3D Secure login flow, returning a nonce payload.
+ *
+ * @public
+ * @param {object} options Options for card verification.
+ * @param {string} options.nonce The nonce representing the card from a tokenization payload. For example, this can be a {@link HostedFields~tokenizePayload|tokenizePayload} returned by Hosted Fields under `payload.nonce`.
+ * @param {string} options.bin The numeric Bank Identification Number (bin) of the card from a tokenization payload. For example, this can be a {@link HostedFields~tokenizePayload|tokenizePayload} returned by Hosted Fields under `payload.details.bin`.
+ * @param {string} options.amount The amount of the transaction in the current merchant account's currency. This must be expressed in numbers with an optional decimal (using `.`) and precision up to the hundredths place. For example, if you're processing a transaction for 1.234,56 € then `amount` should be `1234.56`.
+ * @param {string} [options.accountType] The account type for the card (if known). Accepted values: `credit` or `debit`.
+ * @param {boolean} [options.cardAddChallengeRequested] If set to `true`, a card-add challenge will be requested from the issuer. If set to `false`, a card-add challenge will not be requested. If the param is missing, a card-add challenge will only be requested for $0 amount. An authentication created using this flag should only be used for vaulting operations (creation of customers' credit cards or payment methods) and not for creating transactions.
+ * @param {boolean} [options.cardAdd] *Deprecated:* Use `cardAddChallengeRequested` instead.
+ * @param {boolean} [options.challengeRequested] If set to true, an authentication challenge will be forced if possible.
+ * @param {boolean} [options.dataOnlyRequested] Indicates whether to use the data only flow. In this flow, frictionless 3DS is ensured for Mastercard cardholders as the card scheme provides a risk score for the issuer to determine whether to approve. If data only is not supported by the processor, a validation error will be raised. Non-Mastercard cardholders will fallback to a normal 3DS flow.
+ * @param {boolean} [options.exemptionRequested] *Deprecated:* Use `requestedExemptionType` instead.
+ * @param {boolean} [options.requestVisaDAF] Request to use VISA Digital Authentication Framework. If set to true, a Visa DAF authenticated payment credential will be created and/or used for authentication if the merchant is eligible.
+ * @param {string} [options.merchantName] Allows to override the merchant name that is shown in the challenge.
+ * @param {string} [options.requestedExemptionType] If an exemption is requested and the exemption's conditions are satisfied, then it will be applied. The following supported exemptions are defined as per PSD2 regulation: `low_value`, `transaction_risk_analysis`
+ * @param {object} [options.customFields] Object where each key is the name of a custom field which has been configured in the Control Panel. In the Control Panel you can configure 3D Secure Rules which trigger on certain values.
+ * @param {function} [options.onLookupComplete] *Deprecated:* Use {@link ThreeDSecure#event:lookup-complete|`threeDSecureInstance.on('lookup-complete')`} instead. Function to execute when lookup completes. The first argument, `data`, is a {@link ThreeDSecure~verificationData|verificationData} object, and the second argument, `next`, is a callback. `next` must be called to continue.
+ * @param {string} [options.email] The email used for verification. (maximum length 255)
+ * @param {string} [options.mobilePhoneNumber] The mobile phone number used for verification. Only numbers; remove dashes, parenthesis and other characters. (maximum length 25)
+ * @param {object} [options.billingAddress] An {@link ThreeDSecure~billingAddress|billingAddress} object for verification.
+ * @param {object} [options.additionalInformation] An {@link ThreeDSecure~additionalInformation|additionalInformation} object for verification.
+ * @param {object} [options.collectDeviceData] If set to `true`, device data such as browser screen dimensions, language and time zone is submitted with lookup data.
+ * @param {object} [options.customer] **Deprecated** Customer information for use in 3DS 1.0 verifications. Can contain any subset of a {@link ThreeDSecure~verifyCardCustomerObject|verifyCardCustomerObject}. Only to be used for 3DS 1.0 integrations.
+ * @param {callback} options.addFrame **Deprecated** This {@link ThreeDSecure~addFrameCallback|addFrameCallback} will be called when the bank frame needs to be added to your page. Only to be used for 3DS 1.0 integrations.
+ * @param {callback} options.removeFrame **Deprecated** For use in 3DS 1.0 Flows. This {@link ThreeDSecure~removeFrameCallback|removeFrameCallback} will be called when the bank frame needs to be removed from your page. Only to be used in 3DS 1.0 integrations.
+ * @param {callback} [callback] The second argument, <code>data</code>, is a {@link ThreeDSecure~verifyPayload|verifyPayload}. If no callback is provided, it will return a promise that resolves {@link ThreeDSecure~verifyPayload|verifyPayload}.
+
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * <caption>Verifying a payment method nonce with 3DS 2.0</caption>
+ * var my3DSContainer;
+ *
+ * // set up listener after initialization
+ * threeDSecure.on(('lookup-complete', function (data, next) {
+ *   // use `data` here, then call `next()`
+ *   next();
+ * });
+ *
+ * // call verifyCard after tokenizing a card
+ * threeDSecure.verifyCard({
+ *   amount: '123.45',
+ *   nonce: hostedFieldsTokenizationPayload.nonce,
+ *   bin: hostedFieldsTokenizationPayload.details.bin,
+ *   email: 'test@example.com'
+ *   billingAddress: {
+ *     givenName: 'Jill',
+ *     surname: 'Doe',
+ *     phoneNumber: '8101234567',
+ *     streetAddress: '555 Smith St.',
+ *     extendedAddress: '#5',
+ *     locality: 'Oakland',
+ *     region: 'CA',
+ *     postalCode: '12345',
+ *     countryCodeAlpha2: 'US'
+ *   },
+ *   additionalInformation: {
+ *     workPhoneNumber: '5555555555',
+ *     shippingGivenName: 'Jill',
+ *     shippingSurname: 'Doe',
+ *     shippingAddress: {
+ *       streetAddress: '555 Smith st',
+ *       extendedAddress: '#5',
+ *       locality: 'Oakland',
+ *       region: 'CA',
+ *       postalCode: '12345',
+ *       countryCodeAlpha2: 'US'
+ *     }
+ *     shippingPhone: '8101234567'
+ *   }
+ * }, function (err, payload) {
+ *   if (err) {
+ *     console.error(err);
+ *     return;
+ *   }
+ *
+ *   if (payload.liabilityShifted) {
+ *     // Liability has shifted
+ *     submitNonceToServer(payload.nonce);
+ *   } else if (payload.liabilityShiftPossible) {
+ *     // Liability may still be shifted
+ *     // Decide if you want to submit the nonce
+ *   } else {
+ *     // Liability has not shifted and will not shift
+ *     // Decide if you want to submit the nonce
+ *   }
+ * });
+ * @example
+ * <caption>Verifying a payment method nonce with 3DS 2.0 with onLookupComplete callback</caption>
+ * var my3DSContainer;
+ *
+ * threeDSecure.verifyCard({
+ *   amount: '123.45',
+ *   nonce: hostedFieldsTokenizationPayload.nonce,
+ *   bin: hostedFieldsTokenizationPayload.details.bin,
+ *   email: 'test@example.com'
+ *   billingAddress: {
+ *     givenName: 'Jill',
+ *     surname: 'Doe',
+ *     phoneNumber: '8101234567',
+ *     streetAddress: '555 Smith St.',
+ *     extendedAddress: '#5',
+ *     locality: 'Oakland',
+ *     region: 'CA',
+ *     postalCode: '12345',
+ *     countryCodeAlpha2: 'US'
+ *   },
+ *   additionalInformation: {
+ *     workPhoneNumber: '5555555555',
+ *     shippingGivenName: 'Jill',
+ *     shippingSurname: 'Doe',
+ *     shippingAddress: {
+ *       streetAddress: '555 Smith st',
+ *       extendedAddress: '#5',
+ *       locality: 'Oakland',
+ *       region: 'CA',
+ *       postalCode: '12345',
+ *       countryCodeAlpha2: 'US'
+ *     }
+ *     shippingPhone: '8101234567'
+ *   },
+ *   onLookupComplete: function (data, next) {
+ *     // use `data` here, then call `next()`
+ *     next();
+ *   }
+ * }, function (err, payload) {
+ *   if (err) {
+ *     console.error(err);
+ *     return;
+ *   }
+ *
+ *   if (payload.liabilityShifted) {
+ *     // Liability has shifted
+ *     submitNonceToServer(payload.nonce);
+ *   } else if (payload.liabilityShiftPossible) {
+ *     // Liability may still be shifted
+ *     // Decide if you want to submit the nonce
+ *   } else {
+ *     // Liability has not shifted and will not shift
+ *     // Decide if you want to submit the nonce
+ *   }
+ * });
+ * @example
+ * <caption>Handling 3DS lookup errors</caption>
+ * var my3DSContainer;
+ *
+ * // set up listener after initialization
+ * threeDSecure.on(('lookup-complete', function (data, next) {
+ *   // use `data` here, then call `next()`
+ *   next();
+ * });
+ *
+ * // call verifyCard after tokenizing a card
+ * threeDSecure.verifyCard({
+ *   amount: '123.45',
+ *   nonce: hostedFieldsTokenizationPayload.nonce,
+ *   bin: hostedFieldsTokenizationPayload.details.bin,
+ *   email: 'test@example.com',
+ *   billingAddress: billingAddressFromCustomer,
+ *   additionalInformation: additionalInfoFromCustomer
+ * }, function (err, payload) {
+ *   if (err) {
+ *     if (err.code.indexOf('THREEDS_LOOKUP') === 0) {
+ *       // an error occurred during the initial lookup request
+ *
+ *       if (err.code === 'THREEDS_LOOKUP_TOKENIZED_CARD_NOT_FOUND_ERROR') {
+ *         // either the passed payment method nonce does not exist
+ *         // or it was already consumed before the lookup call was made
+ *       } else if (err.code.indexOf('THREEDS_LOOKUP_VALIDATION') === 0) {
+ *         // a validation error occurred
+ *         // likely some non-ascii characters were included in the billing
+ *         // address given name or surname fields, or the cardholdername field
+ *
+ *         // Instruct your user to check their data and try again
+ *       } else {
+ *         // an unknown lookup error occurred
+ *       }
+ *     } else {
+ *       // some other kind of error
+ *     }
+ *     return;
+ *   }
+ *
+ *   // handle success
+ * });
+ */
+ThreeDSecure.prototype.verifyCard = function (options) {
+  var privateOptions;
+
+  if (this.hasListener("lookup-complete")) {
+    privateOptions = {
+      ignoreOnLookupCompleteRequirement: true,
+    };
+  }
+
+  return this._framework.verifyCard(options, privateOptions);
+};
+
+/* eslint-disable-next-line valid-jsdoc */
+/**
+ * Launch the iframe challenge using a 3D Secure lookup response from a server side lookup.
+ *
+ * @public
+ * @param {(object|string)} lookupResponse The lookup response from the server side call to lookup the 3D Secure information. The raw string or a parsed object can be passed.
+ * @returns {Promise} Returns a promise.
+ * @example
+ * var my3DSContainer;
+ *
+ * threeDSecure.initializeChallengeWithLookupResponse(lookupResponseFromServer).then(function (payload) {
+ *   if (payload.liabilityShifted) {
+ *     // Liability has shifted
+ *     submitNonceToServer(payload.nonce);
+ *   } else if (payload.liabilityShiftPossible) {
+ *     // Liability may still be shifted
+ *     // Decide if you want to submit the nonce
+ *   } else {
+ *     // Liability has not shifted and will not shift
+ *     // Decide if you want to submit the nonce
+ *   }
+ * });
+ */
+ThreeDSecure.prototype.initializeChallengeWithLookupResponse = function (
+  lookupResponse
+) {
+  if (typeof lookupResponse === "string") {
+    lookupResponse = JSON.parse(lookupResponse);
+  }
+
+  return this._framework.initializeChallengeWithLookupResponse(lookupResponse);
+};
+
+/**
+ * Gather the data needed for a 3D Secure lookup call.
+ *
+ * @public
+ * @param {object} options Options for 3D Secure lookup.
+ * @param {string} options.nonce The nonce representing the card from a tokenization payload. For example, this can be a {@link HostedFields~tokenizePayload|tokenizePayload} returned by Hosted Fields under `payload.nonce`.
+ * @param {string} options.bin The numeric Bank Identification Number (bin) of the card from a tokenization payload. For example, this can be a {@link HostedFields~tokenizePayload|tokenizePayload} returned by Hosted Fields under `payload.details.bin`.
+ * @param {callback} [callback] The second argument, <code>data</code>, is a {@link ThreeDSecure~prepareLookupPayload|prepareLookupPayload}. If no callback is provided, it will return a promise that resolves {@link ThreeDSecure~prepareLookupPayload|prepareLookupPayload}.
+
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * <caption>Preparing data for a 3D Secure lookup</caption>
+ * threeDSecure.prepareLookup({
+ *   nonce: hostedFieldsTokenizationPayload.nonce,
+ *   bin: hostedFieldsTokenizationPayload.details.bin
+ * }, function (err, payload) {
+ *   if (err) {
+ *     console.error(err);
+ *     return;
+ *   }
+ *
+ *   // send payload to server to do server side lookup
+ * });
+ */
+ThreeDSecure.prototype.prepareLookup = function (options) {
+  return this._framework.prepareLookup(options).then(function (data) {
+    return JSON.stringify(data);
+  });
+};
+
+/**
+ * Cancel the 3DS flow and return the verification payload if available. If using 3D Secure version 2, this will not close the UI of the authentication modal. It is recommended that this method only be used in the {@link ThreeDSecure#event:lookup-complete|`lookup-complete`} event or the `onLookupComplete` callback.
+ * @public
+ * @param {callback} [callback] The second argument is a {@link ThreeDSecure~verifyPayload|verifyPayload}. If there is no verifyPayload (the initial lookup did not complete), an error will be returned. If no callback is passed, `cancelVerifyCard` will return a promise.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example <caption>Cancel the verification in `lookup-complete` event</caption>
+ * // set up listener after instantiation
+ * threeDSecure.on('lookup-complete', function (data, next) {
+ *   // determine if you want to call next to start the challenge,
+ *   // if not, call cancelVerifyCard
+ *   threeDSecure.cancelVerifyCard(function (err, verifyPayload) {
+ *     if (err) {
+ *       // Handle error
+ *       console.log(err.message); // No verification payload available
+ *       return;
+ *     }
+ *
+ *     verifyPayload.nonce; // The nonce returned from the 3ds lookup call
+ *     verifyPayload.liabilityShifted; // boolean
+ *     verifyPayload.liabilityShiftPossible; // boolean
+ *   });
+ * });
+ *
+ * // after tokenizing a credit card
+ * threeDSecure.verifyCard({
+ *   amount: '100.00',
+ *   nonce: nonceFromTokenizationPayload,
+ *   bin: binFromTokenizationPayload
+ *   // other fields such as billing address
+ * }, function (verifyError, payload) {
+ *   if (verifyError) {
+ *     if (verifyError.code === 'THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT ') {
+ *       // flow was canceled by merchant, 3ds info can be found in the payload
+ *       // for cancelVerifyCard
+ *     }
+ *   }
+ * });
+ * @example <caption>Cancel the verification in onLookupComplete callback</caption>
+ * threeDSecure.verifyCard({
+ *   amount: '100.00',
+ *   nonce: nonceFromTokenizationPayload,
+ *   bin: binFromTokenizationPayload,
+ *   // other fields such as billing address
+ *   onLookupComplete: function (data, next) {
+ *     // determine if you want to call next to start the challenge,
+ *     // if not, call cancelVerifyCard
+ *     threeDSecure.cancelVerifyCard(function (err, verifyPayload) {
+ *       if (err) {
+ *         // Handle error
+ *         console.log(err.message); // No verification payload available
+ *         return;
+ *       }
+ *
+ *       verifyPayload.nonce; // The nonce returned from the 3ds lookup call
+ *       verifyPayload.liabilityShifted; // boolean
+ *       verifyPayload.liabilityShiftPossible; // boolean
+ *     });
+ *   }
+ * }, function (verifyError, payload) {
+ *   if (verifyError) {
+ *     if (verifyError.code === 'THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT ') {
+ *       // flow was canceled by merchant, 3ds info can be found in the payload
+ *       // for cancelVerifyCard
+ *     }
+ *   }
+ * });
+ * @example <caption>Cancel the verification in 3D Secure version 1</caption>
+ * // unlike with v2, this will not cause `verifyCard` to error, it will simply
+ * // never call the callback
+ * threeDSecure.cancelVerifyCard(function (err, verifyPayload) {
+ *   if (err) {
+ *     // Handle error
+ *     console.log(err.message); // No verification payload available
+ *     return;
+ *   }
+ *
+ *   verifyPayload.nonce; // The nonce returned from the 3ds lookup call
+ *   verifyPayload.liabilityShifted; // boolean
+ *   verifyPayload.liabilityShiftPossible; // boolean
+ * });
+ */
+ThreeDSecure.prototype.cancelVerifyCard = function () {
+  return this._framework.cancelVerifyCard();
+};
+
+/**
+ * Cleanly remove anything set up by {@link module:braintree-web/three-d-secure.create|create}, with the exception that the Cardinal SDK, on window.Cardinal, will remain.
+ * @public
+ * @param {callback} [callback] Called on completion. If no callback is passed, `teardown` will return a promise.
+ * @example
+ * threeDSecure.teardown();
+ * @example <caption>With callback</caption>
+ * threeDSecure.teardown(function () {
+ *   // teardown is complete
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+ThreeDSecure.prototype.teardown = function () {
+  var methodNames = methods(ThreeDSecure.prototype).concat(
+    methods(EventEmitter.prototype)
+  );
+
+  convertMethodsToError(this, methodNames);
+
+  return this._framework.teardown();
+};
+
+module.exports = wrapPromise.wrapPrototype(ThreeDSecure);
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/three-d-secure_index.js.html b/3.111.1/three-d-secure_index.js.html new file mode 100644 index 00000000..fa461076 --- /dev/null +++ b/3.111.1/three-d-secure_index.js.html @@ -0,0 +1,375 @@ + + + + + + + + + + + three-d-secure/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ three-d-secure/index.js +

+ + + + + +
+
+
"use strict";
+/** @module braintree-web/three-d-secure */
+
+var ThreeDSecure = require("./external/three-d-secure");
+var isHTTPS = require("../lib/is-https").isHTTPS;
+var basicComponentVerification = require("../lib/basic-component-verification");
+var createDeferredClient = require("../lib/create-deferred-client");
+var createAssetsUrl = require("../lib/create-assets-url");
+var BraintreeError = require("../lib/braintree-error");
+var analytics = require("../lib/analytics");
+var errors = require("./shared/errors");
+var VERSION = process.env.npm_package_version;
+var wrapPromise = require("@braintree/wrap-promise");
+
+/**
+ * @static
+ * @function create
+ * @param {object} options Creation options:
+ * @param {object} [options.cardinalSDKConfig] A config for the underlying Cardinal SDK.
+ * @param {object} [options.cardinalSDKConfig.logging] The logging configuration for the Cardinal SDK. See [Cardinal's documentation for the logging object](https://cardinaldocs.atlassian.net/wiki/spaces/CC/pages/1409568/Configurations#Configurations-Logging) for more information.
+ * @param {number} [options.cardinalSDKConfig.timeout] The time in milliseconds to wait before a request to Cardinal's API times out. See [Cardinal's documentation for root level configuration](https://cardinaldocs.atlassian.net/wiki/spaces/CC/pages/1409568/Configurations#Configurations-RootLevelConfiguration) for more information.
+ * @param {number} [options.cardinalSDKConfig.maxRequestRetries] How many times a request should be re-attempted to Cardinal's API before giving up as a failure. See [Cardinal's documentation for root level configuration](https://cardinaldocs.atlassian.net/wiki/spaces/CC/pages/1409568/Configurations#Configurations-RootLevelConfiguration) for more information.
+ * @param {object} [options.cardinalSDKConfig.payment] An object to describe how you want the user interactions to behave. Only a subset of the [Cardinal SDK payment configuration object](https://cardinaldocs.atlassian.net/wiki/spaces/CC/pages/1409568/Configurations#Configurations-Payment) are supported: `displayLoading` and `displayExitButton`.
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {(number|string)} [options.version=1] The version of 3D Secure to use. Possible options:
+ * * 1 - The legacy 3D Secure v1.0 integration.
+ * * 2 - A 3D Secure v2.0 integration that uses a modal to host the 3D Secure iframe.
+ * * 2-bootstrap3-modal - A 3D Secure v2.0 integration that uses a modal styled with Bootstrap 3 styles to host the 3D Secure iframe. Requires having the Bootstrap 3 script files and stylesheets on your page.
+ * * 2-inline-iframe - A 3D Secure v2.0 integration that provides the authentication iframe directly to the merchant.
+ * @param {callback} [callback] The second argument, `data`, is the {@link ThreeDSecure} instance. If no callback is provided, it returns a promise that resolves the {@link ThreeDSecure} instance.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+@example
+ * <caption>Creating a v2 3D Secure component using 2 version (Cardinal modal)</caption>
+ * braintree.threeDSecure.create({
+ *   client: clientInstance,
+ *   version: '2'
+ * }, function (createError, threeDSecure) {
+ *   // set up lookup-complete listener
+ *   threeDSecure.on('lookup-complete', function (data, next) {
+ *     // check lookup data
+ *
+ *     next();
+ *   });
+ *
+ *   // using Hosted Fields, use `tokenize` to get back a credit card nonce
+ *
+ *   threeDSecure.verifyCard({
+ *     nonce: nonceFromTokenizationPayload,,
+ *     bin: binFromTokenizationPayload,
+ *     amount: '100.00'
+ *   }, function (verifyError, payload) {
+ *     // inspect payload
+ *     // send payload.nonce to your server
+ *   });
+ * });
+ * @example
+ * <caption>Creating a v2 3D Secure component using 2-bootstrap3-modal version</caption>
+ * // must have the boostrap js, css and jquery files on your page
+ * braintree.threeDSecure.create({
+ *   client: clientInstance,
+ *   version: '2-bootstrap3-modal'
+ * }, function (createError, threeDSecure) {
+ *   // set up lookup-complete listener
+ *   threeDSecure.on('lookup-complete', function (data, next) {
+ *     // check lookup data
+ *
+ *     next();
+ *   });
+ *
+ *   // using Hosted Fields, use `tokenize` to get back a credit card nonce
+ *
+ *   // challenge will be presented in a bootstrap 3 modal
+ *   threeDSecure.verifyCard({
+ *     nonce: nonceFromTokenizationPayload,
+ *     bin: binFromTokenizationPayload,
+ *     amount: '100.00'
+ *   }, function (verifyError, payload) {
+ *     // inspect payload
+ *     // send payload.nonce to your server
+ *   });
+ * });
+ * @example
+ * <caption>Creating a v2 3D Secure component using 2-inline-iframe version</caption>
+ * braintree.threeDSecure.create({
+ *   client: clientInstance,
+ *   version: '2-inline-iframe'
+ * }, function (createError, threeDSecure) {
+ *   // set up lookup-complete listener
+ *   threeDSecure.on('lookup-complete', function (data, next) {
+ *     // check lookup data
+ *
+ *     next();
+ *   });
+ *   // set up iframe listener
+ *   threeDSecure.on('authentication-iframe-available', function (event, next) {
+ *     var element = event.element; // an html element that contains the iframe
+ *
+ *     document.body.appendChild(element); // put it on your page
+ *
+ *     next(); // let the sdk know the element has been added to the page
+ *   });
+ *
+ *   // using Hosted Fields, use `tokenize` to get back a credit card nonce
+ *
+ *   threeDSecure.verifyCard({
+ *     nonce: nonceFromTokenizationPayload,,
+ *     bin: binFromTokenizationPayload,
+ *     amount: '100.00'
+ *   }, function (verifyError, payload) {
+ *     // inspect payload
+ *     // send payload.nonce to your server
+ *   });
+ * });
+ */
+function create(options) {
+  var name = "3D Secure";
+  var framework = getFramework(options);
+
+  return basicComponentVerification
+    .verify({
+      name: name,
+      client: options.client,
+      authorization: options.authorization,
+    })
+    .then(function () {
+      var assetsUrl = createAssetsUrl.create(options.authorization);
+      var createPromise = createDeferredClient
+        .create({
+          authorization: options.authorization,
+          client: options.client,
+          debug: options.debug,
+          assetsUrl: assetsUrl,
+          name: name,
+        })
+        .then(function (client) {
+          var error, isProduction;
+          var config = client.getConfiguration();
+          var gwConfig = config.gatewayConfiguration;
+
+          options.client = client;
+
+          if (!gwConfig.threeDSecureEnabled) {
+            error = errors.THREEDS_NOT_ENABLED;
+          }
+
+          if (config.authorizationType === "TOKENIZATION_KEY") {
+            error = errors.THREEDS_CAN_NOT_USE_TOKENIZATION_KEY;
+          }
+
+          isProduction = gwConfig.environment === "production";
+
+          if (isProduction && !isHTTPS()) {
+            error = errors.THREEDS_HTTPS_REQUIRED;
+          }
+
+          if (
+            framework !== "legacy" &&
+            !(
+              gwConfig.threeDSecure &&
+              gwConfig.threeDSecure.cardinalAuthenticationJWT
+            )
+          ) {
+            analytics.sendEvent(
+              options.client,
+              "three-d-secure.initialization.failed.missing-cardinalAuthenticationJWT"
+            );
+            error = errors.THREEDS_NOT_ENABLED_FOR_V2;
+          }
+
+          if (error) {
+            return Promise.reject(new BraintreeError(error));
+          }
+
+          analytics.sendEvent(options.client, "three-d-secure.initialized");
+
+          return client;
+        });
+      var instance = new ThreeDSecure({
+        client: options.client,
+        assetsUrl: assetsUrl,
+        createPromise: createPromise,
+        loggingEnabled: options.loggingEnabled,
+        cardinalSDKConfig: options.cardinalSDKConfig,
+        framework: framework,
+      });
+
+      if (options.client) {
+        return createPromise.then(function () {
+          return instance;
+        });
+      }
+
+      return instance;
+    });
+}
+
+function getFramework(options) {
+  var version = String(options.version || "");
+
+  if (!version || version === "1") {
+    throw new BraintreeError({
+      code: errors.THREEDS_UNSUPPORTED_VERSION.code,
+      type: errors.THREEDS_UNSUPPORTED_VERSION.type,
+      message: errors.THREEDS_UNSUPPORTED_VERSION.message,
+    });
+  }
+
+  switch (version) {
+    case "2":
+    case "2-cardinal-modal":
+      return "cardinal-modal";
+    case "2-bootstrap3-modal":
+      return "bootstrap3-modal";
+    case "2-inline-iframe":
+      return "inline-iframe";
+    default:
+      throw new BraintreeError({
+        code: errors.THREEDS_UNRECOGNIZED_VERSION.code,
+        type: errors.THREEDS_UNRECOGNIZED_VERSION.type,
+        message:
+          "Version `" +
+          options.version +
+          "` is not a recognized version. You may need to update the version of your Braintree SDK to support this version.",
+      });
+  }
+}
+
+module.exports = {
+  create: wrapPromise(create),
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/three-d-secure_shared_errors.js.html b/3.111.1/three-d-secure_shared_errors.js.html new file mode 100644 index 00000000..bfedeb61 --- /dev/null +++ b/3.111.1/three-d-secure_shared_errors.js.html @@ -0,0 +1,329 @@ + + + + + + + + + + + three-d-secure/shared/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ three-d-secure/shared/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.3D Secure - Creation Error Codes
+ * @description Errors that occur when [creating the 3D Secure component](./module-braintree-web_three-d-secure.html#.create).
+ * @property {MERCHANT} THREEDS_NOT_ENABLED Occurs when 3D Secure is not enabled in the Braintree control panel.
+ * @property {MERCHANT} THREEDS_CAN_NOT_USE_TOKENIZATION_KEY Occurs when 3D Secure component is created without a Client Token.
+ * @property {MERCHANT} THREEDS_HTTPS_REQUIRED Occurs when 3D Secure component is created in production over HTTPS.
+ * @property {MERCHANT} THREEDS_NOT_ENABLED_FOR_V2 Occurs when 3D Secure component is created with version 2 parameter, but merchant is not enabled to use version 2.
+ * @property {MERCHANT} THREEDS_UNRECOGNIZED_VERSION Occurs when unrecognized version enum is passed into the create call.
+ * @property {UNKNOWN} THREEDS_CARDINAL_SDK_SETUP_FAILED Occurs when Cardinal's Songbird.js library fails to setup for an unknown reason.
+ * @property {NETWORK} THREEDS_CARDINAL_SDK_SCRIPT_LOAD_FAILED Occurs when using version 2 and Cardinal's Songbird.js script could not be loaded.
+ * @property {UNKNOWN} THREEDS_CARDINAL_SDK_SETUP_TIMEDOUT Occurs when Cardinal's Songbird.js library takes longer than 60 seconds to set up.
+ * @property {UNKNOWN} THREEDS_CARDINAL_SDK_RESPONSE_TIMEDOUT Occurs when Cardinal sends a response indicating a timeout on /Validate, /Confirm, or /Continue.
+ * @property {MERCHANT} THREEDS_CARDINAL_SDK_BAD_CONFIG Occurs when there is no JWT in the request. Also when there's some other malformed aspect of config.
+ * @property {MERCHANT} THREEDS_CARDINAL_SDK_BAD_JWT Occurs when a malformed config causes a either a missing response JWT or a malformed Cardinal response.
+ * @property {UNKNOWN} THREEDS_CARDINAL_SDK_ERROR Occurs when a "general error" or a Cardinal hosted fields error happens. Description contains more details.
+ * @property {CUSTOMER} THREEDS_CARDINAL_SDK_CANCELED Occurs when customer cancels the transaction mid-flow, usually with alt-pays that have their own cancel buttons.
+ * @property {MERCHANT} THREEDS_UNSUPPORTED_VERSION Occurs when 3D Secure component is created with version 1 (or default version) parameter.
+ */
+
+/**
+ * @name BraintreeError.3D Secure - verifyCard Error Codes
+ * @description Errors that occur when using the [`verifyCard` method](./ThreeDSecure.html#verifyCard).
+ * @property {MERCHANT} THREEDS_AUTHENTICATION_IN_PROGRESS Occurs when another verification is already in progress.
+ * @property {MERCHANT} THREEDS_MISSING_VERIFY_CARD_OPTION Occurs when a required option is missing.
+ * @property {UNKNOWN} THREEDS_JWT_AUTHENTICATION_FAILED Occurs when something went wrong authenticating the JWT from the Cardinal SDK.
+ * @property {MERCHANT} THREEDS_LOOKUP_TOKENIZED_CARD_NOT_FOUND_ERROR Occurs when the supplied payment method nonce does not exist or the payment method nonce has already been consumed.
+ * @property {CUSTOMER} THREEDS_LOOKUP_VALIDATION_ERROR Occurs when a validation error occurs during the 3D Secure lookup.
+ * @property {UNKNOWN} THREEDS_LOOKUP_ERROR An unknown error occurred while attempting the 3D Secure lookup.
+ * @property {MERCHANT} THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT Occurs when the 3D Secure flow is canceled by the merchant using `cancelVerifyCard` (3D Secure v2 flows only).
+ * @property {UNKNOWN} THREEDS_INLINE_IFRAME_DETAILS_INCORRECT An unknown error occurred while attempting to use the inline iframe framework.
+ * @property {MERCHANT} THREEDS_REQUESTED_EXEMPTION_TYPE_INVALID Occurs when unrecognized exemption enum value is passed into verifyCard.
+ */
+
+/**
+ * @name BraintreeError.3D Secure - cancelVerifyCard Error Codes
+ * @description Errors that occur when using the [`cancelVerifyCard` method](./ThreeDSecure.html#cancelVerifyCard).
+ * @property {MERCHANT} THREEDS_NO_VERIFICATION_PAYLOAD Occurs when the 3D Secure flow is canceled, but there is no 3D Secure information available.
+ */
+
+/**
+ * @name BraintreeError.3D Secure - Internal Error Codes
+ * @ignore
+ * @description Errors that occur internally
+ * @property {INTERNAL} THREEDS_TERM_URL_REQUIRES_BRAINTREE_DOMAIN Occurs when iframe is initialized on a non-verified domain.
+ * @property {INTERNAL} THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED Occurs when a 3D Secure framework method is not implemented.
+ */
+
+var BraintreeError = require("../../lib/braintree-error");
+
+module.exports = {
+  THREEDS_NOT_ENABLED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "THREEDS_NOT_ENABLED",
+    message: "3D Secure is not enabled for this merchant.",
+  },
+  THREEDS_CAN_NOT_USE_TOKENIZATION_KEY: {
+    type: BraintreeError.types.MERCHANT,
+    code: "THREEDS_CAN_NOT_USE_TOKENIZATION_KEY",
+    message: "3D Secure can not use a tokenization key for authorization.",
+  },
+  THREEDS_HTTPS_REQUIRED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "THREEDS_HTTPS_REQUIRED",
+    message: "3D Secure requires HTTPS.",
+  },
+  THREEDS_NOT_ENABLED_FOR_V2: {
+    type: BraintreeError.types.MERCHANT,
+    code: "THREEDS_NOT_ENABLED_FOR_V2",
+    message:
+      "3D Secure version 2 is not enabled for this merchant. Contact Braintree Support for assistance at https://help.braintreepayments.com/",
+  },
+  THREEDS_UNRECOGNIZED_VERSION: {
+    type: BraintreeError.types.MERCHANT,
+    code: "THREEDS_UNRECOGNIZED_VERSION",
+  },
+  THREEDS_CARDINAL_SDK_SETUP_FAILED: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "THREEDS_CARDINAL_SDK_SETUP_FAILED",
+    message: "Something went wrong setting up Cardinal's Songbird.js library.",
+  },
+  THREEDS_CARDINAL_SDK_SCRIPT_LOAD_FAILED: {
+    type: BraintreeError.types.NETWORK,
+    code: "THREEDS_CARDINAL_SDK_SCRIPT_LOAD_FAILED",
+    message: "Cardinal's Songbird.js library could not be loaded.",
+  },
+  THREEDS_CARDINAL_SDK_SETUP_TIMEDOUT: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "THREEDS_CARDINAL_SDK_SETUP_TIMEDOUT",
+    message: "Cardinal's Songbird.js took too long to setup.",
+  },
+  THREEDS_CARDINAL_SDK_RESPONSE_TIMEDOUT: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "THREEDS_CARDINAL_SDK_RESPONSE_TIMEDOUT",
+    message: "Cardinal's API took too long to respond.",
+  },
+  THREEDS_CARDINAL_SDK_BAD_CONFIG: {
+    type: BraintreeError.types.MERCHANT,
+    code: "THREEDS_CARDINAL_SDK_BAD_CONFIG",
+    message:
+      "JWT or other required field missing. Please check your setup configuration.",
+  },
+  THREEDS_CARDINAL_SDK_BAD_JWT: {
+    type: BraintreeError.types.MERCHANT,
+    code: "THREEDS_CARDINAL_SDK_BAD_JWT",
+    message:
+      "Cardinal JWT missing or malformed. Please check your setup configuration.",
+  },
+  THREEDS_CARDINAL_SDK_ERROR: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "THREEDS_CARDINAL_SDK_ERROR",
+    message:
+      "A general error has occurred with Cardinal. See description for more information.",
+  },
+  THREEDS_CARDINAL_SDK_CANCELED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "THREEDS_CARDINAL_SDK_CANCELED",
+    message: "Canceled by user.",
+  },
+  THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT: {
+    type: BraintreeError.types.MERCHANT,
+    code: "THREEDS_VERIFY_CARD_CANCELED_BY_MERCHANT",
+    message: "3D Secure verfication canceled by merchant.",
+  },
+  THREEDS_AUTHENTICATION_IN_PROGRESS: {
+    type: BraintreeError.types.MERCHANT,
+    code: "THREEDS_AUTHENTICATION_IN_PROGRESS",
+    message:
+      "Cannot call verifyCard while existing authentication is in progress.",
+  },
+  THREEDS_MISSING_VERIFY_CARD_OPTION: {
+    type: BraintreeError.types.MERCHANT,
+    code: "THREEDS_MISSING_VERIFY_CARD_OPTION",
+  },
+  THREEDS_JWT_AUTHENTICATION_FAILED: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "THREEDS_JWT_AUTHENTICATION_FAILED",
+    message: "Something went wrong authenticating the JWT from Cardinal",
+  },
+  THREEDS_LOOKUP_TOKENIZED_CARD_NOT_FOUND_ERROR: {
+    type: BraintreeError.types.MERCHANT,
+    code: "THREEDS_LOOKUP_TOKENIZED_CARD_NOT_FOUND_ERROR",
+    message:
+      "Either the payment method nonce passed to `verifyCard` does not exist, or it was already consumed",
+  },
+  THREEDS_LOOKUP_VALIDATION_ERROR: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "THREEDS_LOOKUP_VALIDATION_ERROR",
+    message:
+      "The data passed in `verifyCard` did not pass validation checks. See details for more info",
+  },
+  THREEDS_LOOKUP_ERROR: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "THREEDS_LOOKUP_ERROR",
+    message: "Something went wrong during the 3D Secure lookup",
+  },
+  THREEDS_INLINE_IFRAME_DETAILS_INCORRECT: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "THREEDS_INLINE_IFRAME_DETAILS_INCORRECT",
+    message:
+      "Something went wrong when attempting to add the authentication iframe to the page.",
+  },
+  THREEDS_NO_VERIFICATION_PAYLOAD: {
+    type: BraintreeError.types.MERCHANT,
+    code: "THREEDS_NO_VERIFICATION_PAYLOAD",
+    message: "No verification payload available.",
+  },
+  THREEDS_TERM_URL_REQUIRES_BRAINTREE_DOMAIN: {
+    type: BraintreeError.types.INTERNAL,
+    code: "THREEDS_TERM_URL_REQUIRES_BRAINTREE_DOMAIN",
+    message: "Term Url must be on a Braintree domain.",
+  },
+  THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED: {
+    type: BraintreeError.types.INTERNAL,
+    code: "THREEDS_FRAMEWORK_METHOD_NOT_IMPLEMENTED",
+    message: "Method not implemented for this framework.",
+  },
+  THREEDS_REQUESTED_EXEMPTION_TYPE_INVALID: {
+    type: BraintreeError.types.MERCHANT,
+    code: "THREEDS_REQUESTED_EXEMPTION_TYPE_INVALID",
+    message: "Requested Exemption Type is invalid.",
+  },
+  THREEDS_UNSUPPORTED_VERSION: {
+    type: BraintreeError.types.MERCHANT,
+    code: "THREEDS_UNSUPPORTED_VERSION",
+    message:
+      "3D Secure `1` is deprecated and no longer supported. See available versions at https://braintree.github.io/braintree-web/current/module-braintree-web_three-d-secure.html#.create",
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/us-bank-account_errors.js.html b/3.111.1/us-bank-account_errors.js.html new file mode 100644 index 00000000..320b69f5 --- /dev/null +++ b/3.111.1/us-bank-account_errors.js.html @@ -0,0 +1,207 @@ + + + + + + + + + + + us-bank-account/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ us-bank-account/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.Us Bank Account - Creation Error Codes
+ * @description Errors that occur when [creating the Us Bank Account component](./module-braintree-web_us-bank-account.html#.create).
+ * @property {MERCHANT} US_BANK_ACCOUNT_NOT_ENABLED Occurs when US Bank Account is not enabled in the Braintree control panel.
+ */
+
+/**
+ * @name BraintreeError.Us Bank Account - tokenize Error Codes
+ * @description Errors that occur when using the [`tokenize` method](./UsBankAccount.html#tokenize).
+ * @property {MERCHANT} US_BANK_ACCOUNT_OPTION_REQUIRED Occurs when a required option is not passed.
+ * @property {MERCHANT} US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS Occurs when 1 or more incompatible options are passed.
+ * @property {NETWORK} US_BANK_ACCOUNT_LOGIN_LOAD_FAILED Occurs when bank login flow fails.
+ * @property {CUSTOMER} US_BANK_ACCOUNT_LOGIN_CLOSED Occurs when bank login window is closed.
+ * @property {MERCHANT} US_BANK_ACCOUNT_LOGIN_REQUEST_ACTIVE Occurs when a bank login flow is already active.
+ * @property {NETWORK} US_BANK_ACCOUNT_TOKENIZATION_NETWORK_ERROR Occurs when payment details could not be tokenized.
+ * @property {CUSTOMER} US_BANK_ACCOUNT_FAILED_TOKENIZATION Occurs when payment details failed to be tokenized.
+ * @property {MERCHANT} US_BANK_ACCOUNT_BANK_LOGIN_NOT_ENABLED Occurs when bank login flow is not enabled in the Braintree control panel.
+ */
+
+var BraintreeError = require("../lib/braintree-error");
+
+module.exports = {
+  US_BANK_ACCOUNT_OPTION_REQUIRED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "US_BANK_ACCOUNT_OPTION_REQUIRED",
+  },
+  US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS: {
+    type: BraintreeError.types.MERCHANT,
+    code: "US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS",
+  },
+  US_BANK_ACCOUNT_LOGIN_LOAD_FAILED: {
+    type: BraintreeError.types.NETWORK,
+    code: "US_BANK_ACCOUNT_LOGIN_LOAD_FAILED",
+    message: "Bank login flow failed to load.",
+  },
+  US_BANK_ACCOUNT_LOGIN_CLOSED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "US_BANK_ACCOUNT_LOGIN_CLOSED",
+    message: "Customer closed bank login flow before authorizing.",
+  },
+  US_BANK_ACCOUNT_LOGIN_REQUEST_ACTIVE: {
+    type: BraintreeError.types.MERCHANT,
+    code: "US_BANK_ACCOUNT_LOGIN_REQUEST_ACTIVE",
+    message: "Another bank login tokenization request is active.",
+  },
+  US_BANK_ACCOUNT_TOKENIZATION_NETWORK_ERROR: {
+    type: BraintreeError.types.NETWORK,
+    code: "US_BANK_ACCOUNT_TOKENIZATION_NETWORK_ERROR",
+    message: "A tokenization network error occurred.",
+  },
+  US_BANK_ACCOUNT_FAILED_TOKENIZATION: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "US_BANK_ACCOUNT_FAILED_TOKENIZATION",
+    message: "The supplied data failed tokenization.",
+  },
+  US_BANK_ACCOUNT_NOT_ENABLED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "US_BANK_ACCOUNT_NOT_ENABLED",
+    message: "US bank account is not enabled.",
+  },
+  US_BANK_ACCOUNT_BANK_LOGIN_NOT_ENABLED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "US_BANK_ACCOUNT_BANK_LOGIN_NOT_ENABLED",
+    message: "Bank login is not enabled.",
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/us-bank-account_index.js.html b/3.111.1/us-bank-account_index.js.html new file mode 100644 index 00000000..74e42b9e --- /dev/null +++ b/3.111.1/us-bank-account_index.js.html @@ -0,0 +1,206 @@ + + + + + + + + + + + us-bank-account/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ us-bank-account/index.js +

+ + + + + +
+
+
"use strict";
+/**
+ * @module braintree-web/us-bank-account
+ * @description This module is for accepting payments of US bank accounts.
+ */
+
+var basicComponentVerification = require("../lib/basic-component-verification");
+var BraintreeError = require("../lib/braintree-error");
+var createDeferredClient = require("../lib/create-deferred-client");
+var createAssetsUrl = require("../lib/create-assets-url");
+var errors = require("./errors");
+var USBankAccount = require("./us-bank-account");
+var VERSION = process.env.npm_package_version;
+var wrapPromise = require("@braintree/wrap-promise");
+
+/**
+ * @static
+ * @function create
+ * @param {object} options Creation options:
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {callback} [callback] The second argument, `data`, is the {@link USBankAccount} instance. If no callback is provided, `create` returns a promise that resolves with the {@link USBankAccount} instance.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+function create(options) {
+  var name = "US Bank Account";
+
+  return basicComponentVerification
+    .verify({
+      name: name,
+      client: options.client,
+      authorization: options.authorization,
+    })
+    .then(function () {
+      return createDeferredClient.create({
+        authorization: options.authorization,
+        client: options.client,
+        debug: options.debug,
+        assetsUrl: createAssetsUrl.create(options.authorization),
+        name: name,
+      });
+    })
+    .then(function (client) {
+      var usBankAccount;
+
+      options.client = client;
+
+      usBankAccount =
+        options.client.getConfiguration().gatewayConfiguration.usBankAccount;
+      if (!usBankAccount) {
+        return Promise.reject(
+          new BraintreeError(errors.US_BANK_ACCOUNT_NOT_ENABLED)
+        );
+      }
+
+      return new USBankAccount(options);
+    });
+}
+
+module.exports = {
+  create: wrapPromise(create),
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/us-bank-account_us-bank-account.js.html b/3.111.1/us-bank-account_us-bank-account.js.html new file mode 100644 index 00000000..34205152 --- /dev/null +++ b/3.111.1/us-bank-account_us-bank-account.js.html @@ -0,0 +1,673 @@ + + + + + + + + + + + us-bank-account/us-bank-account.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ us-bank-account/us-bank-account.js +

+ + + + + +
+
+
"use strict";
+
+var BraintreeError = require("../lib/braintree-error");
+var constants = require("./constants");
+var errors = require("./errors");
+var sharedErrors = require("../lib/errors");
+var analytics = require("../lib/analytics");
+var once = require("../lib/once");
+var convertMethodsToError = require("../lib/convert-methods-to-error");
+var methods = require("../lib/methods");
+var wrapPromise = require("@braintree/wrap-promise");
+
+var TOKENIZE_BANK_DETAILS_MUTATION = createGraphQLMutation("UsBankAccount");
+var TOKENIZE_BANK_LOGIN_MUTATION = createGraphQLMutation("UsBankLogin");
+
+/**
+ * @typedef {object} USBankAccount~tokenizePayload
+ * @property {string} nonce The payment method nonce.
+ * @property {string} type The payment method type, always `us_bank_account`.
+ * @property {object} details Additional account details. Currently empty.
+ */
+
+/**
+ * @class
+ * @param {object} options See {@link module:braintree-web/us-bank-account.create|us-bank-account.create}.
+ * @classdesc This class represents a US Bank Account component. Instances of this class can tokenize raw bank details or present a bank login. <strong>You cannot use this constructor directly. Use {@link module:braintree-web/us-bank-account.create|braintree.us-bank-account.create} instead.</strong>
+ */
+function USBankAccount(options) {
+  this._client = options.client;
+
+  this._isTokenizingBankLogin = false;
+
+  analytics.sendEvent(this._client, "usbankaccount.initialized");
+}
+
+/**
+ * Tokenizes bank information to return a payment method nonce. You can tokenize bank details by providing information like account and routing numbers. You can also tokenize with a bank login UI that prompts the customer to log into their bank account.
+ * @public
+ * @param {object} options All tokenization options for the US Bank Account component.
+ * @param {string} options.mandateText A string for proof of customer authorization. For example, `'I authorize Braintree to debit my bank account on behalf of My Online Store.'`.
+ * @param {object} [options.bankDetails] Bank detail information (such as account and routing numbers). `bankDetails` or `bankLogin` option must be provided.
+ * @param {string} options.bankDetails.routingNumber The customer's bank routing number, such as `'307075259'`.
+ * @param {string} options.bankDetails.accountNumber The customer's bank account number, such as `'999999999'`.
+ * @param {string} options.bankDetails.accountType The customer's bank account type. Must be `'checking'` or `'savings'`.
+ * @param {string} options.bankDetails.ownershipType The customer's bank account ownership type. Must be `'personal'` or `'business'`.
+ * @param {string} [options.bankDetails.firstName] The customer's first name. Required when account ownership type is `personal`.
+ * @param {string} [options.bankDetails.lastName] The customer's last name. Required when account ownership type is `personal`.
+ * @param {string} [options.bankDetails.businessName] The customer's business name. Required when account ownership type is `business`.
+ * @param {object} options.bankDetails.billingAddress The customer's billing address.
+ * @param {string} options.bankDetails.billingAddress.streetAddress The street address for the customer's billing address, such as `'123 Fake St'`.
+ * @param {string} [options.bankDetails.billingAddress.extendedAddress] The extended street address for the customer's billing address, such as `'Apartment B'`.
+ * @param {string} options.bankDetails.billingAddress.locality The locality for the customer's billing address. This is typically a city, such as `'San Francisco'`.
+ * @param {string} options.bankDetails.billingAddress.region The region for the customer's billing address. This is typically a state, such as `'CA'`.
+ * @param {string} options.bankDetails.billingAddress.postalCode The postal code for the customer's billing address. This is typically a ZIP code, such as `'94119'`.
+ * @param {object} [options.bankLogin] Bank login information. `bankLogin` or `bankDetails` option must be provided.
+ * @param {string} options.bankLogin.displayName Display name for the bank login UI, such as `'My Store'`.
+ * @param {string} options.bankLogin.ownershipType The customer's bank account ownership type. Must be `'personal'` or `'business'`.
+ * @param {string} [options.bankLogin.firstName] The customer's first name. Required when account ownership type is `personal`.
+ * @param {string} [options.bankLogin.lastName] The customer's last name. Required when account ownership type is `personal`.
+ * @param {string} [options.bankLogin.businessName] The customer's business name. Required when account ownership type is `business`.
+ * @param {object} options.bankLogin.billingAddress The customer's billing address.
+ * @param {string} options.bankLogin.billingAddress.streetAddress The street address for the customer's billing address, such as `'123 Fake St'`.
+ * @param {string} [options.bankLogin.billingAddress.extendedAddress] The extended street address for the customer's billing address, such as `'Apartment B'`.
+ * @param {string} options.bankLogin.billingAddress.locality The locality for the customer's billing address. This is typically a city, such as `'San Francisco'`.
+ * @param {string} options.bankLogin.billingAddress.region The region for the customer's billing address. This is typically a state, such as `'CA'`.
+ * @param {string} options.bankLogin.billingAddress.postalCode The postal code for the customer's billing address. This is typically a ZIP code, such as `'94119'`.
+ * @param {callback} [callback] The second argument, <code>data</code>, is a {@link USBankAccount~tokenizePayload|tokenizePayload}. If no callback is provided, `tokenize` returns a promise that resolves with {@link USBankAccount~tokenizePayload|tokenizePayload}.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * <caption>Tokenizing raw bank details</caption>
+ * var routingNumberInput = document.querySelector('input[name="routing-number"]');
+ * var accountNumberInput = document.querySelector('input[name="account-number"]');
+ * var accountTypeInput = document.querySelector('input[name="account-type"]:checked');
+ * var ownershipTypeInput = document.querySelector('input[name="ownership-type"]:checked');
+ * var firstNameInput = document.querySelector('input[name="first-name"]');
+ * var lastNameInput = document.querySelector('input[name="last-name"]');
+ * var businessNameInput = document.querySelector('input[name="business-name"]');
+ * var billingAddressStreetInput = document.querySelector('input[name="street-address"]');
+ * var billingAddressExtendedInput = document.querySelector('input[name="extended-address"]');
+ * var billingAddressLocalityInput = document.querySelector('input[name="locality"]');
+ * var billingAddressRegionSelect = document.querySelector('select[name="region"]');
+ * var billingAddressPostalInput = document.querySelector('input[name="postal-code"]');
+ *
+ * submitButton.addEventListener('click', function (event) {
+ *   var bankDetails = {
+ *     routingNumber: routingNumberInput.value,
+ *     accountNumber: accountNumberInput.value,
+ *     accountType: accountTypeInput.value,
+ *     ownershipType: ownershipTypeInput.value,
+ *     billingAddress: {
+ *       streetAddress: billingAddressStreetInput.value,
+ *       extendedAddress: billingAddressExtendedInput.value,
+ *       locality: billingAddressLocalityInput.value,
+ *       region: billingAddressRegionSelect.value,
+ *       postalCode: billingAddressPostalInput.value
+ *     }
+ *   };
+ *
+ *   if (bankDetails.ownershipType === 'personal') {
+ *     bankDetails.firstName = firstNameInput.value;
+ *     bankDetails.lastName = lastNameInput.value;
+ *   } else {
+ *     bankDetails.businessName = businessNameInput.value;
+ *   }
+ *
+ *   event.preventDefault();
+ *
+ *   usBankAccountInstance.tokenize({
+ *     bankDetails: bankDetails,
+ *     mandateText: 'I authorize Braintree to debit my bank account on behalf of My Online Store.'
+ *   }, function (tokenizeErr, tokenizedPayload) {
+ *     if (tokenizeErr) {
+ *       console.error('There was an error tokenizing the bank details.');
+ *       return;
+ *     }
+ *
+ *     // Send tokenizePayload.nonce to your server here!
+ *   });
+ * });
+ * @example
+ * <caption>Tokenizing with bank login UI</caption>
+ * var ownershipTypeInput = document.querySelector('input[name="ownership-type"]:checked');
+ * var firstNameInput = document.querySelector('input[name="first-name"]');
+ * var lastNameInput = document.querySelector('input[name="last-name"]');
+ * var businessNameInput = document.querySelector('input[name="business-name"]');
+ * var billingAddressStreetInput = document.querySelector('input[name="street-address"]');
+ * var billingAddressExtendedInput = document.querySelector('input[name="extended-address"]');
+ * var billingAddressLocalityInput = document.querySelector('input[name="locality"]');
+ * var billingAddressRegionSelect = document.querySelector('select[name="region"]');
+ * var billingAddressPostalInput = document.querySelector('input[name="postal-code"]');
+ *
+ * bankLoginButton.addEventListener('click', function (event) {
+ *   var bankLogin = {
+ *     displayName: 'My Online Store',
+ *     ownershipType: ownershipTypeInput.value,
+ *     billingAddress: {
+ *       streetAddress: billingAddressStreetInput.value,
+ *       extendedAddress: billingAddressExtendedInput.value,
+ *       locality: billingAddressLocalityInput.value,
+ *       region: billingAddressRegionSelect.value,
+ *       postalCode: billingAddressPostalInput.value
+ *     }
+ *   }
+ *   event.preventDefault();
+ *
+ *   if (bankLogin.ownershipType === 'personal') {
+ *     bankLogin.firstName = firstNameInput.value;
+ *     bankLogin.lastName = lastNameInput.value;
+ *   } else {
+ *     bankLogin.businessName = businessNameInput.value;
+ *   }
+ *
+ *   usBankAccountInstance.tokenize({
+ *     bankLogin: bankLogin,
+ *     mandateText: 'I authorize Braintree to debit my bank account on behalf of My Online Store.'
+ *   }, function (tokenizeErr, tokenizedPayload) {
+ *     if (tokenizeErr) {
+ *       console.error('There was an error tokenizing the bank details.');
+ *       return;
+ *     }
+ *
+ *     // Send tokenizePayload.nonce to your server here!
+ *   });
+ * });
+ */
+USBankAccount.prototype.tokenize = function (options) {
+  options = options || {};
+
+  if (!options.mandateText) {
+    return Promise.reject(
+      new BraintreeError({
+        type: errors.US_BANK_ACCOUNT_OPTION_REQUIRED.type,
+        code: errors.US_BANK_ACCOUNT_OPTION_REQUIRED.code,
+        message: "mandateText property is required.",
+      })
+    );
+  }
+
+  if (options.bankDetails && options.bankLogin) {
+    return Promise.reject(
+      new BraintreeError({
+        type: errors.US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS.type,
+        code: errors.US_BANK_ACCOUNT_MUTUALLY_EXCLUSIVE_OPTIONS.code,
+        message:
+          "tokenize must be called with bankDetails or bankLogin, not both.",
+      })
+    );
+  } else if (options.bankDetails) {
+    return this._tokenizeBankDetails(options);
+  } else if (options.bankLogin) {
+    return this._tokenizeBankLogin(options);
+  }
+
+  return Promise.reject(
+    new BraintreeError({
+      type: errors.US_BANK_ACCOUNT_OPTION_REQUIRED.type,
+      code: errors.US_BANK_ACCOUNT_OPTION_REQUIRED.code,
+      message: "tokenize must be called with bankDetails or bankLogin.",
+    })
+  );
+};
+
+USBankAccount.prototype._tokenizeBankDetails = function (options) {
+  var client = this._client;
+  var bankDetails = options.bankDetails;
+  var data = {
+    achMandate: options.mandateText,
+    routingNumber: bankDetails.routingNumber,
+    accountNumber: bankDetails.accountNumber,
+    accountType: bankDetails.accountType.toUpperCase(),
+    billingAddress: formatBillingAddressForGraphQL(
+      bankDetails.billingAddress || {}
+    ),
+  };
+
+  formatDataForOwnershipType(data, bankDetails);
+
+  return client
+    .request({
+      api: "graphQLApi",
+      data: {
+        query: TOKENIZE_BANK_DETAILS_MUTATION,
+        variables: {
+          input: {
+            usBankAccount: data,
+          },
+        },
+      },
+    })
+    .then(function (response) {
+      analytics.sendEvent(
+        client,
+        "usbankaccount.bankdetails.tokenization.succeeded"
+      );
+
+      return Promise.resolve(
+        formatTokenizeResponseFromGraphQL(response, "tokenizeUsBankAccount")
+      );
+    })
+    .catch(function (err) {
+      var error = errorFrom(err);
+
+      analytics.sendEvent(
+        client,
+        "usbankaccount.bankdetails.tokenization.failed"
+      );
+
+      return Promise.reject(error);
+    });
+};
+
+USBankAccount.prototype._tokenizeBankLogin = function (options) {
+  var self = this;
+  var client = this._client;
+  var gatewayConfiguration = client.getConfiguration().gatewayConfiguration;
+  var isProduction = gatewayConfiguration.environment === "production";
+  var plaidConfig = gatewayConfiguration.usBankAccount.plaid;
+
+  if (!options.bankLogin.displayName) {
+    return Promise.reject(
+      new BraintreeError({
+        type: errors.US_BANK_ACCOUNT_OPTION_REQUIRED.type,
+        code: errors.US_BANK_ACCOUNT_OPTION_REQUIRED.code,
+        message: "displayName property is required when using bankLogin.",
+      })
+    );
+  }
+
+  if (!plaidConfig) {
+    return Promise.reject(
+      new BraintreeError(errors.US_BANK_ACCOUNT_BANK_LOGIN_NOT_ENABLED)
+    );
+  }
+
+  if (this._isTokenizingBankLogin) {
+    return Promise.reject(
+      new BraintreeError(errors.US_BANK_ACCOUNT_LOGIN_REQUEST_ACTIVE)
+    );
+  }
+  this._isTokenizingBankLogin = true;
+
+  return new Promise(function (resolve, reject) {
+    self._loadPlaid(function (plaidLoadErr, plaid) {
+      if (plaidLoadErr) {
+        reject(plaidLoadErr);
+
+        return;
+      }
+
+      plaid
+        .create({
+          clientName: options.bankLogin.displayName,
+          apiVersion: "v2",
+          env: isProduction ? "production" : "sandbox",
+          key: plaidConfig.publicKey,
+          product: "auth",
+          selectAccount: true,
+          onExit: function () {
+            self._isTokenizingBankLogin = false;
+
+            analytics.sendEvent(
+              client,
+              "usbankaccount.banklogin.tokenization.closed.by-user"
+            );
+
+            reject(new BraintreeError(errors.US_BANK_ACCOUNT_LOGIN_CLOSED));
+          },
+          onSuccess: function (publicToken, metadata) {
+            var bankLogin = options.bankLogin;
+            var data = {
+              publicToken: publicToken,
+              accountId: isProduction
+                ? metadata.account_id
+                : "plaid_account_id",
+              accountType: metadata.account.subtype.toUpperCase(),
+              achMandate: options.mandateText,
+              billingAddress: formatBillingAddressForGraphQL(
+                bankLogin.billingAddress || {}
+              ),
+            };
+
+            formatDataForOwnershipType(data, bankLogin);
+
+            client
+              .request({
+                api: "graphQLApi",
+                data: {
+                  query: TOKENIZE_BANK_LOGIN_MUTATION,
+                  variables: {
+                    input: {
+                      usBankLogin: data,
+                    },
+                  },
+                },
+              })
+              .then(function (response) {
+                self._isTokenizingBankLogin = false;
+
+                analytics.sendEvent(
+                  client,
+                  "usbankaccount.banklogin.tokenization.succeeded"
+                );
+
+                resolve(
+                  formatTokenizeResponseFromGraphQL(
+                    response,
+                    "tokenizeUsBankLogin"
+                  )
+                );
+              })
+              .catch(function (tokenizeErr) {
+                var error;
+
+                self._isTokenizingBankLogin = false;
+                error = errorFrom(tokenizeErr);
+
+                analytics.sendEvent(
+                  client,
+                  "usbankaccount.banklogin.tokenization.failed"
+                );
+
+                reject(error);
+              });
+          },
+        })
+        .open();
+
+      analytics.sendEvent(
+        client,
+        "usbankaccount.banklogin.tokenization.started"
+      );
+    });
+  });
+};
+
+function errorFrom(err) {
+  var error;
+  var status = err.details && err.details.httpStatus;
+
+  if (status === 401) {
+    error = new BraintreeError(sharedErrors.BRAINTREE_API_ACCESS_RESTRICTED);
+  } else if (status < 500) {
+    error = new BraintreeError(errors.US_BANK_ACCOUNT_FAILED_TOKENIZATION);
+  } else {
+    error = new BraintreeError(
+      errors.US_BANK_ACCOUNT_TOKENIZATION_NETWORK_ERROR
+    );
+  }
+  error.details = { originalError: err };
+
+  return error;
+}
+
+function formatTokenizeResponseFromGraphQL(response, type) {
+  var data = response.data[type].paymentMethod;
+  var last4 = data.details.last4;
+  var description = "US bank account ending in - " + last4;
+
+  return {
+    nonce: data.id,
+    details: {},
+    description: description,
+    type: "us_bank_account",
+  };
+}
+
+USBankAccount.prototype._loadPlaid = function (callback) {
+  var existingScript, script;
+
+  callback = once(callback);
+
+  if (window.Plaid) {
+    callback(null, window.Plaid);
+
+    return;
+  }
+
+  existingScript = document.querySelector(
+    'script[src="' + constants.PLAID_LINK_JS + '"]'
+  );
+
+  if (existingScript) {
+    addLoadListeners(existingScript, callback);
+  } else {
+    script = document.createElement("script");
+
+    script.src = constants.PLAID_LINK_JS;
+    script.async = true;
+
+    addLoadListeners(script, callback);
+
+    document.body.appendChild(script);
+
+    this._plaidScript = script;
+  }
+};
+
+function addLoadListeners(script, callback) {
+  function loadHandler() {
+    var readyState = this.readyState; // eslint-disable-line no-invalid-this
+
+    if (!readyState || readyState === "loaded" || readyState === "complete") {
+      removeLoadListeners();
+      callback(null, window.Plaid);
+    }
+  }
+
+  function errorHandler() {
+    script.parentNode.removeChild(script);
+
+    callback(new BraintreeError(errors.US_BANK_ACCOUNT_LOGIN_LOAD_FAILED));
+  }
+
+  function removeLoadListeners() {
+    script.removeEventListener("error", errorHandler);
+    script.removeEventListener("load", loadHandler);
+    script.removeEventListener("readystatechange", loadHandler);
+  }
+
+  script.addEventListener("error", errorHandler);
+  script.addEventListener("load", loadHandler);
+  script.addEventListener("readystatechange", loadHandler);
+}
+
+function formatBillingAddressForGraphQL(address) {
+  return {
+    streetAddress: address.streetAddress,
+    extendedAddress: address.extendedAddress,
+    city: address.locality,
+    state: address.region,
+    zipCode: address.postalCode,
+  };
+}
+
+function formatDataForOwnershipType(data, details) {
+  if (details.ownershipType === "personal") {
+    data.individualOwner = {
+      firstName: details.firstName,
+      lastName: details.lastName,
+    };
+  } else if (details.ownershipType === "business") {
+    data.businessOwner = {
+      businessName: details.businessName,
+    };
+  }
+}
+
+function createGraphQLMutation(type) {
+  return (
+    "" +
+    "mutation Tokenize" +
+    type +
+    "($input: Tokenize" +
+    type +
+    "Input!) {" +
+    "  tokenize" +
+    type +
+    "(input: $input) {" +
+    "    paymentMethod {" +
+    "      id" +
+    "      details {" +
+    "        ... on UsBankAccountDetails {" +
+    "          last4" +
+    "        }" +
+    "      }" +
+    "    }" +
+    "  }" +
+    "}"
+  );
+}
+
+/**
+ * Cleanly tear down anything set up by {@link module:braintree-web/us-bank-account.create|create}.
+ * @public
+ * @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
+ * @example
+ * usBankAccountInstance.teardown();
+ * @example <caption>With callback</caption>
+ * usBankAccountInstance.teardown(function () {
+ *   // teardown is complete
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+USBankAccount.prototype.teardown = function () {
+  if (this._plaidScript) {
+    document.body.removeChild(this._plaidScript);
+  }
+
+  convertMethodsToError(this, methods(USBankAccount.prototype));
+
+  return Promise.resolve();
+};
+
+module.exports = wrapPromise.wrapPrototype(USBankAccount);
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/vault-manager_errors.js.html b/3.111.1/vault-manager_errors.js.html new file mode 100644 index 00000000..d772d84b --- /dev/null +++ b/3.111.1/vault-manager_errors.js.html @@ -0,0 +1,167 @@ + + + + + + + + + + + vault-manager/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ vault-manager/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.Vault Manager - deletePaymentMethod Error Codes
+ * @description Errors that occur when using the [`deletePaymentMethod` method](./VaultManager.html#deletePaymentMethod).
+ * @property {MERCHANT} VAULT_MANAGER_DELETE_PAYMENT_METHOD_NONCE_REQUIRES_CLIENT_TOKEN Occurs when vault manager is initialized with a tokenization key instead of a Client Token.
+ * @property {MERCHANT} VAULT_MANAGER_PAYMENT_METHOD_NONCE_NOT_FOUND Occurs when the specified payment method can not be found.
+ * @property {UNKNOWN} VAULT_MANAGER_DELETE_PAYMENT_METHOD_UNKNOWN_ERROR Occurs when there is an error attempting to delete the payment method.
+ */
+
+var BraintreeError = require("../lib/braintree-error");
+
+module.exports = {
+  VAULT_MANAGER_DELETE_PAYMENT_METHOD_NONCE_REQUIRES_CLIENT_TOKEN: {
+    type: BraintreeError.types.MERCHANT,
+    code: "VAULT_MANAGER_DELETE_PAYMENT_METHOD_NONCE_REQUIRES_CLIENT_TOKEN",
+    message:
+      "A client token with a customer id must be used to delete a payment method nonce.",
+  },
+  VAULT_MANAGER_PAYMENT_METHOD_NONCE_NOT_FOUND: {
+    type: BraintreeError.types.MERCHANT,
+    code: "VAULT_MANAGER_PAYMENT_METHOD_NONCE_NOT_FOUND",
+  },
+  VAULT_MANAGER_DELETE_PAYMENT_METHOD_UNKNOWN_ERROR: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "VAULT_MANAGER_DELETE_PAYMENT_METHOD_UNKNOWN_ERROR",
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/vault-manager_index.js.html b/3.111.1/vault-manager_index.js.html new file mode 100644 index 00000000..49773927 --- /dev/null +++ b/3.111.1/vault-manager_index.js.html @@ -0,0 +1,191 @@ + + + + + + + + + + + vault-manager/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ vault-manager/index.js +

+ + + + + +
+
+
"use strict";
+/**
+ * @module braintree-web/vault-manager
+ * @description Manages customer's payment methods.
+ */
+
+var basicComponentVerification = require("../lib/basic-component-verification");
+var createDeferredClient = require("../lib/create-deferred-client");
+var createAssetsUrl = require("../lib/create-assets-url");
+var VaultManager = require("./vault-manager");
+var VERSION = process.env.npm_package_version;
+var wrapPromise = require("@braintree/wrap-promise");
+
+/**
+ * @static
+ * @function create
+ * @param {object} options Creation options:
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {callback} callback The second argument, `data`, is the {@link VaultManager} instance.
+ * @returns {void}
+ */
+function create(options) {
+  var name = "Vault Manager";
+
+  return basicComponentVerification
+    .verify({
+      name: name,
+      client: options.client,
+      authorization: options.authorization,
+    })
+    .then(function () {
+      return new VaultManager({
+        createPromise: createDeferredClient.create({
+          authorization: options.authorization,
+          client: options.client,
+          debug: options.debug,
+          assetsUrl: createAssetsUrl.create(options.authorization),
+          name: name,
+        }),
+      });
+    });
+}
+
+module.exports = {
+  create: wrapPromise(create),
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/vault-manager_vault-manager.js.html b/3.111.1/vault-manager_vault-manager.js.html new file mode 100644 index 00000000..bfde4605 --- /dev/null +++ b/3.111.1/vault-manager_vault-manager.js.html @@ -0,0 +1,354 @@ + + + + + + + + + + + vault-manager/vault-manager.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ vault-manager/vault-manager.js +

+ + + + + +
+
+
"use strict";
+
+var analytics = require("../lib/analytics");
+var BraintreeError = require("../lib/braintree-error");
+var errors = require("./errors");
+var convertMethodsToError = require("../lib/convert-methods-to-error");
+var methods = require("../lib/methods");
+var wrapPromise = require("@braintree/wrap-promise");
+
+var DELETE_PAYMENT_METHOD_MUTATION =
+  "mutation DeletePaymentMethodFromSingleUseToken($input: DeletePaymentMethodFromSingleUseTokenInput!) {" +
+  "  deletePaymentMethodFromSingleUseToken(input: $input) {" +
+  "    clientMutationId" +
+  "  }" +
+  "}";
+
+/**
+ * @typedef {array} VaultManager~fetchPaymentMethodsPayload The customer's payment methods.
+ * @property {object} paymentMethod The payment method object.
+ * @property {string} paymentMethod.nonce A nonce that can be sent to your server to transact on the payment method.
+ * @property {boolean} paymentMethod.default Whether or not this is the default payment method for the customer.
+ * @property {object} paymentMethod.details Any additional details about the payment method. Varies depending on the type of payment method.
+ * @property {string} paymentMethod.type A constant indicating the type of payment method.
+ * @property {?string} paymentMethod.description Additional description about the payment method.
+ * @property {?object} paymentMethod.binData Bin data about the payment method.
+ *
+ */
+
+/**
+ * @class
+ * @param {object} options Options
+ * @description <strong>You cannot use this constructor directly. Use {@link module:braintree-web/vault-manager.create|braintree.vault-manager.create} instead.</strong>
+ * @classdesc This class allows you to manage a customer's payment methods on the client.
+ */
+function VaultManager(options) {
+  this._createPromise = options.createPromise;
+}
+
+/**
+ * Fetches payment methods owned by the customer whose id was used to generate the client token used to create the {@link module:braintree-web/client|client}.
+ * @public
+ * @param {object} [options] Options for fetching payment methods.
+ * @param {boolean} [options.defaultFirst = false] If `true`, the payment methods will be returned with the default payment method for the customer first. Otherwise, order is not guaranteed.
+ * @param {callback} [callback] The second argument is a {@link VaultManager~fetchPaymentMethodsPayload|fetchPaymentMethodsPayload}. This is also what is resolved by the promise if no callback is provided.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * vaultManagerInstance.fetchPaymentMethods(function (err, paymentMethods) {
+ *   paymentMethods.forEach(function (paymentMethod) {
+ *     // add payment method to UI
+ *     // paymentMethod.nonce <- transactable nonce associated with payment method
+ *     // paymentMethod.details <- object with additional information about payment method
+ *     // paymentMethod.type <- a constant signifying the type
+ *   });
+ * });
+ */
+VaultManager.prototype.fetchPaymentMethods = function (options) {
+  var defaultFirst;
+
+  options = options || {};
+
+  defaultFirst = options.defaultFirst === true ? 1 : 0;
+
+  return this._createPromise
+    .then(function (client) {
+      return client.request({
+        endpoint: "payment_methods",
+        method: "get",
+        data: {
+          defaultFirst: defaultFirst,
+        },
+      });
+    })
+    .then(
+      function (paymentMethodsPayload) {
+        analytics.sendEvent(
+          this._createPromise,
+          "vault-manager.fetch-payment-methods.succeeded"
+        );
+
+        return paymentMethodsPayload.paymentMethods.map(
+          formatPaymentMethodPayload
+        );
+      }.bind(this)
+    );
+};
+
+/**
+ * Deletes a payment method owned by the customer whose id was used to generate the client token used to create the {@link module:braintree-web/client|client}.
+ * @public
+ * @param {string} paymentMethodNonce The payment method nonce that references a vaulted payment method.
+ * @param {callback} [callback] No data is returned if the operation is successful.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * vaultManagerInstance.deletePaymentMethod('nonce-to-delete', function (err) {
+ *   // handle err if it exists
+ * });
+ */
+VaultManager.prototype.deletePaymentMethod = function (paymentMethodNonce) {
+  return this._createPromise.then(function (client) {
+    var usesClientToken =
+      client.getConfiguration().authorizationType === "CLIENT_TOKEN";
+
+    if (!usesClientToken) {
+      return Promise.reject(
+        new BraintreeError(
+          errors.VAULT_MANAGER_DELETE_PAYMENT_METHOD_NONCE_REQUIRES_CLIENT_TOKEN
+        )
+      );
+    }
+
+    return client
+      .request({
+        api: "graphQLApi",
+        data: {
+          query: DELETE_PAYMENT_METHOD_MUTATION,
+          variables: {
+            input: {
+              singleUseTokenId: paymentMethodNonce,
+            },
+          },
+          operationName: "DeletePaymentMethodFromSingleUseToken",
+        },
+      })
+      .then(function () {
+        analytics.sendEvent(
+          client,
+          "vault-manager.delete-payment-method.succeeded"
+        );
+
+        // noop to prevent sending back the raw graphql data
+      })
+      .catch(function (error) {
+        var originalError = error.details.originalError;
+        var formattedError;
+
+        analytics.sendEvent(
+          client,
+          "vault-manager.delete-payment-method.failed"
+        );
+
+        if (
+          originalError[0] &&
+          originalError[0].extensions.errorClass === "NOT_FOUND"
+        ) {
+          formattedError = new BraintreeError({
+            type: errors.VAULT_MANAGER_PAYMENT_METHOD_NONCE_NOT_FOUND.type,
+            code: errors.VAULT_MANAGER_PAYMENT_METHOD_NONCE_NOT_FOUND.code,
+            message:
+              "A payment method for payment method nonce `" +
+              paymentMethodNonce +
+              "` could not be found.",
+            details: {
+              originalError: originalError,
+            },
+          });
+        }
+
+        if (!formattedError) {
+          formattedError = new BraintreeError({
+            type: errors.VAULT_MANAGER_DELETE_PAYMENT_METHOD_UNKNOWN_ERROR.type,
+            code: errors.VAULT_MANAGER_DELETE_PAYMENT_METHOD_UNKNOWN_ERROR.code,
+            message:
+              "An unknown error occured when attempting to delete the payment method assocaited with the payment method nonce `" +
+              paymentMethodNonce +
+              "`.",
+            details: {
+              originalError: originalError,
+            },
+          });
+        }
+
+        return Promise.reject(formattedError);
+      });
+  });
+};
+
+function formatPaymentMethodPayload(paymentMethod) {
+  var formattedPaymentMethod = {
+    nonce: paymentMethod.nonce,
+    default: paymentMethod.default,
+    details: paymentMethod.details,
+    hasSubscription: paymentMethod.hasSubscription,
+    type: paymentMethod.type,
+  };
+
+  if (paymentMethod.description) {
+    formattedPaymentMethod.description = paymentMethod.description;
+  }
+
+  if (paymentMethod.binData) {
+    formattedPaymentMethod.binData = paymentMethod.binData;
+  }
+
+  return formattedPaymentMethod;
+}
+
+/**
+ * Cleanly tear down anything set up by {@link module:braintree-web/vault-manager.create|create}.
+ * @public
+ * @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
+ * @example
+ * vaultManagerInstance.teardown();
+ * @example <caption>With callback</caption>
+ * vaultManagerInstance.teardown(function () {
+ *   // teardown is complete
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+VaultManager.prototype.teardown = function () {
+  convertMethodsToError(this, methods(VaultManager.prototype));
+
+  return Promise.resolve();
+};
+
+module.exports = wrapPromise.wrapPrototype(VaultManager);
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/venmo_index.js.html b/3.111.1/venmo_index.js.html new file mode 100644 index 00000000..e80b5adf --- /dev/null +++ b/3.111.1/venmo_index.js.html @@ -0,0 +1,320 @@ + + + + + + + + + + + venmo/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ venmo/index.js +

+ + + + + +
+
+
"use strict";
+/** @module braintree-web/venmo */
+
+var analytics = require("../lib/analytics");
+var basicComponentVerification = require("../lib/basic-component-verification");
+var createDeferredClient = require("../lib/create-deferred-client");
+var createAssetsUrl = require("../lib/create-assets-url");
+var errors = require("./shared/errors");
+var wrapPromise = require("@braintree/wrap-promise");
+var BraintreeError = require("../lib/braintree-error");
+var Venmo = require("./venmo");
+var supportsVenmo = require("./shared/supports-venmo");
+var VERSION = process.env.npm_package_version;
+
+/**
+ * @typedef {object} Venmo~lineItem
+ * @property {number} quantity Number of units of the item purchased. This value must be a whole number and can't be negative or zero.
+ * @property {string} unitAmount Per-unit price of the item. Can include up to 2 decimal places. This value can't be negative or zero.
+ * @property {string} name Item name. Maximum 127 characters.
+ * @property {string} kind Indicates whether the line item is a debit (sale) or credit (refund) to the customer. Accepted values: `debit` and `credit`.
+ * @property {?string} unitTaxAmount Per-unit tax price of the item. Can include up to 2 decimal places. This value can't be negative or zero.
+ * @property {?string} description Item description. Maximum 127 characters.
+ * @property {?string} productCode Product or UPC code for the item. Maximum 127 characters.
+ * @property {?string} url The URL to product information.
+ */
+
+/**
+ * @static
+ * @function create
+ * @param {object} options Creation options:
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {boolean} [options.allowNewBrowserTab=true] This should be set to false if your payment flow requires returning to the same tab, e.g. single page applications. Doing so causes {@link Venmo#isBrowserSupported|isBrowserSupported} to return true only for mobile web browsers that support returning from the Venmo app to the same tab.
+ * @param {boolean} [options.allowWebviews=true] This should be set to false if your payment flow does not occur from within a webview that you control. Doing so causes {@link Venmo#isBrowserSupported|isBrowserSupported} to return true only for mobile web browsers that are not webviews.
+ * @param {boolean} [options.ignoreHistoryChanges=false] When the Venmo app returns to the website, it will modify the hash of the url to include data about the tokenization. By default, the SDK will put the state of the hash back to where it was before the change was made. Pass `true` to handle the hash change instead of the SDK.
+ * @param {string} [options.profileId] The Venmo profile ID to be used during payment authorization. Customers will see the business name and logo associated with this Venmo profile, and it will show up in the Venmo app as a "Connected Merchant". Venmo profile IDs can be found in the Braintree Control Panel. Omitting this value will use the default Venmo profile.
+ * @param {string} [options.deepLinkReturnUrl] An override for the URL that the Venmo iOS app opens to return from an app switch.
+ * @param {boolean} [options.requireManualReturn=false] When `true`, the customer will have to manually switch back to the browser/webview that is presenting Venmo to complete the payment.
+ * @param {boolean} [options.useRedirectForIOS=false] Normally, the Venmo flow is launched using `window.open` and the Venmo app intercepts that call and opens the Venmo app instead. If the customer does not have the Venmo app installed, it opens the Venmo website in a new window and instructs the customer to install the app.
+ 
+ * In iOS webviews and Safari View Controllers (a webview-like environment which is indistinguishable from Safari for JavaScript environments), this call to `window.open` will always fail to app switch to Venmo, resulting instead in a white screen. Because of this, an alternate approach is required to launch the Venmo flow.
+ *
+ * When `useRedirectForIOS` is `true` and the Venmo flow is started in an iOS environment, the Venmo flow will be started by setting `window.location.href` to the Venmo website (which will still be intercepted by the Venmo app and should be the same behavior as if `window.open` was called). However, if the customer does not have the Venmo app installed, the merchant page will instead be replaced with the Venmo website and the customer will need to use the browser's back button to return to the merchant's website. Ensure that your customer's checkout information will not be lost if they are navigated away from the website and return using the browser back button.
+ *
+ * Due to a bug in iOS's implementation of `window.open` in iOS webviews and Safari View Controllers, if `useRedirectForIOS` is not set to `true` and the flow is launched from an iOS webview or Safari View Controller, the customer will be presented with a blank screen, halting the flow and leaving the customer unable to return to the merchant's website. Setting `useRedirectForIOS` to `true` will allow the flow to continue, but the Venmo app will be unable to return back to the webview/Safari View Controller. It will instead open the merchant's site in a new window in the customer's browser, which means the merchant site must be able to process the Venmo payment. If the SDK is configured with `allowNewBrowserTab = false`, it is unlikely that the website is set up to process the Venmo payment from a new window.
+ *
+ * If processing the payment from a new window is not possible, use this flag in conjunction with `requireManualReturn` so that the customer may start the flow from a webview/Safari View Controller or their Safari browser and manually return to the place that originated the flow once the Venmo app has authorized the payment and instructed them to do so.
+ * @param {string} [options.paymentMethodUsage] The intended usage for the Venmo payment method nonce. Possible options are:
+ * * single_use - intended as a one time transaction
+ * * multi_use - intended to be vaulted and used for multiple transactions
+ * @param {string} [options.displayName] The business name that will be displayed in the Venmo app payment approval screen. Only applicable when used with `paymentMethodUsage` and used by merchants onboarded as PayFast channel partners.
+ * @param {boolean} [options.allowDesktop] Used to support desktop users. When enabled, the default mode is to render a scannable QR-code customers scan with their phone's to approve via the mobile app.
+ * @param {boolean} [options.allowDesktopWebLogin=false] When `true`, the customer will authorize payment via a window popup that allows them to sign in to their Venmo account. This is used explicitly for customers operating from desktop browsers wanting to avoid the QR Code flow.
+ * @param {boolean} [options.mobileWebFallBack] Use this option when you want to use a web-login experience, such as if on mobile and the Venmo app isn't installed.
+ * @param {boolean} [options.allowAndroidRecreation=true] This flag is for when your integration uses the [Android PopupBridge](https://github.com/braintree/popup-bridge-android). Setting this flag to false will avoid a page refresh when returning to your page after payment authorization. If not specified, it defaults to true and the Android activity will be recreated, resulting in a page refresh.
+ * @param {boolean} [options.collectCustomerBillingAddress] When `true`, the customer's billing address will be collected and displayed on the Venmo paysheet (provided the Enriched Customer Data checkbox is also enabled for the merchant account).
+ * @param {boolean} [options.collectCustomerShippingAddress] When `true`, the customer's shipping address will be collected and displayed on the Venmo paysheet (provided the Enriched Customer Data checkbox is also enabled for the merchant account).
+ * @param {boolean} [options.isFinalAmount=false] When `true`, it denotes that the purchase amount (`totalAmount`) is final and will not change.
+ * @param {lineItem[]} [options.lineItems] The {@link Venmo~lineItem|line items} belonging to the transaction. It can include up to 249 line items.
+ * @param {string} [options.subTotalAmount] The subtotal amount of the transaction, excluding taxes, discounts, and shipping.
+ * @param {string} [options.discountAmount] The total discount amount applied on the transaction.
+ * @param {string} [options.shippingAmount] Shipping amount to be charged for the transaction.
+ * @param {string} [options.taxAmount] The total tax amount applied to the transaction. This value can't be negative or zero.
+ * @param {string} [options.totalAmount] The grand total amount of the transaction.
+ *
+ * Note: This flow currently requires a full page redirect, which means to utilize this flow your page will need to be able to handle the checkout session across different pages.
+ * @param {callback} [callback] The second argument, `data`, is the {@link Venmo} instance. If no callback is provided, `create` returns a promise that resolves with the {@link Venmo} instance.
+ * @example
+ * braintree.venmo.create({
+ *   client: clientInstance
+ * }).then(function (venmoInstance) {
+ *   // venmoInstance is ready to be used.
+ * }).catch(function (createErr) {
+ *   console.error('Error creating Venmo instance', createErr);
+ * });
+ * @example <caption>Allow desktop flow to be used</caption>
+ * braintree.venmo.create({
+ *   client: clientInstance,
+ *   allowDesktop: true
+ * }).then(function (venmoInstance) {
+ *   // venmoInstance is ready to be used.
+ * }).catch(function (createErr) {
+ *   console.error('Error creating Venmo instance', createErr);
+ * });
+ * @returns {(Promise|void)} Returns the Venmo instance.
+ */
+function create(options) {
+  var name = "Venmo";
+
+  return basicComponentVerification
+    .verify({
+      name: name,
+      client: options.client,
+      authorization: options.authorization,
+    })
+    .then(function () {
+      var createPromise, instance;
+
+      if (options.profileId && typeof options.profileId !== "string") {
+        return Promise.reject(
+          new BraintreeError(errors.VENMO_INVALID_PROFILE_ID)
+        );
+      }
+
+      if (
+        options.deepLinkReturnUrl &&
+        typeof options.deepLinkReturnUrl !== "string"
+      ) {
+        return Promise.reject(
+          new BraintreeError(errors.VENMO_INVALID_DEEP_LINK_RETURN_URL)
+        );
+      }
+
+      createPromise = createDeferredClient
+        .create({
+          authorization: options.authorization,
+          client: options.client,
+          debug: options.debug,
+          assetsUrl: createAssetsUrl.create(options.authorization),
+          name: name,
+        })
+        .then(function (client) {
+          var configuration = client.getConfiguration();
+
+          options.client = client;
+
+          if (!configuration.gatewayConfiguration.payWithVenmo) {
+            return Promise.reject(new BraintreeError(errors.VENMO_NOT_ENABLED));
+          }
+
+          return client;
+        });
+
+      options.createPromise = createPromise;
+      instance = new Venmo(options);
+
+      analytics.sendEvent(createPromise, "venmo.initialized");
+
+      return createPromise.then(function () {
+        return instance;
+      });
+    });
+}
+
+/**
+ * @static
+ * @function isBrowserSupported
+ * @param {object} [options] browser support options:
+ * @param {boolean} [options.allowNewBrowserTab=true] This should be set to false if your payment flow requires returning to the same tab, e.g. single page applications.
+ * @param {boolean} [options.allowWebviews=true] This should be set to false if your payment flow does not occur from within a webview that you control.
+ * @example
+ * if (braintree.venmo.isBrowserSupported()) {
+ *   // set up Venmo
+ * }
+ * @example <caption>Explicitly require browser support returning to the same tab</caption>
+ * if (braintree.venmo.isBrowserSupported({
+ *   allowNewBrowserTab: false
+ * })) {
+ *   // set up Venmo
+ * }
+ * @example <caption>Explicitly set webviews as disallowed browsers</caption>
+ * if (braintree.venmo.isBrowserSupported({
+ *   allowWebviews: false
+ * })) {
+ *   // set up Venmo
+ * }
+ * @returns {boolean} Whether or not the browser supports Venmo.
+ */
+function isBrowserSupported(options) {
+  return supportsVenmo.isBrowserSupported(options);
+}
+
+module.exports = {
+  create: wrapPromise(create),
+  isBrowserSupported: isBrowserSupported,
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/venmo_shared_errors.js.html b/3.111.1/venmo_shared_errors.js.html new file mode 100644 index 00000000..4d4b45e5 --- /dev/null +++ b/3.111.1/venmo_shared_errors.js.html @@ -0,0 +1,284 @@ + + + + + + + + + + + venmo/shared/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ venmo/shared/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.Venmo - Creation Error Codes
+ * @description Errors that occur when [creating the Venmo component](./module-braintree-web_venmo.html#.create).
+ * @property {MERCHANT} VENMO_NOT_ENABLED Occurs when Venmo is not enabled on the Braintree control panel.
+ * @property {MERCHANT} VENMO_INVALID_PROFILE_ID Occurs when Venmo is initialized with a profile id, but it is invalid.
+ * @property {UNKNOWN} VENMO_MOBILE_POLLING_SETUP_FAILED __Deprecated__ No longer returned. Use `VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED` instead.
+ * @property {UNKNOWN} VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED Occurs when the request to set up a Venmo Payment Context object fails.
+ */
+
+/**
+ * @name BraintreeError.Venmo - tokenize Error Codes
+ * @description Errors that occur when using the [`tokenize` method](./Venmo.html#tokenize).
+ * @property {CUSTOMER} VENMO_APP_CANCELED Occurs when customer cancels flow from the Venmo app.
+ * @property {UNKNOWN} VENMO_APP_FAILED Occurs when tokenization fails.
+ * @property {CUSTOMER} VENMO_CANCELED Occurs when customer cancels the flow or Venmo app is not available.
+ * @property {CUSTOMER} VENMO_CUSTOMER_CANCELED Occurs when customer cancels the flow.
+ * @property {CUSTOMER} VENMO_DESKTOP_CANCELED Occurs when customer cancels the Venmo Desktop flow by closing the modal.
+ * @property {UNKNOWN} VENMO_DESKTOP_UNKNOWN_ERROR Occurs when an unknown error causes the Venmo Desktop flow to fail.
+ * @property {UNKNOWN} VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR Occurs when an unknown network error causes the mobile polling process to fail.
+ * @property {CUSTOMER} VENMO_MOBILE_POLLING_TOKENIZATION_EXPIRED Occurs when the polling has expired and the payment cannot be completed.
+ * @property {CUSTOMER} VENMO_MOBILE_POLLING_TOKENIZATION_CANCELED Occurs when the polling operation is canceled by the customer.
+ * @property {CUSTOMER} VENMO_MOBILE_POLLING_TOKENIZATION_TIMEOUT Occurs when customer takes too long to complete payment.
+ * @property {UNKNOWN} VENMO_MOBILE_POLLING_TOKENIZATION_FAILED Occurs if there is an unknown error during the mobile polling process.
+ * @property {NETWORK} VENMO_NETWORK_ERROR Occurs when a network error causes a request to fail.
+ * @property {MERCHANT} VENMO_TOKENIZATION_CANCELED_BY_MERCHANT Occurs when `cancelTokenization` is called while tokenization is in progress.
+ * @property {UNKNOWN} VENMO_TOKENIZATION_FAILED Occurs when there is an unknown error during the web login experience.
+ * @property {MERCHANT} VENMO_TOKENIZATION_REQUEST_ACTIVE Occurs when `tokenize` is called when the flow is already in progress.
+ * @property {MERCHANT} VENMO_TOKENIZATION_REQUEST_NOT_ACTIVE Occurs when `cancelTokenization` is called when the flow is not in progress.
+ * @property {MERCHANT} VENMO_ECD_DISABLED Occurs when the merchant tries to access customer details without enabling Enriched Customer Data.
+ */
+
+var BraintreeError = require("../../lib/braintree-error");
+
+module.exports = {
+  VENMO_NOT_ENABLED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "VENMO_NOT_ENABLED",
+    message: "Venmo is not enabled for this merchant.",
+  },
+  VENMO_TOKENIZATION_REQUEST_ACTIVE: {
+    type: BraintreeError.types.MERCHANT,
+    code: "VENMO_TOKENIZATION_REQUEST_ACTIVE",
+    message: "Another tokenization request is active.",
+  },
+  VENMO_TOKENIZATION_REQUEST_NOT_ACTIVE: {
+    type: BraintreeError.types.MERCHANT,
+    code: "VENMO_TOKENIZATION_REQUEST_NOT_ACTIVE",
+    message: "No tokenization in progress.",
+  },
+  VENMO_APP_FAILED: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "VENMO_APP_FAILED",
+    message: "Venmo app encountered a problem.",
+  },
+  VENMO_APP_CANCELED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "VENMO_APP_CANCELED",
+    message: "Venmo app authorization was canceled.",
+  },
+  VENMO_CANCELED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "VENMO_CANCELED",
+    message:
+      "User canceled Venmo authorization, or Venmo app is not available.",
+  },
+  VENMO_CUSTOMER_CANCELED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "VENMO_CUSTOMER_CANCELED",
+    message: "User canceled Venmo authorization.",
+  },
+  VENMO_NETWORK_ERROR: {
+    type: BraintreeError.types.NETWORK,
+    code: "VENMO_NETWORK_ERROR",
+    message: "Something went wrong making the request",
+  },
+  VENMO_DESKTOP_CANCELED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "VENMO_DESKTOP_CANCELED",
+    message:
+      "User canceled Venmo authorization by closing the Venmo Desktop modal.",
+  },
+  VENMO_TOKENIZATION_CANCELED_BY_MERCHANT: {
+    type: BraintreeError.types.MERCHANT,
+    code: "VENMO_TOKENIZATION_CANCELED_BY_MERCHANT",
+    message: "The Venmo tokenization was canceled by the merchant.",
+  },
+  VENMO_DESKTOP_UNKNOWN_ERROR: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "VENMO_DESKTOP_UNKNOWN_ERROR",
+    message: "Something went wrong with the Venmo Desktop flow.",
+  },
+  VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED: {
+    type: BraintreeError.types.NETWORK,
+    code: "VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED",
+    message: "Something went wrong creating the Venmo Payment Context.",
+  },
+  VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR",
+    message: "Something went wrong during mobile polling.",
+  },
+  VENMO_MOBILE_POLLING_TOKENIZATION_EXPIRED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "VENMO_MOBILE_POLLING_TOKENIZATION_EXPIRED",
+    message: "The Venmo authorization request is expired.",
+  },
+  VENMO_MOBILE_POLLING_TOKENIZATION_CANCELED: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "VENMO_MOBILE_POLLING_TOKENIZATION_CANCELED",
+    message: "The Venmo authorization was canceled",
+  },
+  VENMO_MOBILE_POLLING_TOKENIZATION_TIMEOUT: {
+    type: BraintreeError.types.CUSTOMER,
+    code: "VENMO_MOBILE_POLLING_TOKENIZATION_TIMEOUT",
+    message: "Customer took too long to authorize Venmo payment.",
+  },
+  VENMO_MOBILE_POLLING_TOKENIZATION_FAILED: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "VENMO_MOBILE_POLLING_TOKENIZATION_FAILED",
+    message: "The Venmo authorization failed.",
+  },
+  VENMO_INVALID_PROFILE_ID: {
+    type: BraintreeError.types.MERCHANT,
+    code: "VENMO_INVALID_PROFILE_ID",
+    message: "Venmo profile ID is invalid.",
+  },
+  VENMO_INVALID_DEEP_LINK_RETURN_URL: {
+    type: BraintreeError.types.MERCHANT,
+    code: "VENMO_INVALID_DEEP_LINK_RETURN_URL",
+    message: "Venmo deep link return URL is invalid.",
+  },
+  VENMO_TOKENIZATION_FAILED: {
+    type: BraintreeError.types.UNKNOWN,
+    code: "VENMO_TOKENIZATION_FAILED",
+    message: "Venmo encountered a problem",
+  },
+  VENMO_ECD_DISABLED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "ECD_DISABLED",
+    message:
+      "Cannot collect customer data when ECD is disabled. Enable this feature in the Control Panel to collect this data.",
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/venmo_venmo.js.html b/3.111.1/venmo_venmo.js.html new file mode 100644 index 00000000..47bbbfbb --- /dev/null +++ b/3.111.1/venmo_venmo.js.html @@ -0,0 +1,1518 @@ + + + + + + + + + + + venmo/venmo.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ venmo/venmo.js +

+ + + + + +
+
+
"use strict";
+
+var analytics = require("../lib/analytics");
+var isBrowserSupported = require("./shared/supports-venmo");
+var browserDetection = require("./shared/browser-detection");
+var constants = require("./shared/constants");
+var errors = require("./shared/errors");
+var querystring = require("../lib/querystring");
+var isVerifiedDomain = require("../lib/is-verified-domain");
+var methods = require("../lib/methods");
+var convertMethodsToError = require("../lib/convert-methods-to-error");
+var wrapPromise = require("@braintree/wrap-promise");
+var BraintreeError = require("../lib/braintree-error");
+var inIframe = require("../lib/in-iframe");
+var ExtendedPromise = require("@braintree/extended-promise");
+var getVenmoUrl = require("./shared/get-venmo-url");
+var desktopWebLogin = require("./shared/web-login-backdrop");
+var snakeCaseToCamelCase = require("../lib/snake-case-to-camel-case");
+
+// NEXT_MAJOR_VERSION the source code for this is actually in a
+// typescript repo called venmo-desktop, once the SDK is migrated
+// to typescript, we can move the TS files out of that separate
+// repo and into the web SDK properly
+var createVenmoDesktop = require("./external/");
+var graphqlQueries = require("./external/queries");
+
+var VERSION = process.env.npm_package_version;
+var DEFAULT_MOBILE_POLLING_INTERVAL = 250; // 1/4 second
+var DEFAULT_MOBILE_EXPIRING_THRESHOLD = 300000; // 5 minutes
+
+ExtendedPromise.suppressUnhandledPromiseMessage = true;
+
+/**
+ * Venmo tokenize payload.
+ * @typedef {object} Venmo~tokenizePayload
+ * @property {string} nonce The payment method nonce.
+ * @property {string} type The payment method type, always `VenmoAccount`.
+ * @property {object} details Additional Venmo account details.
+ * @property {string} details.username The username of the Venmo account.
+ * @property {string} details.paymentContextId The context ID of the Venmo payment. Only available when used with {@link https://braintree.github.io/braintree-web/current/module-braintree-web_venmo.html#.create|`paymentMethodUsage`}.
+ */
+
+/**
+ * @class
+ * @param {object} options The Venmo {@link module:braintree-web/venmo.create create} options.
+ * @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/venmo.create|braintree-web.venmo.create} instead.</strong>
+ * @classdesc This class represents a Venmo component produced by {@link module:braintree-web/venmo.create|braintree-web/venmo.create}. Instances of this class have methods for tokenizing Venmo payments.
+ */
+function Venmo(options) {
+  var self = this;
+
+  this._allowDesktopWebLogin = options.allowDesktopWebLogin || false;
+  this._mobileWebFallBack = options.mobileWebFallBack || false;
+  this._createPromise = options.createPromise;
+  this._allowNewBrowserTab = options.allowNewBrowserTab !== false;
+  this._allowWebviews = options.allowWebviews !== false;
+  this._allowDesktop = options.allowDesktop === true;
+  this._useRedirectForIOS = options.useRedirectForIOS === true;
+  this._profileId = options.profileId;
+  this._displayName = options.displayName;
+  this._deepLinkReturnUrl = options.deepLinkReturnUrl;
+  this._ignoreHistoryChanges = options.ignoreHistoryChanges;
+  this._paymentMethodUsage = (options.paymentMethodUsage || "").toUpperCase();
+  this._shouldUseLegacyFlow = !this._paymentMethodUsage;
+  this._requireManualReturn = options.requireManualReturn === true;
+  this._useDesktopQRFlow =
+    this._allowDesktop && this._isDesktop() && !this._allowDesktopWebLogin;
+  this._useAllowDesktopWebLogin =
+    this._allowDesktopWebLogin && this._isDesktop();
+  this._cannotHaveReturnUrls = inIframe() || this._requireManualReturn;
+  this._allowAndroidRecreation = options.allowAndroidRecreation !== false;
+  this._maxRetryCount = 3;
+  this._collectCustomerBillingAddress =
+    options.collectCustomerBillingAddress || false;
+  this._collectCustomerShippingAddress =
+    options.collectCustomerShippingAddress || false;
+  this._isFinalAmount = options.isFinalAmount || false;
+  this._lineItems = options.lineItems;
+  this._subTotalAmount = options.subTotalAmount;
+  this._discountAmount = options.discountAmount;
+  this._taxAmount = options.taxAmount;
+  this._shippingAmount = options.shippingAmount;
+  this._totalAmount = options.totalAmount;
+
+  this._shouldCreateVenmoPaymentContext =
+    this._cannotHaveReturnUrls || !this._shouldUseLegacyFlow;
+
+  analytics.sendEvent(
+    this._createPromise,
+    "venmo.desktop-flow.configured." + String(Boolean(this._allowDesktop))
+  );
+
+  // if the url has a tokenization result, that indicates
+  // that it cannot be the desktop flow or the manual return
+  // flow. If it's the hash change with paymentMethodUsage
+  // flow, we want to skip creating a new payment context, since
+  // there is already a pending payment context waiting to be
+  // processed. For the hash change flow without paymentMethodUsage,
+  // no further actions are needed.
+  if (this.hasTokenizationResult()) {
+    analytics.sendEvent(
+      this._createPromise,
+      "venmo.appswitch.return-in-new-tab"
+    );
+  } else if (this._useDesktopQRFlow) {
+    this._createPromise = this._createPromise.then(function (client) {
+      var config = client.getConfiguration().gatewayConfiguration;
+
+      return createVenmoDesktop({
+        url:
+          config.assetsUrl +
+          "/web/" +
+          VERSION +
+          "/html/venmo-desktop-frame.html",
+        environment:
+          config.environment === "production" ? "PRODUCTION" : "SANDBOX",
+        profileId: self._profileId || config.payWithVenmo.merchantId,
+        paymentMethodUsage: self._paymentMethodUsage,
+        displayName: self._displayName,
+        Promise: Promise,
+        apiRequest: function (query, data) {
+          return client
+            .request({
+              api: "graphQLApi",
+              data: {
+                query: query,
+                variables: data,
+              },
+            })
+            .then(function (response) {
+              return response.data;
+            });
+        },
+        sendEvent: function (eventName) {
+          analytics.sendEvent(self._createPromise, eventName);
+        },
+        verifyDomain: isVerifiedDomain,
+      })
+        .then(function (venmoDesktopInstance) {
+          self._venmoDesktopInstance = venmoDesktopInstance;
+          analytics.sendEvent(
+            self._createPromise,
+            "venmo.desktop-flow.presented"
+          );
+
+          return client;
+        })
+        .catch(function () {
+          analytics.sendEvent(
+            self._createPromise,
+            "venmo.desktop-flow.setup-failed"
+          );
+          self._useDesktopQRFlow = false;
+
+          return client;
+        });
+    });
+  } else if (this._shouldCreateVenmoPaymentContext) {
+    // these variables are only relevant for the manual return flow
+    // and they are only set to make testing easier (so they can
+    // be overwritten with smaller values in the tests)
+    this._mobilePollingInterval = DEFAULT_MOBILE_POLLING_INTERVAL;
+    this._mobilePollingExpiresThreshold = DEFAULT_MOBILE_EXPIRING_THRESHOLD;
+
+    this._createPromise = this._createPromise.then(function (client) {
+      var paymentContextPromise, webLoginPromise;
+      var analyticsCategory = self._cannotHaveReturnUrls
+        ? "manual-return"
+        : "mobile-payment-context";
+      var config = client.getConfiguration();
+
+      webLoginPromise = desktopWebLogin
+        .setupDesktopWebLogin({
+          assetsUrl: config.gatewayConfiguration.assetsUrl,
+          debug: config.isDebug,
+        })
+        .then(function (frameServiceInstance) {
+          self._frameServiceInstance = frameServiceInstance;
+        })
+        .catch(function (desktopWebErr) {
+          return desktopWebErr;
+        });
+
+      self._mobilePollingContextEnvironment =
+        config.gatewayConfiguration.environment.toUpperCase();
+
+      paymentContextPromise = self
+        ._createVenmoPaymentContext(client)
+        .then(function () {
+          analytics.sendEvent(
+            self._createPromise,
+            "venmo." + analyticsCategory + ".presented"
+          );
+
+          return client;
+        })
+        .catch(function (err) {
+          analytics.sendEvent(
+            self._createPromise,
+            "venmo." + analyticsCategory + ".setup-failed"
+          );
+
+          return Promise.reject(
+            new BraintreeError({
+              type: errors.VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED.type,
+              code: errors.VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED.code,
+              message: isValidationError(err)
+                ? err.details.originalError[0].message
+                : errors.VENMO_MOBILE_PAYMENT_CONTEXT_SETUP_FAILED.message,
+              details: {
+                originalError: err,
+              },
+            })
+          );
+        });
+
+      return ExtendedPromise.all([webLoginPromise, paymentContextPromise])
+        .then(function (results) {
+          var paymentContextResult = results[1]; // We only care about the returned value of the paymentContextPromise
+
+          return Promise.resolve(paymentContextResult);
+        })
+        .catch(function (promiseErr) {
+          // ExtendedPromise.all returns just one error and it's either which fails first/at all.
+          return Promise.reject(promiseErr);
+        });
+    });
+  }
+}
+
+function isValidationError(err) {
+  return (
+    err.details &&
+    err.details.originalError &&
+    err.details.originalError[0] &&
+    err.details.originalError[0].extensions &&
+    err.details.originalError[0].extensions.errorClass === "VALIDATION" &&
+    err.details.originalError[0].extensions.errorType === "user_error"
+  );
+}
+
+Venmo.prototype._createVenmoPaymentContext = function (
+  client,
+  cancelIfTokenizationInProgress
+) {
+  var self = this;
+  var promise, transactionDetails;
+  var configuration = client.getConfiguration();
+  var venmoConfiguration = configuration.gatewayConfiguration.payWithVenmo;
+  var transactionDetailsPresent = false;
+  var customerClientChannel = self._useAllowDesktopWebLogin
+    ? "NATIVE_WEB"
+    : "MOBILE_WEB";
+
+  if (!this._shouldCreateVenmoPaymentContext) {
+    return Promise.resolve();
+  }
+
+  if (this._shouldUseLegacyFlow) {
+    promise = client
+      .request({
+        api: "graphQLApi",
+        data: {
+          query: graphqlQueries.LEGACY_CREATE_PAYMENT_CONTEXT_QUERY,
+          variables: {
+            input: {
+              environment: this._mobilePollingContextEnvironment,
+              intent: "PAY_FROM_APP",
+            },
+          },
+        },
+      })
+      .then(function (response) {
+        return response
+          .data.createVenmoQRCodePaymentContext.venmoQRCodePaymentContext;
+      });
+  } else {
+    // Merchants are not allowed to collect user addresses unless ECD (Enriched Customer Data) is enabled on the BT Control Panel.
+    if (
+      (this._collectCustomerBillingAddress ||
+        this._collectCustomerShippingAddress) &&
+      !venmoConfiguration.enrichedCustomerDataEnabled
+    ) {
+      return Promise.reject(new BraintreeError(errors.VENMO_ECD_DISABLED));
+    }
+
+    if (this._lineItems) {
+      this._lineItems.forEach(function (item) {
+        item.unitTaxAmount = item.unitTaxAmount || "0";
+      });
+    }
+    transactionDetails = {
+      subTotalAmount: this._subTotalAmount,
+      discountAmount: this._discountAmount,
+      taxAmount: this._taxAmount,
+      shippingAmount: this._shippingAmount,
+      totalAmount: this._totalAmount,
+      lineItems: this._lineItems,
+    };
+    transactionDetailsPresent = Object.keys(transactionDetails).some(function (
+      detail
+    ) {
+      return transactionDetails[detail] !== undefined; // eslint-disable-line no-undefined
+    });
+
+    promise = client
+      .request({
+        api: "graphQLApi",
+        data: {
+          query: graphqlQueries.CREATE_PAYMENT_CONTEXT_QUERY,
+          variables: {
+            input: {
+              paymentMethodUsage: this._paymentMethodUsage,
+              intent: "CONTINUE",
+              customerClient: customerClientChannel,
+              isFinalAmount: this._isFinalAmount,
+              displayName: this._displayName,
+              paysheetDetails: {
+                collectCustomerBillingAddress:
+                  this._collectCustomerBillingAddress,
+                collectCustomerShippingAddress:
+                  this._collectCustomerShippingAddress,
+                transactionDetails: transactionDetailsPresent
+                  ? transactionDetails
+                  : undefined, // eslint-disable-line no-undefined
+              },
+            },
+          },
+        },
+      })
+      .then(function (response) {
+        return response.data.createVenmoPaymentContext.venmoPaymentContext;
+      });
+  }
+
+  return promise.then(function (context) {
+    var expiredTime = new Date(context.expiresAt) - new Date(context.createdAt);
+    var refreshIn = expiredTime * 0.6666;
+
+    // prevents multiple setTimeouts from firing from separate calls
+    // to create a payment context by canceling the previous one
+    // if there is a pending call
+    clearTimeout(self._refreshPaymentContextTimeout);
+    self._refreshPaymentContextTimeout = setTimeout(function () {
+      if (self._tokenizationInProgress) {
+        return;
+      }
+      self._createVenmoPaymentContext(client, true);
+    }, refreshIn);
+
+    if (cancelIfTokenizationInProgress && self._tokenizationInProgress) {
+      return;
+    }
+
+    self._venmoPaymentContextStatus = context.status;
+    self._venmoPaymentContextId = context.id;
+  });
+};
+
+Venmo.prototype.appSwitch = function (url) {
+  if (this._deepLinkReturnUrl) {
+    if (isIosWebviewInDeepLinkReturnUrlFlow()) {
+      analytics.sendEvent(
+        this._createPromise,
+        "venmo.appswitch.start.ios-webview"
+      );
+      // Deep link URLs do not launch iOS apps from a webview when using window.open or PopupBridge.open.
+      window.location.href = url;
+    } else if (
+      window.popupBridge &&
+      typeof window.popupBridge.open === "function"
+    ) {
+      analytics.sendEvent(
+        this._createPromise,
+        "venmo.appswitch.start.popup-bridge"
+      );
+      window.popupBridge.open(url);
+    } else {
+      analytics.sendEvent(this._createPromise, "venmo.appswitch.start.webview");
+      window.open(url);
+    }
+  } else {
+    analytics.sendEvent(this._createPromise, "venmo.appswitch.start.browser");
+
+    if (
+      browserDetection.doesNotSupportWindowOpenInIos() ||
+      this._shouldUseRedirectStrategy()
+    ) {
+      window.location.href = url;
+    } else {
+      window.open(url);
+    }
+  }
+};
+
+Venmo.prototype.getUrl = function () {
+  return this._createPromise.then(
+    function (client) {
+      var configuration = client.getConfiguration();
+      var params = {};
+      var currentUrl =
+        this._deepLinkReturnUrl ||
+        window.location.href.replace(window.location.hash, "");
+      var venmoConfiguration = configuration.gatewayConfiguration.payWithVenmo;
+      var analyticsMetadata = configuration.analyticsMetadata;
+      var accessToken = venmoConfiguration.accessToken;
+      var braintreeData = {
+        _meta: {
+          version: analyticsMetadata.sdkVersion,
+          integration: analyticsMetadata.integration,
+          platform: analyticsMetadata.platform,
+          sessionId: analyticsMetadata.sessionId,
+        },
+      };
+
+      this._isDebug = configuration.isDebug;
+      this._assetsUrl = configuration.gatewayConfiguration.assetsUrl;
+
+      currentUrl = currentUrl.replace(/#*$/, "");
+
+      /* eslint-disable camelcase */
+      if (this._venmoPaymentContextId) {
+        if (this._shouldUseLegacyFlow) {
+          // NEXT_MAJOR_VERSION stop adding the context id to the access token.
+          // the context id is placed here for backwards compatiblity
+          // with versions of the venmo app that did not support
+          // pulling the resource id off of the query params
+          accessToken += "|pcid:" + this._venmoPaymentContextId;
+        } else {
+          params.resource_id = this._venmoPaymentContextId;
+        }
+      }
+
+      if (this._shouldIncludeReturnUrls() || this._useAllowDesktopWebLogin) {
+        if (this._useAllowDesktopWebLogin) {
+          currentUrl =
+            this._assetsUrl + "/web/" + VERSION + "/html/redirect-frame.html";
+        }
+        params["x-success"] = currentUrl + "#venmoSuccess=1";
+        params["x-cancel"] = currentUrl + "#venmoCancel=1";
+        params["x-error"] = currentUrl + "#venmoError=1";
+      } else {
+        params["x-success"] = "NOOP";
+        params["x-cancel"] = "NOOP";
+        params["x-error"] = "NOOP";
+      }
+
+      if (!this._allowAndroidRecreation) {
+        params.allowAndroidRecreation = 0;
+      } else {
+        params.allowAndroidRecreation = 1;
+      }
+
+      params.ua = window.navigator.userAgent;
+      params.braintree_merchant_id =
+        this._profileId || venmoConfiguration.merchantId;
+      params.braintree_access_token = accessToken;
+      params.braintree_environment = venmoConfiguration.environment;
+      params.braintree_sdk_data = btoa(JSON.stringify(braintreeData));
+
+      return (
+        getVenmoUrl({
+          useAllowDesktopWebLogin: this._useAllowDesktopWebLogin,
+          mobileWebFallBack: this._mobileWebFallBack,
+        }) +
+        "?" +
+        querystring.stringify(params)
+      );
+    }.bind(this)
+  );
+};
+
+/**
+ * Returns a boolean indicating whether the current browser supports Venmo as a payment method. Please note that iOS Chrome is not supported when the Venmo button is rendered in an iFrame.
+ *
+ * If `options.allowNewBrowserTab` is false when calling {@link module:braintree-web/venmo.create|venmo.create}, this method will return true only for browsers known to support returning from the Venmo app to the same browser tab. Currently, this is limited to iOS Safari and Android Chrome.
+ * If `options.allowWebviews` is false when calling {@link module:braintree-web/venmo.create|venmo.create}, this method will return true only for mobile browsers that are not webviews.
+ * @public
+ * @returns {boolean} True if the current browser is supported, false if not.
+ */
+Venmo.prototype.isBrowserSupported = function () {
+  return isBrowserSupported.isBrowserSupported({
+    allowNewBrowserTab: this._allowNewBrowserTab,
+    allowWebviews: this._allowWebviews,
+    allowDesktop: this._allowDesktop,
+    allowDesktopWebLogin: this._allowDesktopWebLogin,
+  });
+};
+
+/**
+ * Returns a boolean indicating whether a Venmo tokenization result is ready to be processed immediately.
+ *
+ * This method should be called after initialization to see if the result of Venmo authorization is available. If it returns true, call {@link Venmo#tokenize|tokenize} immediately to process the results.
+ *
+ * @public
+ * @returns {boolean} True if the results of Venmo payment authorization are available and ready to process.
+ */
+Venmo.prototype.hasTokenizationResult = function () {
+  return this._hasTokenizationResult();
+};
+
+// a private version that lets us pass in a custom hash
+// when listening on a hashchange event
+Venmo.prototype._hasTokenizationResult = function (hash) {
+  var params = getFragmentParameters(hash);
+
+  return (
+    typeof (params.venmoSuccess || params.venmoError || params.venmoCancel) !==
+    "undefined"
+  );
+};
+
+Venmo.prototype._shouldIncludeReturnUrls = function () {
+  // when a deep link return url is passed, we should always
+  // respect it and include the return urls so the venmo app
+  // can app switch back to it
+  if (this._deepLinkReturnUrl) {
+    return true;
+  }
+
+  // when the sdk is initialized within an iframe, it's
+  // impossible to return back to the correct place automatically
+  // without also setting a deepLinkReturnUrl. When the return
+  // urls are omitted, the Venmo app prompts the user to return
+  // manually.
+  return !this._cannotHaveReturnUrls;
+};
+
+Venmo.prototype._isDesktop = function () {
+  return !(browserDetection.isIos() || browserDetection.isAndroid());
+};
+
+/**
+ * Launches the Venmo flow and returns a nonce payload.
+ *
+ * If {@link Venmo#hasTokenizationResult|hasTokenizationResult} returns true, calling tokenize will immediately process and return the results without initiating the Venmo payment authorization flow.
+ *
+ * Only one Venmo flow can be active at a time. One way to achieve this is to disable your Venmo button while the flow is open.
+ * @public
+ * @param {object} [options] Options for tokenization.
+ * @param {number} [options.processResultsDelay=500] The amount of time in milliseconds to delay processing the results. In most cases, this value should be left as the default.
+ * @param {callback} [callback] The second argument, <code>data</code>, is a {@link Venmo~tokenizePayload|tokenizePayload}. If no callback is provided, the method will return a Promise that resolves with a {@link Venmo~tokenizePayload|tokenizePayload}.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * button.addEventListener('click', function () {
+ *   // Disable the button so that we don't attempt to open multiple popups.
+ *   button.setAttribute('disabled', 'disabled');
+ *
+ *   // Because tokenize opens a new window, this must be called
+ *   // as a result of a user action, such as a button click.
+ *   venmoInstance.tokenize().then(function (payload) {
+ *     // Submit payload.nonce to your server
+ *     // Use payload.username to get the Venmo username and display any UI
+ *   }).catch(function (tokenizeError) {
+ *     // Handle flow errors or premature flow closure
+ *     switch (tokenizeErr.code) {
+ *       case 'VENMO_APP_CANCELED':
+ *         console.log('User canceled Venmo flow.');
+ *         break;
+ *       case 'VENMO_CANCELED':
+ *         console.log('User canceled Venmo, or Venmo app is not available.');
+ *         break;
+ *       default:
+ *         console.error('Error!', tokenizeErr);
+ *     }
+ *   }).then(function () {
+ *     button.removeAttribute('disabled');
+ *   });
+ * });
+ */
+Venmo.prototype.tokenize = function (options) {
+  var self = this;
+  var tokenizationPromise;
+
+  options = options || {};
+
+  if (this._tokenizationInProgress === true) {
+    return Promise.reject(
+      new BraintreeError(errors.VENMO_TOKENIZATION_REQUEST_ACTIVE)
+    );
+  }
+
+  this._tokenizationInProgress = true;
+  if (this._useDesktopQRFlow) {
+    // for the desktop flow, we create a venmo payment
+    // context and then present a qr code modal to the
+    // customer and they will open up their venmo app
+    // and scan it and approve the purchase on their
+    // mobile device. The sdk will start polling
+    // in order to determine when the status of the
+    // payment context has updated and then pass the
+    // resulting nonce back to the merchant.
+    tokenizationPromise = this._tokenizeForDesktopQRFlow(options);
+  } else if (this._useAllowDesktopWebLogin) {
+    /**
+     * For Desktop Web Login, we open a browser popup to allow for authorization. Once authorized, the redirect urls are used by Venmo, and we query the API for a payment context status update.
+     *
+     * - Payment context is created on initialization
+     * - Popup is opened to Venmo login url.
+     *  - The payment is authorized or canceled, and the popup is closed
+     * - Once the popup is closed, we query the API for a payment context status update
+     *
+     * This is an alternate, opt-in flow to be used the Desktop QR Flow is not desired for Pay with Venmo desktop experiences.
+     */
+    tokenizationPromise = this._tokenizeWebLoginWithRedirect();
+  } else if (this._cannotHaveReturnUrls) {
+    // in the manual return strategy, we create the payment
+    // context on initialization, then continually poll once
+    // the app switch begins until we get a response indiciating
+    // the payment context was approved by the customer on the
+    // Venmo app. The payment context response also includes a
+    // nonce. There are 2 cases where we use the manual return
+    // strategy:
+    // 1. the sdk is instantiated in an iframe, because
+    //    the venmo app is unable to redirect automatically
+    //    when that is the case so we rely on the customer
+    //    to do a manual redirect and continunally poll for
+    //    updates on the payment context to get the nonce
+    // 2. same deal for when `requireManualReturn` is configured
+    tokenizationPromise = this._tokenizeForMobileWithManualReturn();
+  } else {
+    // the default mobile flow is to app switch to the
+    // venmo app, and then have the venmo app switch
+    // back to the page with the venmo nonce details
+    // encoded into the hash portion of the url. If
+    // `paymentMethodUsage` is provided when instantiating
+    // the sdk, we also create a payment context and pass
+    // the resource id to the Venmo app during the app switch.
+    // Once we get a succesful return, we ping the payment
+    // context query to get any additional data needed
+    // to send back to the merchant.
+    tokenizationPromise =
+      this._tokenizeForMobileWithHashChangeListeners(options);
+  }
+
+  return tokenizationPromise
+    .then(function (payload) {
+      return self._createPromise
+        .then(function (client) {
+          return self._createVenmoPaymentContext(client);
+        })
+        .then(function () {
+          self._tokenizationInProgress = false;
+
+          return formatTokenizePayload(payload);
+        });
+    })
+    .catch(function (err) {
+      return self._createPromise
+        .then(function (client) {
+          // We create a new Payment Context because if the last one failed, then presumably we don't want to use it again.
+          // On the first pass, we create the payment context at initialization, and since we used that first one we now need to create a new one
+          // for the next time someone tries to tokenize.
+          return self._createVenmoPaymentContext(client);
+        })
+        .then(function () {
+          self._tokenizationInProgress = false;
+
+          return Promise.reject(err);
+        });
+    });
+};
+
+/**
+ * Cancels the venmo tokenization process
+ *
+ * @public
+ * @function Venmo~cancelTokenization
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ * @example
+ * venmoTokenizeButton.addEventListener('click', function () {
+ *   venmoInstance.tokenize().then(function (payload) {
+ *     // handle payload
+ *   }).catch(function (err) {
+ *     if (err.code === 'VENMO_TOKENIZATION_CANCELED_BY_MERCHANT') {
+ *       // tokenization was canceled by calling cancelTokenization
+ *     }
+ *   });
+ * });
+ *
+ * venmoCancelButton.addEventListener('click', function () {
+ *   // Hide the button when the venmo flow is not in progress
+ *   venmoCancelButton.style.display = "none";
+ *
+ *   venmoInstance.cancelTokenization().then(function () {
+ *     // done canceling the flow
+ *   }).catch(function (err) {
+ *     // should only get here if there is no tokenization in progress
+ *   });
+ * });
+ */
+Venmo.prototype.cancelTokenization = function () {
+  if (!this._tokenizationInProgress) {
+    return Promise.reject(
+      new BraintreeError(errors.VENMO_TOKENIZATION_REQUEST_NOT_ACTIVE)
+    );
+  }
+
+  this._removeVisibilityEventListener();
+
+  // important to reject the tokenization promise first
+  // so the tokenize method rejects with this error
+  // rather than a customer canceled error in the mobile
+  // polling and desktop flows
+  if (this._tokenizePromise) {
+    this._tokenizePromise.reject(
+      new BraintreeError(errors.VENMO_TOKENIZATION_CANCELED_BY_MERCHANT)
+    );
+  }
+
+  return Promise.all([
+    this._cancelMobilePaymentContext(),
+    this._cancelVenmoDesktopContext(),
+  ]);
+};
+
+Venmo.prototype._tokenizeWebLoginWithRedirect = function () {
+  var self = this;
+
+  analytics.sendEvent(self._createPromise, "venmo.tokenize.web-login.start");
+  this._tokenizePromise = new ExtendedPromise();
+
+  return this.getUrl().then(function (url) {
+    desktopWebLogin
+      .runWebLogin({
+        checkForStatusChange:
+          self._checkPaymentContextStatusAndProcessResult.bind(self),
+        cancelTokenization: self.cancelTokenization.bind(self),
+        frameServiceInstance: self._frameServiceInstance,
+        venmoUrl: url,
+        debug: self._isDebug,
+        checkPaymentContextStatus: self._checkPaymentContextStatus.bind(self),
+      })
+      .then(function (payload) {
+        analytics.sendEvent(
+          self._createPromise,
+          "venmo.tokenize.web-login.success"
+        );
+
+        self._tokenizePromise.resolve({
+          paymentMethodNonce: payload.paymentMethodId,
+          username: payload.userName,
+          payerInfo: payload.payerInfo,
+          id: self._venmoPaymentContextId,
+        });
+      })
+      .catch(function (err) {
+        analytics.sendEvent(
+          self._createPromise,
+          "venmo.tokenize.web-login.failure"
+        );
+
+        self._tokenizePromise.reject(err);
+      });
+
+    return self._tokenizePromise;
+  });
+};
+
+Venmo.prototype._queryPaymentContextStatus = function (id) {
+  var self = this;
+
+  return this._createPromise
+    .then(function (client) {
+      var query = self._shouldUseLegacyFlow
+        ? graphqlQueries.LEGACY_VENMO_PAYMENT_CONTEXT_STATUS_QUERY
+        : graphqlQueries.VENMO_PAYMENT_CONTEXT_STATUS_QUERY;
+
+      return client.request({
+        api: "graphQLApi",
+        data: {
+          query: query,
+          variables: {
+            id: id,
+          },
+        },
+      });
+    })
+    .then(function (response) {
+      return response.data.node;
+    });
+};
+
+/**
+ * Queries the GraphQL API to get the payment context and process the status. Retries until there is an update to the payment context status.
+ * @name Venmo~checkPaymentContextStatusAndProcessResult
+ * @ignore
+ * @param {number} retryCount The counter for tracking number of retries made against the API.
+ * @returns {Promise} Returns a promise
+ */
+Venmo.prototype._checkPaymentContextStatusAndProcessResult = function (
+  retryCount
+) {
+  var self = this;
+
+  return self._checkPaymentContextStatus().then(function (node) {
+    var resultStatus = node.status;
+
+    if (resultStatus !== self._venmoPaymentContextStatus) {
+      self._venmoPaymentContextStatus = resultStatus;
+
+      analytics.sendEvent(
+        self._createPromise,
+        "venmo.tokenize.web-login.status-change"
+      );
+
+      switch (resultStatus) {
+        case "APPROVED":
+          return Promise.resolve(node);
+        case "CANCELED":
+          return Promise.reject(
+            new BraintreeError(errors.VENMO_CUSTOMER_CANCELED)
+          );
+        case "FAILED":
+          return Promise.reject(
+            new BraintreeError(errors.VENMO_TOKENIZATION_FAILED)
+          );
+        default:
+      }
+    }
+
+    return new Promise(function (resolve, reject) {
+      if (retryCount < self._maxRetryCount) {
+        retryCount++;
+
+        return self
+          ._checkPaymentContextStatusAndProcessResult(retryCount)
+          .then(resolve)
+          .catch(reject);
+      }
+
+      return reject(new BraintreeError(errors.VENMO_TOKENIZATION_FAILED));
+    });
+  });
+};
+
+Venmo.prototype._checkPaymentContextStatus = function () {
+  var self = this;
+
+  return self
+    ._queryPaymentContextStatus(self._venmoPaymentContextId)
+    .catch(function (networkError) {
+      return Promise.reject(
+        new BraintreeError({
+          type: errors.VENMO_NETWORK_ERROR.type,
+          code: errors.VENMO_NETWORK_ERROR.code,
+          message: errors.VENMO_NETWORK_ERROR.message,
+          details: networkError,
+        })
+      );
+    })
+    .then(function (node) {
+      return Promise.resolve(node);
+    });
+};
+
+Venmo.prototype._pollForStatusChange = function () {
+  var self = this;
+
+  if (Date.now() > self._mobilePollingContextExpiresIn) {
+    return Promise.reject(
+      new BraintreeError(errors.VENMO_MOBILE_POLLING_TOKENIZATION_TIMEOUT)
+    );
+  }
+
+  return this._queryPaymentContextStatus(this._venmoPaymentContextId)
+    .catch(function (networkError) {
+      return Promise.reject(
+        new BraintreeError({
+          type: errors.VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR.type,
+          code: errors.VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR.code,
+          message:
+            errors.VENMO_MOBILE_POLLING_TOKENIZATION_NETWORK_ERROR.message,
+          details: {
+            originalError: networkError,
+          },
+        })
+      );
+    })
+    .then(function (node) {
+      var newStatus = node.status;
+
+      if (newStatus !== self._venmoPaymentContextStatus) {
+        self._venmoPaymentContextStatus = newStatus;
+
+        analytics.sendEvent(
+          self._createPromise,
+          "venmo.tokenize.manual-return.status-change." +
+            newStatus.toLowerCase()
+        );
+
+        switch (newStatus) {
+          case "EXPIRED":
+          case "FAILED":
+          case "CANCELED":
+            return Promise.reject(
+              new BraintreeError(
+                errors["VENMO_MOBILE_POLLING_TOKENIZATION_" + newStatus]
+              )
+            );
+          case "APPROVED":
+            return Promise.resolve(node);
+          case "CREATED":
+          case "SCANNED":
+          default:
+          // any other statuses are irrelevant to the polling
+          // and can just be ignored
+        }
+      }
+
+      return new Promise(function (resolve, reject) {
+        setTimeout(function () {
+          self._pollForStatusChange().then(resolve).catch(reject);
+        }, self._mobilePollingInterval);
+      });
+    });
+};
+
+Venmo.prototype._tokenizeForMobileWithManualReturn = function () {
+  var self = this;
+
+  analytics.sendEvent(
+    this._createPromise,
+    "venmo.tokenize.manual-return.start"
+  );
+
+  this._mobilePollingContextExpiresIn =
+    Date.now() + this._mobilePollingExpiresThreshold;
+  this._tokenizePromise = new ExtendedPromise();
+
+  this._pollForStatusChange()
+    .then(function (payload) {
+      analytics.sendEvent(
+        self._createPromise,
+        "venmo.tokenize.manual-return.success"
+      );
+
+      self._tokenizePromise.resolve({
+        paymentMethodNonce: payload.paymentMethodId,
+        username: payload.userName,
+        payerInfo: payload.payerInfo,
+        id: self._venmoPaymentContextId,
+      });
+    })
+    .catch(function (err) {
+      analytics.sendEvent(
+        self._createPromise,
+        "venmo.tokenize.manual-return.failure"
+      );
+
+      self._tokenizePromise.reject(err);
+    });
+
+  return this.getUrl().then(function (url) {
+    self.appSwitch(url);
+
+    return self._tokenizePromise;
+  });
+};
+
+Venmo.prototype._shouldUseRedirectStrategy = function () {
+  if (!browserDetection.isIos()) {
+    return false;
+  }
+
+  if (this._mobileWebFallBack === true) {
+    return true;
+  }
+
+  return this._useRedirectForIOS;
+};
+
+Venmo.prototype._tokenizeForMobileWithHashChangeListeners = function (options) {
+  var self = this;
+  var resultProcessingInProgress, visibilityChangeListenerTimeout;
+
+  if (this.hasTokenizationResult()) {
+    return this.processHashChangeFlowResults();
+  }
+
+  analytics.sendEvent(this._createPromise, "venmo.tokenize.mobile.start");
+  this._tokenizePromise = new ExtendedPromise();
+
+  this._previousHash = window.location.hash;
+
+  function completeFlow(hash) {
+    var error;
+
+    self
+      .processHashChangeFlowResults(hash)
+      .catch(function (err) {
+        error = err;
+      })
+      .then(function (res) {
+        if (
+          !self._ignoreHistoryChanges &&
+          window.location.hash !== self._previousHash
+        ) {
+          window.location.hash = self._previousHash;
+        }
+        self._removeVisibilityEventListener();
+
+        if (error) {
+          self._tokenizePromise.reject(error);
+        } else {
+          self._tokenizePromise.resolve(res);
+        }
+        delete self._tokenizePromise;
+      });
+  }
+
+  // The Venmo SDK app switches back with the results of the
+  // tokenization encoded in the hash
+  this._onHashChangeListener = function (e) {
+    var hash = e.newURL.split("#")[1];
+
+    if (!self._hasTokenizationResult(hash)) {
+      return;
+    }
+
+    resultProcessingInProgress = true;
+    clearTimeout(visibilityChangeListenerTimeout);
+    completeFlow(hash);
+  };
+
+  window.addEventListener("hashchange", this._onHashChangeListener, false);
+
+  // Subscribe to document visibility change events to detect when app switch
+  // has returned. Acts as a fallback for the hashchange listener and catches
+  // the cancel case via manual app switch back
+  this._visibilityChangeListener = function () {
+    var delay =
+      options.processResultsDelay || constants.DEFAULT_PROCESS_RESULTS_DELAY;
+
+    if (!window.document.hidden) {
+      if (!resultProcessingInProgress) {
+        visibilityChangeListenerTimeout = setTimeout(completeFlow, delay);
+      }
+    }
+  };
+
+  return this.getUrl().then(function (url) {
+    self.appSwitch(url);
+
+    // Add a brief delay to ignore visibility change events that occur right before app switch
+    setTimeout(function () {
+      window.document.addEventListener(
+        documentVisibilityChangeEventName(),
+        self._visibilityChangeListener
+      );
+    }, constants.DOCUMENT_VISIBILITY_CHANGE_EVENT_DELAY);
+
+    return self._tokenizePromise;
+  });
+};
+
+Venmo.prototype._tokenizeForDesktopQRFlow = function () {
+  var self = this;
+
+  analytics.sendEvent(this._createPromise, "venmo.tokenize.desktop.start");
+
+  this._tokenizePromise = new ExtendedPromise();
+
+  this._createPromise
+    .then(function () {
+      return self._venmoDesktopInstance.launchDesktopFlow();
+    })
+    .then(function (payload) {
+      self._venmoDesktopInstance.hideDesktopFlow();
+
+      analytics.sendEvent(
+        self._createPromise,
+        "venmo.tokenize.desktop.success"
+      );
+
+      self._tokenizePromise.resolve(payload);
+    })
+    .catch(function (err) {
+      analytics.sendEvent(
+        self._createPromise,
+        "venmo.tokenize.desktop.failure"
+      );
+
+      if (self._venmoDesktopInstance) {
+        self._venmoDesktopInstance.hideDesktopFlow();
+      }
+
+      if (err && err.reason === "CUSTOMER_CANCELED") {
+        self._tokenizePromise.reject(
+          new BraintreeError(errors.VENMO_DESKTOP_CANCELED)
+        );
+
+        return;
+      }
+
+      self._tokenizePromise.reject(
+        new BraintreeError({
+          type: errors.VENMO_DESKTOP_UNKNOWN_ERROR.type,
+          code: errors.VENMO_DESKTOP_UNKNOWN_ERROR.code,
+          message: errors.VENMO_DESKTOP_UNKNOWN_ERROR.message,
+          details: {
+            originalError: err,
+          },
+        })
+      );
+    });
+
+  return this._tokenizePromise;
+};
+
+Venmo.prototype._cancelMobilePaymentContext = function () {
+  var self = this;
+
+  return this._createPromise.then(function (client) {
+    var query;
+
+    if (self._venmoPaymentContextId) {
+      query = self._shouldUseLegacyFlow
+        ? graphqlQueries.LEGACY_UPDATE_PAYMENT_CONTEXT_QUERY
+        : graphqlQueries.UPDATE_PAYMENT_CONTEXT_QUERY;
+
+      return client.request({
+        api: "graphQLApi",
+        data: {
+          query: query,
+          variables: {
+            input: {
+              id: self._venmoPaymentContextId,
+              status: "CANCELED",
+            },
+          },
+        },
+      });
+    }
+
+    return Promise.resolve();
+  });
+};
+
+Venmo.prototype._cancelVenmoDesktopContext = function () {
+  var self = this;
+
+  return this._createPromise.then(function () {
+    if (self._venmoDesktopInstance) {
+      self._venmoDesktopInstance.updateVenmoDesktopPaymentContext("CANCELED");
+    }
+
+    return Promise.resolve();
+  });
+};
+
+/**
+ * Cleanly tear down anything set up by {@link module:braintree-web/venmo.create|create}.
+ * @public
+ * @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
+ * @example
+ * venmoInstance.teardown();
+ * @example <caption>With callback</caption>
+ * venmoInstance.teardown(function () {
+ *   // teardown is complete
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+Venmo.prototype.teardown = function () {
+  var self = this;
+
+  this._removeVisibilityEventListener();
+
+  return this._createPromise.then(
+    function () {
+      if (self._venmoDesktopInstance) {
+        self._venmoDesktopInstance.teardown();
+      }
+
+      clearTimeout(self._refreshPaymentContextTimeout);
+      self._cancelMobilePaymentContext();
+
+      convertMethodsToError(this, methods(Venmo.prototype));
+    }.bind(this)
+  );
+};
+
+Venmo.prototype._removeVisibilityEventListener = function () {
+  window.removeEventListener("hashchange", this._onHashChangeListener);
+  window.document.removeEventListener(
+    documentVisibilityChangeEventName(),
+    this._visibilityChangeListener
+  );
+
+  delete this._visibilityChangeListener;
+  delete this._onHashChangeListener;
+};
+
+/**
+ * The hash parameter in this function is optional. If no hash parameter is passed, the `getFragmentParameters` function will default to the hash present in the website's URL instead.
+ *
+ * There are two scenarios where this method is called:
+ *
+ * 1. When called within a browser that is capable of returning to the same tab that started the Venmo flow, we set up a listener to detect hash changes in the url. Part of the return to the merchant's website from the Venmo app includes encoding the details of the purchase in the hash of the url. The callback is invoked and the hash is pulled off from the event payload. The reason we pull the hash off of the event payload instead of pulling it directly from the URL is because sometimes a single page app will use the hash parameter for it's routing system, and it's possible to hit a race condition where the routing code has already removed the Venmo specific attributes from the hash before we are able to pull it off the url. Grabbing the hash from the event handler instead ensures we get the Venmo details, no matter what the url is converted to.
+ * 2. The other scenario is for browsers that cannot return to the same tab, and instead the Venmo app must open a new tab. Since there is no hash listener to pull the hash from, we pull the hash details directly from the url using the `getFragmentParameters` method.
+ *
+ * @ignore
+ * @param {string} [hash] Optionally provided browser url hash.
+ * @returns {Promise} Returns a promise
+ */
+Venmo.prototype.processHashChangeFlowResults = function (hash) {
+  var self = this;
+  var params = getFragmentParameters(hash);
+
+  // NEXT_MAJOR_VERSION only rely on payment context status call and stop relying on the
+  // content of the hash
+
+  return new Promise(function (resolve, reject) {
+    if (!self._shouldUseLegacyFlow) {
+      self
+        ._pollForStatusChange()
+        .then(function (payload) {
+          analytics.sendEvent(
+            self._createPromise,
+            "venmo.appswitch.handle.payment-context-status-query.success"
+          );
+
+          return resolve({
+            paymentMethodNonce: payload.paymentMethodId,
+            username: payload.userName,
+            payerInfo: payload.payerInfo,
+            id: self._venmoPaymentContextId,
+          });
+        })
+        .catch(function (err) {
+          if (
+            err.type === errors.VENMO_MOBILE_POLLING_TOKENIZATION_CANCELED.type
+          ) {
+            // We want to reject in this case because if it the process was canceled, we don't want to take the happy path
+            reject(err);
+          }
+
+          analytics.sendEvent(
+            self._createPromise,
+            "venmo.process-results.payment-context-status-query-failed"
+          );
+          // If the polling request fails, but not because of cancelization, we will rely on the params provided from the hash
+          resolve(params);
+        });
+    } else if (params.venmoSuccess) {
+      analytics.sendEvent(
+        self._createPromise,
+        "venmo.appswitch.handle.success"
+      );
+
+      resolve(params);
+    } else if (params.venmoError) {
+      analytics.sendEvent(self._createPromise, "venmo.appswitch.handle.error");
+      reject(
+        new BraintreeError({
+          type: errors.VENMO_APP_FAILED.type,
+          code: errors.VENMO_APP_FAILED.code,
+          message: errors.VENMO_APP_FAILED.message,
+          details: {
+            originalError: {
+              message: decodeURIComponent(params.errorMessage),
+              code: params.errorCode,
+            },
+          },
+        })
+      );
+    } else if (params.venmoCancel) {
+      analytics.sendEvent(self._createPromise, "venmo.appswitch.handle.cancel");
+      reject(new BraintreeError(errors.VENMO_APP_CANCELED));
+    } else {
+      // User has either manually switched back to browser, or app is not available for app switch
+      analytics.sendEvent(
+        self._createPromise,
+        "venmo.appswitch.cancel-or-unavailable"
+      );
+      reject(new BraintreeError(errors.VENMO_CANCELED));
+    }
+
+    self._clearFragmentParameters();
+  });
+};
+
+Venmo.prototype._clearFragmentParameters = function () {
+  if (this._ignoreHistoryChanges) {
+    return;
+  }
+
+  if (
+    typeof window.history.replaceState === "function" &&
+    window.location.hash
+  ) {
+    history.pushState(
+      {},
+      "",
+      window.location.href.slice(0, window.location.href.indexOf("#"))
+    );
+  }
+};
+
+function getFragmentParameters(hash) {
+  var keyValuesArray = (hash || window.location.hash.substring(1)).split("&");
+
+  var parsedParams = keyValuesArray.reduce(function (toReturn, keyValue) {
+    var parts = keyValue.split("=");
+    // some Single Page Apps may pre-pend a / to the first value
+    // in the hash, assuming it's a route in their app
+    // instead of information from Venmo, this removes all
+    // non-alphanumeric characters from the keys in the params
+    var decodedKey = decodeURIComponent(parts[0]).replace(/\W/g, "");
+    var key = snakeCaseToCamelCase(decodedKey);
+    var value = decodeURIComponent(parts[1]);
+
+    toReturn[key] = value;
+
+    return toReturn;
+  }, {});
+
+  if (parsedParams.resourceId) {
+    parsedParams.id = parsedParams.resourceId;
+  }
+
+  return parsedParams;
+}
+
+function formatUserName(username) {
+  username = username || "";
+
+  // NEXT_MAJOR_VERSION the web sdks have a prepended @ sign
+  // but the ios and android ones do not. This should be standardized
+  return "@" + username.replace("@", "");
+}
+
+function formatTokenizePayload(payload) {
+  var formattedPayload = {
+    nonce: payload.paymentMethodNonce,
+    type: "VenmoAccount",
+    details: {
+      username: formatUserName(payload.username),
+      paymentContextId: payload.id,
+    },
+  };
+
+  if (payload.payerInfo) {
+    formattedPayload.details.payerInfo = payload.payerInfo;
+    formattedPayload.details.payerInfo.userName = formatUserName(
+      payload.payerInfo.userName
+    );
+  }
+
+  return formattedPayload;
+}
+
+// From https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
+function documentVisibilityChangeEventName() {
+  var visibilityChange;
+
+  if (typeof window.document.hidden !== "undefined") {
+    // Opera 12.10 and Firefox 18 and later support
+    visibilityChange = "visibilitychange";
+  } else if (typeof window.document.msHidden !== "undefined") {
+    visibilityChange = "msvisibilitychange";
+  } else if (typeof window.document.webkitHidden !== "undefined") {
+    visibilityChange = "webkitvisibilitychange";
+  }
+
+  return visibilityChange;
+}
+
+function isIosWebviewInDeepLinkReturnUrlFlow() {
+  // we know it's a webview because this flow only gets
+  // used when checking the deep link flow
+  // test the platform here to get around custom useragents
+  return (
+    window.navigator.platform &&
+    /iPhone|iPad|iPod/.test(window.navigator.platform)
+  );
+}
+
+module.exports = wrapPromise.wrapPrototype(Venmo);
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/visa-checkout_errors.js.html b/3.111.1/visa-checkout_errors.js.html new file mode 100644 index 00000000..0c97cb62 --- /dev/null +++ b/3.111.1/visa-checkout_errors.js.html @@ -0,0 +1,185 @@ + + + + + + + + + + + visa-checkout/errors.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ visa-checkout/errors.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @name BraintreeError.Visa Checkout - Creation Error Codes
+ * @description Errors that occur when [creating the Visa Checkout component](./module-braintree-web_venmo.html#.create).
+ * @property {MERCHANT} VISA_CHECKOUT_NOT_ENABLED Occurs when Visa Checkout is not enabled in the Braintree control panel.
+ */
+
+/**
+ * @name BraintreeError.Visa Checkout - createInitOptions Error Codes
+ * @description Errors that occur when using the [`createInitOptions` method](./VisaCheckout.html#createInitOptions).
+ * @property {MERCHANT} VISA_CHECKOUT_INIT_OPTIONS_REQUIRED Occurs when no options are provided to method.
+ */
+
+/**
+ * @name BraintreeError.Visa Checkout - tokenize Error Codes
+ * @description Errors that occur when using the [`tokenize` method](./VisaCheckout.html#tokenize).
+ * @property {MERCHANT} VISA_CHECKOUT_PAYMENT_REQUIRED Occurs when no payment data is not provided.
+ * @property {NETWORK} VISA_CHECKOUT_TOKENIZATION Occurs when tokenization fails.
+ */
+
+var BraintreeError = require("../lib/braintree-error");
+
+module.exports = {
+  VISA_CHECKOUT_NOT_ENABLED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "VISA_CHECKOUT_NOT_ENABLED",
+    message: "Visa Checkout is not enabled for this merchant.",
+  },
+  VISA_CHECKOUT_INIT_OPTIONS_REQUIRED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "VISA_CHECKOUT_INIT_OPTIONS_REQUIRED",
+    message: "initOptions requires an object.",
+  },
+  VISA_CHECKOUT_PAYMENT_REQUIRED: {
+    type: BraintreeError.types.MERCHANT,
+    code: "VISA_CHECKOUT_PAYMENT_REQUIRED",
+    message: "tokenize requires callid, encKey, and encPaymentData.",
+  },
+  VISA_CHECKOUT_TOKENIZATION: {
+    type: BraintreeError.types.NETWORK,
+    code: "VISA_CHECKOUT_TOKENIZATION",
+    message:
+      "A network error occurred when processing the Visa Checkout payment.",
+  },
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/visa-checkout_index.js.html b/3.111.1/visa-checkout_index.js.html new file mode 100644 index 00000000..29353ad2 --- /dev/null +++ b/3.111.1/visa-checkout_index.js.html @@ -0,0 +1,208 @@ + + + + + + + + + + + visa-checkout/index.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ visa-checkout/index.js +

+ + + + + +
+
+
"use strict";
+
+/**
+ * @module braintree-web/visa-checkout
+ * @description Processes Visa Checkout. *This component is currently in beta and is subject to change.*
+ */
+
+var basicComponentVerification = require("../lib/basic-component-verification");
+var BraintreeError = require("../lib/braintree-error");
+var createDeferredClient = require("../lib/create-deferred-client");
+var createAssetsUrl = require("../lib/create-assets-url");
+var VisaCheckout = require("./visa-checkout");
+var analytics = require("../lib/analytics");
+var errors = require("./errors");
+var VERSION = process.env.npm_package_version;
+var wrapPromise = require("@braintree/wrap-promise");
+
+/**
+ * @static
+ * @function create
+ * @param {object} options Creation options:
+ * @param {Client} [options.client] A {@link Client} instance.
+ * @param {string} [options.authorization] A tokenizationKey or clientToken. Can be used in place of `options.client`.
+ * @param {callback} [callback] The second argument, `data`, is the {@link VisaCheckout} instance. If no callback is provided, `create` returns a promise that resolves with the {@link VisaCheckout} instance.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+function create(options) {
+  var name = "Visa Checkout";
+
+  return basicComponentVerification
+    .verify({
+      name: name,
+      client: options.client,
+      authorization: options.authorization,
+    })
+    .then(function () {
+      return createDeferredClient.create({
+        authorization: options.authorization,
+        client: options.client,
+        debug: options.debug,
+        assetsUrl: createAssetsUrl.create(options.authorization),
+        name: name,
+      });
+    })
+    .then(function (client) {
+      options.client = client;
+
+      if (
+        !options.client.getConfiguration().gatewayConfiguration.visaCheckout
+      ) {
+        return Promise.reject(
+          new BraintreeError(errors.VISA_CHECKOUT_NOT_ENABLED)
+        );
+      }
+
+      analytics.sendEvent(options.client, "visacheckout.initialized");
+
+      return new VisaCheckout(options);
+    });
+}
+
+module.exports = {
+  create: wrapPromise(create),
+  /**
+   * @description The current version of the SDK, i.e. `{@pkg version}`.
+   * @type {string}
+   */
+  VERSION: VERSION,
+};
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/3.111.1/visa-checkout_visa-checkout.js.html b/3.111.1/visa-checkout_visa-checkout.js.html new file mode 100644 index 00000000..3e90ea6f --- /dev/null +++ b/3.111.1/visa-checkout_visa-checkout.js.html @@ -0,0 +1,345 @@ + + + + + + + + + + + visa-checkout/visa-checkout.js - Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ visa-checkout/visa-checkout.js +

+ + + + + +
+
+
"use strict";
+
+var BraintreeError = require("../lib/braintree-error");
+var analytics = require("../lib/analytics");
+var errors = require("./errors");
+var jsonClone = require("../lib/json-clone");
+var methods = require("../lib/methods");
+var convertMethodsToError = require("../lib/convert-methods-to-error");
+var wrapPromise = require("@braintree/wrap-promise");
+var cardTypeTransformMap = {
+  Visa: "VISA",
+  MasterCard: "MASTERCARD",
+  Discover: "DISCOVER",
+  "American Express": "AMEX",
+};
+
+/**
+ * Visa Checkout Address object.
+ * @typedef {object} VisaCheckout~Address
+ * @property {string} countryCode The customer's country code.
+ * @property {string} extendedAddress The customer's extended address.
+ * @property {string} firstName The customer's first name.
+ * @property {string} lastName The customer's last name.
+ * @property {string} locality The customer's locality.
+ * @property {string} postalCode The customer's postal code.
+ * @property {string} region The customer's region.
+ * @property {string} streetAddress The customer's street address.
+ * @property {string} phoneNumber The customer's phone number.
+ */
+
+/**
+ * Visa Checkout UserData object.
+ * @typedef {object} VisaCheckout~UserData
+ * @property {string} userEmail The customer's email address.
+ * @property {string} userFirstName The customer's first name.
+ * @property {string} userLastName The customer's last name.
+ * @property {string} userFullName The customer's full name.
+ * @property {string} userName The customer's username.
+ */
+
+/**
+ * Visa Checkout tokenize payload.
+ * @typedef {object} VisaCheckout~tokenizePayload
+ * @property {string} nonce The payment method nonce.
+ * @property {object} details Additional account details.
+ * @property {string} details.cardType Type of card, ex: Visa, MasterCard.
+ * @property {string} details.lastFour Last four digits of card number.
+ * @property {string} details.lastTwo Last two digits of card number.
+ * @property {string} description A human-readable description.
+ * @property {string} type The payment method type, always `VisaCheckoutCard`.
+ * @property {VisaCheckout~Address} billingAddress The customer's billing address.
+ * @property {VisaCheckout~Address} shippingAddress The customer's shipping address.
+ * @property {VisaCheckout~UserData} userData Information about the customer.
+ * @property {object} binData Information about the card based on the bin.
+ * @property {string} binData.commercial Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.countryOfIssuance The country of issuance.
+ * @property {string} binData.debit Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.durbinRegulated Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.healthcare Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.issuingBank The issuing bank.
+ * @property {string} binData.payroll Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.prepaid Possible values: 'Yes', 'No', 'Unknown'.
+ * @property {string} binData.productId The product id.
+ */
+
+/**
+ * @class
+ * @param {object} options The Visa Checkout {@link module:braintree-web/visa-checkout.create create} options.
+ * @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/visa-checkout.create|braintree-web.visa-checkout.create} instead.</strong>
+ * @classdesc This class represents a Visa Checkout component produced by {@link module:braintree-web/visa-checkout.create|braintree-web/visa-checkout.create}. Instances of this class have methods for interacting with Visa Checkout's JavaScript library.
+ */
+function VisaCheckout(options) {
+  this._client = options.client;
+}
+
+function transformCardTypes(cardTypes) {
+  return cardTypes.reduce(function (acc, type) {
+    if (cardTypeTransformMap.hasOwnProperty(type)) {
+      return acc.concat(cardTypeTransformMap[type]);
+    }
+
+    return acc;
+  }, []);
+}
+
+/**
+ * Creates an `initOptions` object from the passed `options`, applying properties that Braintree needs to transact Visa Checkout.
+ *
+ * Braintree will apply these properties if they do not exist on the given `options`:
+ *  - `apikey`
+ *  - `externalClientId`
+ *  - `settings.payment.cardBrands`
+ *
+ * Braintree will overwrite `settings.dataLevel = 'FULL'` to access the full payment method.
+ * @public
+ * @param {object} options The base `initOptions` that will be used to init Visa Checkout.
+ * @param {string} [options.apikey] The API key used to initialize Visa Checkout. When not supplied, Braintree will set this property.
+ * @param {string} [options.externalClientId] The external client ID key used to initialize Visa Checkout. When not supplied, Braintree will set this property.
+ * @param {object} [options.settings] The settings object used to initialize Visa Checkout.
+ * @param {string} [options.settings.dataLevel] The data level used to initialize Visa Checkout. Braintree will overwrite this property to 'FULL'.
+ * @param {object} [options.settings.payment] The payment object used to initialize Visa Checkout.
+ * @param {string[]} [options.settings.payment.cardBrands] The card brands that Visa Checkout will allow the customer to pay with. When not supplied, Braintree will set this property.
+ * @returns {object} `initOptions` The `initOptions` that Visa Checkout should be initialized with.
+ */
+VisaCheckout.prototype.createInitOptions = function (options) {
+  var initOptions;
+  var gatewayConfiguration =
+    this._client.getConfiguration().gatewayConfiguration;
+  var visaCheckoutConfiguration = gatewayConfiguration.visaCheckout;
+
+  if (!options) {
+    throw new BraintreeError(errors.VISA_CHECKOUT_INIT_OPTIONS_REQUIRED);
+  }
+
+  initOptions = jsonClone(options);
+  initOptions.apikey = initOptions.apikey || visaCheckoutConfiguration.apikey;
+  initOptions.encryptionKey = visaCheckoutConfiguration.encryptionKey;
+  initOptions.externalClientId =
+    initOptions.externalClientId || visaCheckoutConfiguration.externalClientId;
+  initOptions.settings = initOptions.settings || {};
+  initOptions.settings.dataLevel = "FULL";
+  initOptions.settings.payment = initOptions.settings.payment || {};
+
+  if (!initOptions.settings.payment.cardBrands) {
+    initOptions.settings.payment.cardBrands = transformCardTypes(
+      gatewayConfiguration.visaCheckout.supportedCardTypes
+    );
+  }
+
+  return initOptions;
+};
+
+/**
+ * Tokenizes the Visa Checkout payload, returning a payment method nonce.
+ * @public
+ * @param {object} payment The object that Visa Checkout supplies on `payment.success`.
+ * @param {string} payment.callid Visa Checkout transaction ID associated with this payment.
+ * @param {string} payment.encKey The encrypted key used to decrypt the payment data.
+ * @param {string} payment.encPaymentData The encrypted payment data.
+ * @param {callback} [callback] The second argument, <code>tokenizePayload</code> is a {@link VisaCheckout~tokenizePayload|tokenizePayload}. If no callback is provided, `tokenize` returns a promise that resolves with the {@link VisaCheckout~tokenizePayload|tokenizePayload}.
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+VisaCheckout.prototype.tokenize = function (payment) {
+  var self = this;
+
+  if (!payment.callid || !payment.encKey || !payment.encPaymentData) {
+    return Promise.reject(
+      new BraintreeError(errors.VISA_CHECKOUT_PAYMENT_REQUIRED)
+    );
+  }
+
+  return this._client
+    .request({
+      method: "post",
+      endpoint: "payment_methods/visa_checkout_cards",
+      data: {
+        _meta: {
+          source: "visa-checkout",
+        },
+        visaCheckoutCard: {
+          callId: payment.callid,
+          encryptedPaymentData: payment.encPaymentData,
+          encryptedKey: payment.encKey,
+        },
+      },
+    })
+    .then(function (response) {
+      analytics.sendEvent(self._client, "visacheckout.tokenize.succeeded");
+
+      return response.visaCheckoutCards[0];
+    })
+    .catch(function (err) {
+      analytics.sendEvent(self._client, "visacheckout.tokenize.failed");
+
+      return Promise.reject(
+        new BraintreeError({
+          type: errors.VISA_CHECKOUT_TOKENIZATION.type,
+          code: errors.VISA_CHECKOUT_TOKENIZATION.code,
+          message: errors.VISA_CHECKOUT_TOKENIZATION.message,
+          details: {
+            originalError: err,
+          },
+        })
+      );
+    });
+};
+
+/**
+ * Cleanly tear down anything set up by {@link module:braintree-web/visa-checkout.create|create}.
+ * @public
+ * @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
+ * @example
+ * visaCheckoutInstance.teardown();
+ * @example <caption>With callback</caption>
+ * visaCheckoutInstance.teardown(function () {
+ *   // teardown is complete
+ * });
+ * @returns {(Promise|void)} Returns a promise if no callback is provided.
+ */
+VisaCheckout.prototype.teardown = function () {
+  convertMethodsToError(this, methods(VisaCheckout.prototype));
+
+  return Promise.resolve();
+};
+
+module.exports = wrapPromise.wrapPrototype(VisaCheckout);
+
+
+
+ + + + +
+ +
+ + + + + + + + + + + + diff --git a/current b/current index 1ebc1971..cf2c1d36 120000 --- a/current +++ b/current @@ -1 +1 @@ -3.108.0 \ No newline at end of file +3.111.1 \ No newline at end of file