Airwallex JS
Airwallex logoAirwallex logo

Tax Form Element

Copy for LLMView as Markdown
The Tax Form Element renders a UI to collect your beneficiary’s tax information for US 1099-NEC filing, including TIN/SSN, name, and address.

createElement('taxForm', options?)

Use this function to create an instance of an individual Element.

Parameters

type

required'taxForm'
The type of element you are creating.

options

optionalTaxFormElementOptions
Options for creating taxForm Element.

enabledForms

optional('Form8233' | 'W8ben' | 'W8bene' | 'W8eci' | 'W8exp' | 'W8imy' | 'W9')[]
Optional allowlist of IRS form types to show. If omitted, show all forms.

locale

optional'en'
The locale for the Element, applied to Element UI strings and error messages. By default, the locale configured in init() is used.

prefillData

optionalPrefillDataOptions
Prefilled data to populate the form fields.

Returns

TaxFormElement | null

createElement('taxForm', options?)

1import { createElement } from '@airwallex/components-sdk';
2
3const taxFormElement = await createElement('taxForm');

destroy()

Destroys the Element instance.

destroy()

1element.destroy();

mount(domElement)

Mounts Element to your HTML DOM.

Parameters

domElement

requiredstring | HTMLElement
The container DOM element to mount the element.

mount(domElement)

1// type
2element.mount: (domElement: string | HTMLElement) => void
3
4// There are two ways to mount element:
5// 1. call with container dom id
6element.mount('container-dom-id');
7
8// 2.find the created DOM in existing HTML and call with container DOM element
9const containerElement = document.getElementById("container-dom-id");
10element.mount(containerElement);

on('ready', handler)

This event will be fired when the tax form page is ready.

Parameters

type

required'ready'
The event name.

handler

requiredfunction

The callback function that will be called when the event occurs.

The handler receives an object with the following properties:

elementType

required'taxForm'

on('ready', handler)

1element.on('ready', (data) => {
2 console.log('Tax form ready:', data.elementType);
3});

on('success', handler)

This event fires when the tax form is completed successfully.

Parameters

type

required'success'
The event name.

handler

requiredfunction
The callback function that will be called when the event occurs.

on('success', handler)

1element.on('success', (data) => {
2 console.log('Tax form submitted successfully', data);
3});

on('save', handler)

This event fires when the tax form is saved and exited.

Parameters

type

required'save'
The event name.

handler

requiredfunction
The callback function that will be called when the event occurs.

on('save', handler)

1element.on('save', (data) => {
2 console.log('Tax form saved', data);
3});

on('cancel', handler)

This event fires when the element is exited by cancellation.

Parameters

type

required'cancel'
The event name.

handler

required() => void
The callback function that will be called when the event occurs.

on('cancel', handler)

1element.on('cancel', () => {
2 console.log('Tax form cancelled');
3});

on('error', handler)

This event fires when an error occurs within the element.

Parameters

type

required'error'
The event name.

handler

requiredfunction

The callback function that will be called when the event occurs.

The handler receives an object with the following properties:

code

requiredstring
The error code identifying the type of error.

message

optionalstring
A human-readable error message.

on('error', handler)

1element.on('error', (data) => {
2 console.error('Tax form error:', data.code, data.message);
3});

on('download', handler)

This event fires when the tax form is downloaded.

Parameters

type

required'download'
The event name.

handler

requiredfunction

The callback function that will be called when the event occurs.

The handler receives an object with the following properties:

name

requiredstring
The filename of the downloaded file.

uri

requiredstring
The URI of the downloaded file.

on('download', handler)

1element.on('download', (data) => {
2 console.log('Downloaded:', data.name, data.uri);
3});

unmount()

Unmounts the Element. Note that the Element instance will remain.

unmount()

1element.unmount();
Was this page helpful?