Airwallex Components SDK
Installation
Use @airwallex/components-sdk
Install with Yarn
yarn add @airwallex/components-sdk
Or, with NPM
npm install @airwallex/components-sdk
Initialization
import { init } from '@airwallex/components-sdk';
const options = {
elements: ['kyc', 'paymentsKyb@1'],
langKey: 'en',
env: 'prod',
authCode: 'x4D7A7wOSQvoygpwqweZpG0GFHTcQfVPBTZoKV7EibgH',
clientId: 'BIjjMYsYTPuRqnkEloSvvf',
codeVerifier:
'~wh344Lea1FsCMVH39Fn9R2~nqq2uyD4wbvG9XCzWRxd0sZh9MFiF9gSVkM0C-ZvrdtjBFA6Cw1EvCpJcIjaeXg1-BXCfZd25ZmvuYZAqZtjJQA3NAa~7X1sgEfbMZJwQ',
};
await init(options);
Option | Type | Required? | Default value | Description |
---|
elements | Array<string> | YES | - | The Airwallex elements you want to integrate. Supported values are kyc , paymentsKyb , |
env | string | NO | prod | The Airwallex environment you want to integrate your application with. Options include: staging , demo , prod |
langKey | string | NO | en | Language. Options include: en , zh |
clientId | string | YES | - | Your unique Client ID issued by Airwallex. You can find the client id on Airwallex WebApp - Developer - API Keys |
authCode | string | YES | - | Auth code to authenticate the connected account retrieved from /api/v1/accounts/{id}/authorize . Embedded Component Authorization API |
codeVerifier | string | YES | - | Serves as proof key for code exchange (see RFC 7636 Section 4). A random string picked by yourself, and used to generate the codeChallenge. |
Create an Element
Call createElement(elementName, options)
to create an element object.
Method parameters
Parameter | Type | Required? | Description |
---|
type | string | YES | The elements name of element.Supported values are kyc , paymentsKyb . |
options | Record<string, unknown> | NO | Options for creating an Element, which differ for each element. |
Example
import { createElement } from '@airwallex/components-sdk';
const options = {
hideHeader: true,
hideNav: true,
};
const element = createElement('kyc', options);