Constructor
new InstantVerification(options)
Do not use this constructor directly. Use braintree-web.instant-verification.create instead.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
object |
Methods
handleRedirect(options) → {Promise.<string>|BraintreeError}
Handle redirect back to merchant page from Instant Verification experience.
Parameters:
| Name | Type | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
Options for the handling redirect back from Instant Verification UI. Properties
|
Example
const urlParams = new URL(window.location.href).searchParams;
instantVerificationInstance.handleRedirect({
success: urlParams.get('success');,
cancel: urlParams.get('cancel');,
error: urlParams.get('error');
})
.then((result) => {
if (result) {
console.log('nonce: %s', result);
} else {
console.log('empty result');
}
})
.catch((err) => {
console.error(error: ${JSON.stringify(err)}`);
})
startPayment(options) → {Promise|void}
Initiates the Instant Verification payment flow by redirecting to the authorization page.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
InstantVerification~startPaymentOptions |
The options for starting a payment session. |
Example
button.addEventListener('click', function () {
instantVerificationInstance.startPayment({
jwt: 'JWT_STRING_FROM_YOUR_SERVER',
}).catch(function (err) {
// Handle error
console.error(err);
});
});
Type Definitions
startPaymentOptions :object
Options used for startPayment
Properties:
| Name | Type | Description |
|---|---|---|
jwt |
string |
A JSON Web Token (JWT) containing the redirect URL and callback URL for the Instant Verification payment flow. |