Search...
Log inGet started
Airwallex logo
Home
Core API
Payments
Transactional FX
Payouts
Issuing
Back to home
OverviewHow Airwallex Payouts work
Payout network
Use cases
Tax filing
US tax reportingEmbedded Tax Form component
Test and go live
Older API versions

Embedded Tax Form component

The Embedded Tax Form component is a pre-built UI element for you to integrate into your own flow for recipient tax information collection. It renders the user interface to help you collect required tax information, such as TIN/SSN details, name, address information.

Key features include:

  • Dynamic tax information collection including forms W-9, W-8BEN, W-8BEN-E, W-8ECI, W-8EXP and W-8IMY
  • Automatic TIN matching for W-9
  • W-9/W-8 form retrieval and download
  • e-Delivery of 1099-NEC form

To view and interact with the Embedded Tax Form component, go to the demo site .

Before you begin

Step 1: Initialize the SDK

Import the SDK

JavaScript

Set up the server for authentication

Before beginning the process, you will need to get an authorization code to authorize the user into the Embedded tax form component workflow. Always get authorization code on the server side, a trusted environment. This prevents malicious users from being able to alter the scope. For more details, please see Embedded Components API.

When your page loads, on your server, call Authorize an account API with the following required fields in the request:

  • scope: Indicates the resources your application is allowed to access. For Embedded Onboarding, you must provide w:awx_action:transfers_edit as the scope.
  • code_challenge: Generate a challenge token together with the code_verifier using the S256 generation method as described in RFC 7636 Section 4 . code_challenge = BASE64URL-ENCODE(SHA256(ASCII(code_verifier))). Use a third-party package to generate code_verifier and code_challenge or use the following code example in Javascript.
JavaScript

Install js-base64 package.

JavaScript

The authorization_code will be returned in the response, which you should then return to the client side as authCode in order to initialize the SDK.

Note: The Identity field is mandatory for the tax form component. This field serves as the external identifier used to locate users on your platform. This should be the same as the external_identifier when calling our transfer API.

JavaScript

Initialize Airwallex Components SDK

In this step, we will verify your proof to use the SDK and prepare the component based on your configurations like running environment, display language, etc.

JavaScript

Step 2: Add the Embedded Tax Form component to your page

To embed a component into your page, you will need to create an empty container, create an instance of the component, and mount it to the container.

Define the container

First, create an empty container div with a unique id. Airwallex inserts an iframe into this div on mounting the instance of the component.

JavaScript

Create the Embedded Tax Form component

You can use the theme builder button at the bottom right corner of the demo site to get the corresponding options.

JavaScript

Step 3: Interact with the Embedded Tax Form component

You should have successfully embedded the tax form component into your page. Now the recipient can interact with the component to provide tax information.

JavaScript

Test your integration

Build and test your integration in a demo environment first before going to production. Make sure to account for various success and error scenarios. Contact your Account Manager to get Airwallex demo accounts set up.

Errors and events

This section lists all the errors and events you should monitor while initializing, creating and interacting with the Embedded Tax Form component.

Common errors

ERROR CODEERROR MESSAGENEXT STEP
INIT_ERRORNo {parameter} providedCheck the params table for required init options.
INIT_ERRORFailed to authorizeConfirm that the clientId, env, codeVerifier, and authCode passed in the init() function are valid.
INIT_ERRORAuth timeoutPlease check if your network connection is stable. If so, please contact Airwallex support.
UNAUTHORIZEDFailed to refresh tokenThe refreshToken might be expired (currently 1 hour). Please redo the entire flow to get a new authCode and initialize the SDK, then create the element again.
CREATE_ELEMENT_ERRORPlease init() before createElement()Please confirm you have correctly loaded the SDK script using the init() function from our package or the CDN link.
CREATE_ELEMENT_ERRORCreateElement with {type} not supportedPlease check the supported types.
MOUNT_ELEMENT_ERRORCannot find element with dom element id: {id}Please check if the container dom id or the dom element passed in the mount() function is valid.
ELEMENT_NOT_FOUNDThe mount container does not existPlease check if the container dom id or the dom element passed in the mount() function is valid.
FAILED_LOAD_SCRIPTFailed to load Airwallex SDK scripts: ${url}Please check your network and try again.

Form event type

JavaScript
EVENT NAMEDESCRIPTIONEVENT DATA TYPE
readyThis event will be fired when the page is ready.{ elementType: 'taxForm' }
successThis event fires when tax form is submitted successfully.{ taxFormType: string; taxFormId: string; signatureDate: string; signatureName: string; identifier: string }
saveThis event fires when the tax form is saved and exists.{ data: object }
errorThis event fires when an error occurs within the element.{ code: ELEMENT_ERROR_CODE; message: string }

Element error code

ERROR CODEERROR MESSAGENEXT STEP
REQUEST_ERRORUNAUTHORIZEDThe refreshToken might be expired (currently 1 hour). Please redo the entire flow to get a new authCode and initialize the SDK, then create the element again.
REQUEST_ERRORstringPlease check the params are valid before you submit the form.
On this page