Constructor
new ThreeDSecure(options)
Do not use this constructor directly. Use braintree.threeDSecure.create instead.
Parameters:
Name | Type | Description |
---|---|---|
options |
object |
3D Secure create options |
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:
Name | Type | Attributes | Description |
---|---|---|---|
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, |
Examples
// 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
}
}
});
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
}
}
});
// 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:
Name | Type | Description |
---|---|---|
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. |
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:
Name | Type | Description |
---|---|---|
event |
string |
The name of the event to which you are unsubscribing. |
handler |
function |
The callback for the event you are unsubscribing from. |
Example
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:
Name | Type | Description |
---|---|---|
event |
string |
The name of the event to which you are subscribing. |
handler |
function |
A callback to handle the event. |
Example
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:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
Options for 3D Secure lookup. Properties
|
|||||||||||||
callback |
callback |
<optional> |
The second argument, |
Example
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.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
callback |
<optional> |
Called on completion. If no callback is passed, |
verifyCard(options, callbackopt) → {Promise|void}
Launch the 3D Secure login flow, returning a nonce payload.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
Options for card verification. Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
callback |
callback |
<optional> |
The second argument, |
Examples
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
}
});
<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
}
});
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
});
var my3DSContainer;
threeDSecure.verifyCard({
nonce: existingNonce,
amount: 123.45,
addFrame: function (err, iframe) {
// Set up your UI and add the iframe.
my3DSContainer = document.createElement('div');
my3DSContainer.appendChild(iframe);
document.body.appendChild(my3DSContainer);
},
removeFrame: function () {
// Remove UI that you added in addFrame.
document.body.removeChild(my3DSContainer);
}
}, 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
}
});
Type Definitions
addFrameCallback(erropt, nullable, iframe) → {void}
Deprecated The callback used for options.addFrame in 3DS 1.0's verifyCard.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
err |
BraintreeError |
<optional> <nullable> |
|
iframe |
HTMLIFrameElement |
An iframe element containing the bank's authentication page that you must put on your page. |
- Deprecated:
-
- Yes
- Source:
additionalInformation :object
Properties:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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) |
||||||||||||||||||||||||||||||||
shippingSurname |
string |
<optional> |
The last name associated with the shipping address. (maximum length 50) |
||||||||||||||||||||||||||||||||
shippingAddress |
object |
<optional> |
Properties
|
||||||||||||||||||||||||||||||||
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:
|
||||||||||||||||||||||||||||||||
shippingMethodIndicator |
string |
<optional> |
The 2-digit string indicating the shipping method chosen for the transaction Possible values.
|
||||||||||||||||||||||||||||||||
productCode |
string |
<optional> |
The 3-letter string representing the merchant product code. Possible values:
|
||||||||||||||||||||||||||||||||
deliveryTimeframe |
string |
<optional> |
The 2-digit number indicating the delivery time frame. Possible values:
|
||||||||||||||||||||||||||||||||
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:
|
||||||||||||||||||||||||||||||||
preorderIndicator |
string |
<optional> |
The 2-digit number indicating whether cardholder is placing an order with a future availability or release date. possible values:
|
||||||||||||||||||||||||||||||||
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:
|
||||||||||||||||||||||||||||||||
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:
|
||||||||||||||||||||||||||||||||
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:
|
||||||||||||||||||||||||||||||||
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:
|
||||||||||||||||||||||||||||||||
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:
|
||||||||||||||||||||||||||||||||
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:
|
||||||||||||||||||||||||||||||||
paymentAccountIndicator |
string |
<optional> |
The 2-digit value indicating the length of time that the payment account was enrolled in the merchant account. Possible values:
|
||||||||||||||||||||||||||||||||
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:
|
||||||||||||||||||||||||||||||||
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. |
||||||||||||||||||||||||||||||||
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:
|
||||||||||||||||||||||||||||||||
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) |
billingAddress :object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
givenName |
string |
<optional> |
The first name associated with the billing address. (maximum length 50) |
surname |
string |
<optional> |
The last name associated with the billing address. (maximum length 50) |
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> |
The 2 letter code for US states or an ISO-3166-2 country subdivision code of up to three letters. |
postalCode |
string |
<optional> |
The zip code or equivalent for countries that have them. |
countryCodeAlpha2 |
string |
<optional> |
The 2 character country code. |
prepareLookupPayload :string
The client data to pass on when doing a server side lookup call.
removeFrameCallback() → {void}
Deprecated The callback used for options.removeFrame in 3DS 1.0's verifyCard.
- Deprecated:
-
- Yes
- Source:
verificationData :object
Properties:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
requiresUserAuthentication |
boolean |
When |
|||||||||
threeDSecureInfo |
object |
Contains liability shift details. Properties
|
|||||||||
paymentMethod |
object |
A verifyPayload object. |
|||||||||
lookup |
object |
Details about the 3D Secure lookup. Properties
|
verifyCardCustomerObject :object
Deprecated Optional customer information to be passed to 3DS 1.0 for verification.
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
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:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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
|
||||||||||||||||||||||||||||||
description |
string |
A human-readable description. |
||||||||||||||||||||||||||||||
binData |
object |
Information about the card based on the bin. Properties
|
||||||||||||||||||||||||||||||
liabilityShiftPossible |
boolean |
Deprecated: Use |
||||||||||||||||||||||||||||||
liabilityShifted |
boolean |
Deprecated: Use |
||||||||||||||||||||||||||||||
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
|
||||||||||||||||||||||||||||||
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. |
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.
Example
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.
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.
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.
Example
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.