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.34.0.

Source:

Methods

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

Parameters:
Name Type Attributes Description
options object

Creation options:

Properties
Name Type Attributes Description
client Client

A Client instance.

enabledPaymentMethods object <optional>

An object representing which payment methods to display.

Properties
Name Type Attributes Default Description
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.

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);