SCA Verify Element
createElement('scaVerify', options?)
Parameters
type
required'scaVerify'options
optionalScaVerifyElementOptionsscaVerify Element.userEmail
requiredstringdisableFullPage
optionalbooleantrue to disable the full-page layout and use an embedded layout instead.locale
optional'en'init() will be used.prefilledMobileInfo
optionalPrefilledMobileInfocountryCode
requiredstringnationalNumber
requiredstringscaSessionCode
optionalstringx-sca-session-code response header in the Client API when SCA is required for a transaction request.scaSessionCodes
optionalstring[]x-sca-session-code response header codes from the Client API when SCA is required for the transaction requests. Only in use for certain approved use cases. Use the single scaSessionCode typically.appearance
optionalAppearanceappearance and the legacy theme option are set, appearance wins for colors.mode
optional'light' | 'dark'light.variables
optionalobjectcolorBrand, colorText, colorBackground, colorError, colorSuccess (hex strings, e.g. #612FFF).Returns
ScaVerifyElement | null
1import { createElement, init } from '@airwallex/components-sdk';23await init({4 env: 'prod',5 authCode: 'replace-with-auth-code',6 codeVerifier: 'replace-with-code-verifier',7 clientId: 'replace-with-client-id',8 enabledElements: ['risk'],9});1011const scaElement = await createElement('scaVerify', {12 userEmail: 'replace-with-user-email',13 scaSessionCode: 'replace-with-sca-session-code',14});
destroy()
1element.destroy();
mount(domElement)
Parameters
domElement
requiredstring | HTMLElement1// There are two ways to mount element:2// 1. call with container dom id3element.mount('container-dom-id');45// 2.find the created DOM in existing HTML and call with container DOM element6const containerElement = document.getElementById("container-dom-id");7element.mount(containerElement);
on('verificationSucceed', handler)
Parameters
type
required'verificationSucceed'handler
requiredfunctionThe callback function that will be called when the event occurs.
The handler receives an object with the following properties:
token
requiredstring1element.on('verificationSucceed', ({token}: {token:string}) => {2 // Handle success event3});
on('verificationFailed', handler)
Parameters
type
required'verificationFailed'handler
requiredfunctionThe callback function that will be called when the event occurs.
The handler receives an object with the following properties:
reason
requiredstring1element.on('verificationFailed', (data) => {2 console.log('Verification failed:', data.reason);3});
on('scaSetupSucceed', handler)
Parameters
type
required'scaSetupSucceed'handler
requiredfunctionThe callback function that will be called when the event occurs.
The handler receives an object with the following properties:
mobileInfo
optionalobjectcountryCode
requiredstringnationalNumber
requiredstring1element.on('scaSetupSucceed', (data) => {2 console.log('SCA setup succeeded', data.mobileInfo);3});
on('resetPasscodeSucceed', handler)
Parameters
type
required'resetPasscodeSucceed'handler
required() => void1element.on('resetPasscodeSucceed', () => {2// Handle event3});
on('cancel', handler)
Parameters
type
required'cancel'handler
requiredfunctionThe callback function that will be called when the event occurs.
The handler receives an object with the following properties:
reason
optionalstring1element.on('cancel', () => {2// Handle cancel event3});
on('ready', handler)
Parameters
type
required'ready'handler
required() => void1element.on('ready', () => {2// Handle ready event3});
on('error', handler)
Parameters
type
required'error'handler
requiredfunctionThe callback function that will be called when the event occurs.
The handler receives an object with the following properties:
message
requiredstring1element.on('error', (data) => {2 console.error('SCA error:', data.message);3});
unmount()
1element.unmount();