SCA Management Element
createElement('scaManagement', options?)
Parameters
type
required'scaManagement'options
optionalScaManagementElementOptionsscaManagement 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
requiredstringReturns
ScaManagementElement | 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('scaManagement', {12 userEmail: 'replace-with-user-email',13 prefilledMobileInfo: {14 countryCode: 'replace-with-user-country-code', // e.g. "61" for country Australia15 nationalNumber: 'replace-with-user-national-number', // e.g. "04XXXXXXXX" for country Australia16 },17});
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();