HostedFieldsUI

HostedFieldsUI

new HostedFieldsUI(config)

Wrapper class that integrates HostedFields UI (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:

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:

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:

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:

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:

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) {...}

Methods

createFields()

Binds the checkout inputs controls to the Braintree hosted fields integration

Since:
  • 1.0
Source:

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
Inherited From:
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)

init()

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

Since:
  • 1.0
Inherited From:
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
Inherited From:
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");

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
Inherited From:
Source:

tokenizeCard() → {boolean}

Tokenize the card inputs. On success passes a Braintree payment method nonce to the onPaymentMethodReceived callback otherwise pass an error to the onError callback

Since:
  • 1.0
Source:
Returns:

Returns true if no tokenization is needed (eg. when using a Vault payment token), false otherwise

Type
boolean