Sample integration
This page provides a step-by-step integration guide for the fictitious platform VendorPayOS to streamline its global payout processes to vendors. The integration involves onboarding VendorPayOS's customers (depicted by ImportCo, and MarCo in the below diagram) as connected accounts in Airwallex, VendorPayOS pulling funds from the customers’ external bank accounts into their connected account Wallets, and then transferring these funds to the external bank accounts of the vendors.
Before you begin
- You must have a pre-configured demo Airwallex platform account with API access. If you don't already have one, contact your Account Manager to get access.
- Obtain your access token API using your unique Client ID and API key. You must have your access token to make API calls.
- You should have demo account credentials (username and password) and a template ID for hosted onboarding to follow this integration guide.
Step 1: Onboard customers onto your platform
Airwallex offers multiple options to onboard connected accounts and submit them for KYC.
- Embedded KYC component (Airwallex-hosted iFrame)
- Hosted flow (Airwallex-hosted full-page redirect)
- Connected Accounts API
As an example, we will be using the Hosted flow (Airwallex-hosted full-page redirect) integration to onboard your customers.
For each of your customers, you will need to:
- Create a connected account.
- Request a URL to redirect your customer to an Airwallex hosted onboarding web form.
- Authorize the URL so your customer can access the onboarding form.
- Verify your customer has successfully onboarded.
Create a connected account
As a platform, you can create Airwallex connected accounts for your customers underneath your platform account. You can then transact on behalf of connected accounts such as debiting funds from the connected account’s Wallet to pay out to external customers.
Create a hosted onboarding web form
Once a connected account is created, you will need to onboard your customer through a KYC process to finish activating their account. Airwallex provides multiple options to onboard your customer. The simplest option is to redirect your customer to an online onboarding form that is hosted by Airwallex. The customer submits their documentation, and Airwallex will handle the verification process, any requests for additional information, as well as the approval or rejection of the request.
You can start the hosted onboarding process by requesting a hosted flow instance for the connected account. You will need your hosted onboarding template id (template
) and the connected account id (account_id
). You will also need to specify a return_url
to which the customer will be redirected once the onboarding is complete.
A successful request returns an onboarding URL (url
) and a hosted flow instance ID (id
). The onboarding URL must not be shared with the customer until it’s authorized by you to ensure that it’s only intended for this customer.
Verify successful customer onboarding
After your customer finishes onboarding, the status of the connected account will transition to SUBMITTED
. Confirm the account status by calling Retrieve a Connected Account API.
For a smoother onboarding experience, use account status webhooks to respond to customer account validation in real-time and seamlessly integrate them into your system. By relying on these webhooks, you can eliminate the need for polling and automatically initiate customer onboarding upon validation.
As you build your integration, you might want to conduct unit and end-to-end testing of your integration. In the demo environment, you can simulate the KYC process and programmatically transition the account status from SUBMITTED
to ACTIVE
using the connected account simulation API. Simulation APIs are not available in the production environment.
The sample code below shows how to simulate the status transition for the connected account to ACTIVE
.
At this point, your connected account is activated!
See also
- Understanding the difference between Platform Account vs. Connected Account.
- For more information on the hosted flow solution, see Hosted onboarding.
- To explore the other KYC onboarding options, see KYC and onboarding.
Handle KYC Request for Information (RFI)
In some cases, Airwallex may request additional information from your customers if the information initially provided during KYC is deemed insufficient to approve the application. To handle any requests for information (RFI), we recommend integrating our hosted KYC RFI solution, which has a similar integration setup as hosted onboarding.
Step 2: Fund the customer's Wallet
While you can choose from multiple options to fund the Wallet, ImportCo wants to add a US bank account (Linked Account) and pull funds using ACH direct debit. VendorPayOS can complete a one-time linkage of ImportCo’s external bank account to their connected account with Airwallex. This allows funds to be pulled in over direct debit, avoiding the need for ImportCo to ‘push’ funds from their bank account to Airwallex. Please note that applicable limits are in place to mitigate the risk of direct debit recalls.
A Linked Account is a verified external financial account (such as a bank account, credit/debit card, or e-wallet account) that is bound to an Airwallex account. In this sample integration, we will create a Linked Account for ImportCo’s US bank account.
Before you can create a Linked Account and add funds via direct debit, you must obtain a direct debit agreement from the external bank account owners. In the demo environment, we can bypass this mandate. For production, see Direct Debit mandate requirements.
Create a Linked Account using micro-deposits verification
As a platform, you can call Linked Accounts API endpoints on behalf of your connected accounts by specifying the connected account's open ID (in the format acct_xxxxxxxx) in the x-on-behalf-of
header of your API requests.
Note that currently Airwallex only supports linking bank accounts owned by the business that signed up for the Airwallex account, or by one of its Ultimate Beneficial Owners (UBOs).
To successfully link an external bank account, Airwallex must first verify its ownership. Airwallex offers two options to verify the external bank account: Micro-deposits or Open Banking.
In this sample integration, we'll use the micro-deposits verification to verify that the Linked Account and mandate have been successfully created.
After verification, you will see that the Linked Account status has transitioned to SUCCEEDED
. Review status codes to track status transitions when Linked Accounts are created and verified.
Similar to the account status webhook, you can listen to Linked Account webhook events to notify your system that the Linked Account verification is successful.
You can retrieve details of your Linked Account by calling Retrieve a Linked Account API.
Fund ImportCo’s Wallet via Direct Debit
After successfully linking ImportCo’s Linked Account to its connected account with Airwallex, you can proceed to pull funds from the Linked Account into ImportCo’s connected account Wallet using the steps outlined below.
Before you proceed, check funding limits for your platform using Get funding limits API. Platform funding limits determine the maximum amount of direct debit deposits that may be created, and are shared across all Airwallex accounts under your platform account. For more information, see direct debit flight times and funding limits. Contact your Account Manager to increase either the direct debit limit or the Faster Direct Debit limit, and understand our fee schedule for the Faster Direct Debit product.
Call Create a deposit via Direct Debit API to add funds into ImportCo’s Wallet by providing ImportCo’s Linked Account ID.
Make sure the amount you deposit does not exceed the funding limit.
You can also listen to the deposit.settled
webhook to confirm that the deposit is successfully settled into the connected account’s Wallet.
See also
- For detailed instructions on depositing funds into Wallets via direct debits from Linked Accounts, see Add funds via direct debit from Linked Accounts.
- Learn more about Direct Debit funding limits.
- Explore Linked Account using Open Banking verification.
Step 3: Process payouts
VendorPayoutOS can enable customers to trigger vendor payouts on a one time or recurring basis. In this integration guide, we will demonstrate the flow of a one-time payment where funds will move from each of customers’ connected accounts to the external bank accounts of the vendors who are receiving the payout, over Airwallex’s payout rails.
Airwallex offers multiple options to collect beneficiary bank account information:
- Native API: Programmatically create payouts with our Payout API endpoints with full control of the beneficiary bank account information collection experience.
- Using API and Form Schema: Programmatically retrieve beneficiary bank account information schema for payout scenarios and render on your user interface.
- Embedded Components: Low-code option to render your beneficiary bank account information collection experience using pre-built UI elements.
Prepare required beneficiary information
Before creating a payout, you will need to prepare the required beneficiary information, which can vary depending on the payout country/currency, payment method, local clearing system, beneficiary type.
Retrieve the form schema
In this sample integration, we will use Get the form schema API endpoint to programmatically obtain the required beneficiary fields for a given country, currency, payment method, clearing system and entity type. The response also includes validation rules and recommended UI components in JSON format for each field to be rendered on the form.
Validate a beneficiary
Call Validate a beneficiary API to check for errors before creating a beneficiary:
- If validation errors are found, a list of all errors will be returned as a 400 response.
- If all parameters provided for the payout are valid, the endpoint will return a 200 (OK) response.
Create a beneficiary
Proceed to create a beneficiary using the validated beneficiary payload.
In the production environment, you will need to build a generic response handler to parse the validation rules and recommended UI component definitions in the response and adopt them in your application. However, as all schema and field validation rules are maintained by Airwallex, once integrated there will be no further code changes needed on your end when there are updates to the schema.
Create a payout
Call Create a new payout API with the required beneficiary and transaction information (currency, amount, date, reference) to create a payout.
If the source currency is different from the payout currency, an underlying currency conversion will be booked. By default, the prevailing market rate at the point of conversion will be applied to the underlying currency conversion.
Retrieve a payout
Call Retrieve a payout API to get the status of the payout.
The payout status should transition from SCHEDULED
to PROCESSING
. Listen to the payment.funding.funded
webhook to confirm that the payout has been successfully processed.
For detailed information on creating and validating a payout, see create a payout and validate a payout.
Fees and pricing
When a payout involves currency conversion (FX), there are two types of fees applied to the connected account:
- FX fees: These cover the cost of converting the payout amount from one currency to another.
- Payout fees: These are separate fees associated with sending the payout itself.
Airwallex allows you to mark up both FX and payout fees. This markup becomes your platform's revenue when your customers make transactions.
Your Account Manager can help you decide how to configure these fees. Options include:
- You can have Airwallex charge the connected accounts directly for FX and payout fees.
- You can cover the FX and payout fees yourself and create a customized pricing model for your product, such as a flat monthly subscription fee via your system.
Reporting and reconciliation
Call Get balance history API and Get list of financial transactions API anytime to retrieve balances and generate financial statements/reports for the purposes of reconciliation, proof of funds, and data analysis. For non-real-time data analysis and reporting requirements, you can also use Platform Reports API to get the data async in a file format and ingest into your data source.
Test and go live
After integrating with Airwallex’s Connected Accounts, Treasury, Payouts products, you can simulate connected account status transition, deposits, payouts, and also test webhooks in the demo environment before going live in the production environment. For more information, see Integration checklist.
Make sure you handle failed payouts before you go live.
Next steps
- Contact your Account Manager if you want to learn more about customizing your hosted flow landing page for business name, logo and color.
- Explore Quotes API if you would like to fix the conversion rate of the payout.