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.
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, |
Example
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
});
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, |
Example
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) {
// Liablity has shifted
submitNonceToServer(payload.nonce);
} else if (payload.liabilityShiftPossible) {
// Liablity may still be shifted
// Decide if you want to submit the nonce
} else {
// Liablity has not shifted and will not shift
// Decide if you want to submit the nonce
}
});
Type Definitions
addFrameCallback(erropt, nullable, iframe) → {void}
The callback used for options.addFrame in 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. |
removeFrameCallback() → {void}
The callback used for options.removeFrame in verifyCard.
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. |
||||||||||||||||||||||||||||||
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 |
Indicates whether the card was eligible for 3D Secure. |
||||||||||||||||||||||||||||||
liabilityShifted |
boolean |
Indicates whether the liability for fraud has been shifted away from the merchant. |