PayPalButtonUI

PayPalButtonUI

new PayPalButtonUI(config)

Wrapper class that integrates the PayPal checkout flow (Braintree.js SDK v3) on a checkout page

Parameters:
Name Type Description
config Object

Default class configuration

Version:
  • 1.0
Since:
  • 1.0
Author:
License:
Source:
Tutorials:
See:

Extends

Members

allow3DSPaymentsOny :boolean

Whether the current integration should allow 3DS cards only. Provided via the constructor's configuration

Type:
  • boolean
Since:
  • 1.0
Inherited From:
Default Value:
  • false
Source:

billingAgreementDescription :string

Preapproved payment agreement description during the Vault flow

Type:
  • string
Since:
  • 1.0
Default Value:
  • false
Source:
See:

buttonOptions :Object

The PayPal button options. When button_type=none then id should point to an existent element

Type:
  • Object
Properties:
Name Type Description
color string

The button color (blue|gold|silver)

size string

The button size (tiny|small|medium|large)

shape string

The button shape (pill|rect)

label string

The button caption, eventually using the {wordmark} tag

show_icon boolean

When true show PayPal logo on button

locale string

The locale to use for the PayPal tag line

Since:
  • 1.0
Default Value:
  • {color:"gold",size:"medium",shape:"pill",label:"",show_icon:true,tagline:true,locale:"en_US"}
Source:

client :Object

A shared client instance provided via the constructor's configuration

Type:
  • Object
Since:
  • 1.0
Inherited From:
Default Value:
  • null
Source:

client_token :string

The current integration client token as provided via the constructor's configuration

Type:
  • string
Inherited From:
Source:

dataCollectorInstance :Object

The Braintree Vault dataCollector instance. Vault flow must collect&submit device data.

Type:
  • Object
Since:
  • 1.0
Source:
See:

displayName :string

The merchant display name shown on the PayPal checkout flow

Type:
  • string
Since:
  • 1.0
Default Value:
  • the Braintree account PayPal displayName
Source:
See:

enableShippingAddress :boolean

Returns a shipping address object in tokenize

Type:
  • boolean
Since:
  • 1.0
Default Value:
  • false
Source:
See:

flow :string

The PayPal checkout flow. Either "vault" or "checkout"

Type:
  • string
Since:
  • 1.0
Default Value:
  • checkout
Source:
See:

form :string

The integration (jQuery) selector of the checkout form when provided via the constructor's configuration

Type:
  • string
Since:
  • 1.0
Inherited From:
Default Value:
  • false
Source:

ignore3DSIfAVS :boolean

Overrides the allow3DSPaymentsOny property as following: when TRUE and when a non-3DS card but merchant has AVS rules then accept the payment

Type:
  • boolean
Since:
  • 1.0
Inherited From:
Default Value:
  • false
Source:

inputs :Object

The integration dependent input controls jQuery selectors when provided via the constructor's configuration

Type:
  • Object
Properties:
Name Type Attributes Description
non3DSPayment string <optional>

The jQuery selector for the hidden input that is going to be set on non 3DS payments

paymentNonce string <optional>

The jQuery selector for the hidden input that is going to be set with the payment method nonce to send to the server backend

paymentToken string <optional>

The jQuery selector for the hidden input that represents the Braintree Vault payment token

card_number string <optional>

The jQuery selector for the card number input element

expiry_date string <optional>

The jQuery selector for the card expiry date input element

cvv_number string <optional>

The jQuery selector for the card CVV number input element

postal_code string <optional>

The jQuery selector for the card postal code input element (used by AVS rules)

street_address string <optional>

The jQuery selector for the card street address input element (used by AVS rules)

amount string <optional>

The jQuery selector for the amount input element (used by PayPalButtonUI button)

currency string <optional>

The jQuery selector for the currency input element (used by PayPalButtonUI button)

deviceData string <optional>

The jQuery selector for the hidden Braintree Vault data-collector element (used by PayPalButtonUI button)

Since:
  • 1.0
Inherited From:
Default Value:
  • {}
Source:
See:

integration_instance :Object

The Braintree integration instance after a successful initialization

Type:
  • Object
Since:
  • 1.0
Inherited From:
Default Value:
  • null
Source:

integrationType :string

The class dependent integration type (should be overriden by a prticular integration subclass)

Type:
  • string
Since:
  • 1.0
Overrides:
Default Value:
  • false
Source:

intent :string

Checkout flow only. Either "authorize" (submit but not settle) or "sale" (submit for settlement)

Type:
  • string
Since:
  • 1.0
Default Value:
  • sale
Source:
See:

locale :string

Change the language, links, and terminology used in the PayPal flow

Type:
  • string
Since:
  • 1.0
Default Value:
  • false
Source:
See:

modules :Object

The external modules that this instance may uses as specified by constructor argument

Type:
  • Object
Since:
  • 1.0
Inherited From:
Default Value:
  • {}
Source:

(abstract) noop :function

An dummy no-operation callback function

Type:
  • function
Since:
  • 1.0
Inherited From:
Source:

offerCredit :boolean

Offers the customer PayPal Credit if they qualify. Checkout flows only.

Type:
  • boolean
Since:
  • 1.0
Default Value:
  • false
Source:
See:

onError :callback

A callback to notify on error as provided via the constructor's configuration

Type:
  • callback
Since:
  • 1.0
Inherited From:
Default Value:
Source:

onGetAmount :callback

The amount of the transaction (required when flow="checkout") provided either as a callback function via the constructor's configuration or fetched automatically from inputs.amount member

Type:
  • callback
Since:
  • 1.0
Default Value:
Source:

onGetCurrency :callback

The currency code of the amount (required when flow="checkout") provided either as a callback function via the constructor's configuration or fetched automatically from inputs.currency member

Type:
  • callback
Since:
  • 1.0
Default Value:
Source:

The PayPal button small logo URL

Default Value:
  • https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-small.png
Source:

The PayPal Credit button small logo URL

Default Value:
  • https://www.paypalobjects.com/webstatic/en_US/i/buttons/ppc-acceptance-small.png
Source:

shippingAddressEditable :boolean

Set to false to disable user editing of the shipping address.

Type:
  • boolean
Since:
  • 1.0
Default Value:
  • false
Source:
See:

shippingAddressOverride :Object

Allows you to pass a shipping address you have already collected into the PayPal payment flow.

Type:
  • Object
Since:
  • 1.0
Default Value:
  • {}
Source:
See:

threeDSecure :Object|boolean

The ThreeDSecure instance when provided via the constructor's configuration

Type:
  • Object | boolean
Since:
  • 1.0
Inherited From:
Default Value:
  • false
Source:

(constant) UNDEF :string

The "undefined" constant to be used while checking if the type of an object is undefined.

Type:
  • string
Since:
  • 1.0
Inherited From:
Default Value:
  • undefined
Source:
Example
if (myInstance.UNDEF !== typeof myVar) {...}

useraction :string

Checkout flow only. Either "commit" (changes the button to "Pay Now") or FALSE (button to "Continue")

Type:
  • string
Since:
  • 1.0
Default Value:
  • false
Source:
See:

(inner) container :string

The checkout PayPal button's jQuery container selector

Type:
  • string
Since:
  • 1.0
Default Value:
  • false
Source:

Methods

destroy(onDoneopt)

Tear-down the integration (clean-up DOM, events, etc)

Parameters:
Name Type Attributes Description
onDone callback <optional>

A callback function to be called on destroy done.

Since:
  • 1.0
Overrides:
Source:

disablePaymentButton()

Disable the PayPal payment button

Since:
  • 1.0
Source:

enablePaymentButton()

Enable the PayPal payment button

Since:
  • 1.0
Source:

execModuleFn(name, fn, argsopt, thisArgopt)

Execute a given function within a helper external module

Parameters:
Name Type Attributes Description
name string

The module name which defines the called function

fn string

The called function name within the module given by name

args string | Array.<string> <optional>

The function argument or an array of arguments that are passed to the called function

thisArg object <optional>

The context in which the function is executed

Since:
  • 1.0
Inherited From:
Source:
Example
myInstance.execModuleFn('utils', 'parseError', err)

getButtonId() → {string}

Returns the PayPal button selector

Since:
  • 1.0
Source:
Returns:
  • Returns the button selector
Type
string

hidePaymentMethod()

Hide the PayPal payment method

Since:
  • 1.0
Source:

init()

Class initialization prototype. Normally the children classes call the init method as the last statement of the class constructor.

Since:
  • 1.0
Overrides:
Source:

on3DSFail()

Callback notified automatically when the 3DS authentication failure

Since:
  • 1.0
Inherited From:
Source:
See:

onBypass3DS(response)

Callback notified when 3DS is bypassed by AVS rules

Parameters:
Name Type Description
response Object

The Braintree verifyPaylod object sent by the ThreeDSecure#verifyCard

Since:
  • 1.0
Inherited From:
Source:
See:

onPaymentMethodReceived(paymentMethodInfo)

A callback called after a valid tokenization that sends the payment method nonce

Parameters:
Name Type Description
paymentMethodInfo Object

An object that encapsulates the properties (nonce, type) and eventually other callback properties

Since:
  • 1.0
Overrides:
Source:
See:

onReady(integration)

A callback called when the integration is created successfully.

Parameters:
Name Type Description
integration Object

The instance of the created integration object (CustomUI, DropinUI, HostedFieldsUI, PayPalButtonUI)

Since:
  • 1.0
Inherited From:
Source:

postInit()

A callback that is called immediately after initialization

Overrides:
Source:

processError(messageopt)

When an error is detected it destroys & reinitializes the Braintree integration then notify the error callback.

Parameters:
Name Type Attributes Description
message string | Object <optional>

The error message

Since:
  • 1.0
Inherited From:
Source:
See:

set3DSecure(instance)

Set the ThreeDSecure instance to use for 3DS-authentication

Parameters:
Name Type Description
instance Object

A ThreeDSecure instance to be used if 3DS authentication is required

Since:
  • 1.0
Inherited From:
Source:

setFieldValue(name, value)

Appends a hidden fields to the integration form

Parameters:
Name Type Description
name string

The hidden field name to append

value string | number

The hidden field value

Since:
  • 1.0
Inherited From:
Source:
Example
myInstance.setFieldValue("payment_method_nonce", "gt49b3k3c7");

showPaymentMethod()

Display the PayPal payment method container

Since:
  • 1.0
Source:

submit(nonceopt)

Submits the checkout form

Parameters:
Name Type Attributes Description
nonce string <optional>

An optional payment method nonce that will be submitted to the backend server

Since:
  • 1.0
Overrides:
Source:

teardownHTML()

Destorys the HTML elements created by this integration

Since:
  • 1.0
Source:

tokenize(event)

Tokenize the PayPal information. On success a hidden input field will be set with the PayPal payment method nonce

Parameters:
Name Type Description
event Event

The Javascript Event that triggered this function

Source: