### Install Airwallex Payment Elements Package Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__embedded-elements__legacy-embedded-elements__qr-code-element__guest-user-checkout Install the `airwallex-payment-elements` package using Yarn or NPM for client-side integration. ```Shell yarn add airwallex-payment-elements npm install airwallex-payment-elements ``` -------------------------------- ### APIDOC: SCA Setup Element Source: https://www.airwallex.com/docs/banking-as-a-service__overview/js/payments/host-payment-page The SCA Setup Element guides users through the initial SCA setup, allowing them to configure two-factor authentication (e.g., passcode and SMS) for secure account access. It's recommended to launch setup immediately after connected account onboarding to reduce potential risks. ```APIDOC Element: SCA Setup Purpose: Guide users through initial Strong Customer Authentication (SCA) setup. Functionality: Configure two-factor authentication (passcode, SMS). Recommendation: Launch immediately after onboarding to reduce risks. ``` -------------------------------- ### Install Airwallex Components SDK Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments-for-platforms__payments-for-saas__platform-as-the-owner-of-payments__sample-integration Before initializing the SDK for KYC onboarding, install the Airwallex Components SDK using Yarn, NPM, or a CDN link. ```Shell yarn add @airwallex/components-sdk npm install @airwallex/components-sdk ``` ```HTML ``` -------------------------------- ### Install Airwallex Payment Elements Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__embedded-elements__legacy-embedded-elements__redirect-element__guest-user-checkout Instructions for installing the `airwallex-payment-elements` library using package managers (Yarn/NPM) or by including a CDN script in your HTML. ```Shell yarn add airwallex-payment-elements npm install airwallex-payment-elements ``` ```HTML ``` -------------------------------- ### Initialize SCA Setup Component (JavaScript) Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments-for-platforms__strong-customer-authentication-(sca)__embedded-sca-component Initializes the SCA setup component using `createElement('scaSetup', options)`. This component guides users through two-factor authentication setup, recommended immediately after account onboarding to reduce risks. Users without SCA configured will be redirected here from other SCA flows. ```JavaScript const scaSetupElement = Airwallex.createElement('scaSetup', {}); ``` -------------------------------- ### API: Install and Initialize Airwallex.js Source: https://www.airwallex.com/docs/banking-as-a-service__overview/connected-accounts__kyb-and-onboarding__embedded-kyb-component Instructions for installing and initializing the Airwallex.js SDK. This is a foundational step required before utilizing any Airwallex components or functionalities. ```APIDOC Reference: /docs/js/#install-airwallexjs Description: Steps to install and initialize the core Airwallex.js library. ``` -------------------------------- ### Install Airwallex Payment Elements SDK Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__embedded-elements__legacy-embedded-elements__full-featured-card-element__guest-user-checkout Instructions for installing the Airwallex Payment Elements SDK using package managers (Yarn/NPM) or directly via CDN. This package is required to use Airwallex's client-side payment elements. ```Shell yarn add airwallex-payment-elements npm install airwallex-payment-elements ``` ```HTML ``` -------------------------------- ### Install Airwallex Components SDK Source: https://www.airwallex.com/docs/banking-as-a-service__overview/global-treasury__employee-reimbursements__reimbursement-payouts-funded-by-the-platform's-customers__sample-integration Instructions for installing the Airwallex Components SDK using package managers (Yarn/NPM) or a CDN link, essential for integrating the Embedded KYC component. ```Shell yarn add @airwallex/components-sdk npm install @airwallex/components-sdk ``` ```HTML ``` -------------------------------- ### Install Airwallex Payment Elements via Yarn or NPM Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__embedded-elements__legacy-embedded-elements__wechat-pay-element Instructions to install the `airwallex-payment-elements` JavaScript client library using Node.js package managers. ```Shell yarn add airwallex-payment-elements npm install airwallex-payment-elements ``` -------------------------------- ### Install Airwallex.js using npm Source: https://www.airwallex.com/docs/banking-as-a-service__overview/js/payments/host-payment-page This snippet demonstrates how to install the Airwallex Components SDK using the npm package manager. This is the recommended way to integrate Airwallex.js into your project. ```Shell npm install @airwallex/components-sdk ``` -------------------------------- ### Query RFI Status via List All RFIs API Source: https://www.airwallex.com/docs/banking-as-a-service__overview/issuing__create-cardholders__handle-cardholder-rfi__native-cardholder-rfi-api Call the List all RFIs API to get a list of all open cardholder RFIs across your account and connected accounts. The original content mentions Shell example request and JSON example response, but the code snippets were not provided in the input text. ```APIDOC GET /api/v1/rfis ``` -------------------------------- ### Airwallex Production API Endpoints Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__integration-checklist Update your integration and programmatic reporting configurations to point to the Airwallex production API endpoint for live operations. This is the base URL for all production API calls. ```APIDOC Base API URL: https://api.airwallex.com/api/v1/ ``` -------------------------------- ### Configure Airwallex Postman Collection Variables Source: https://www.airwallex.com/docs/banking-as-a-service__overview/developer-tools__api__quickstart-with-postman Instructions for setting up environment-specific variables (clientId, apiKey, url, file_url) in the Airwallex Postman collection for both demo and production environments. Alternatively, these can be specified directly in HTTP headers. ```APIDOC Postman Collection Variables: Demo environment: clientId: Your unique client ID from the demo environment. apiKey: Your API key from the demo environment. url: https://api-demo.airwallex.com file_url: https://files-demo.airwallex.com Production environment: clientId: Your unique client ID from the production environment. apiKey: Your API key from the production environment. url: https://api.airwallex.com file_url: https://files.airwallex.com Alternative HTTP Headers: x-client-id: Your client ID x-api-key: Your API key ``` -------------------------------- ### Install Airwallex Payment Elements Library Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__embedded-elements__legacy-embedded-elements__full-featured-card-element__registered-user-checkout Instructions for installing the Airwallex Payment Elements JavaScript client library using popular package managers or a CDN. ```Shell yarn add airwallex-payment-elements ``` ```Shell npm install airwallex-payment-elements ``` ```HTML ``` -------------------------------- ### Example Response: Simulate Connected Account Status (ACTIVE) Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments-for-platforms__payments-for-saas__platform-as-the-owner-of-payments__sample-integration This JSON example shows the successful response from the connected account simulation API, indicating that the account's status has been successfully transitioned to `ACTIVE`. ```JSON { "id": "acc_xxxxxxxxxxxxxxxxx", "status": "ACTIVE", "type": "INDIVIDUAL", "businessDetails": null, "individualDetails": { "firstName": "John", "lastName": "Doe", "dateOfBirth": "1990-01-01", "nationality": "US", "countryOfBirth": "US", "placeOfBirth": "New York", "gender": "MALE", "identification": { "type": "PASSPORT", "value": "123456789", "country": "US" } }, "contactDetails": { "email": "john.doe@example.com", "phone": "+12125551234" }, "createdAt": "2023-01-01T12:00:00Z", "updatedAt": "2023-01-01T12:10:00Z" } ``` -------------------------------- ### Initialize Airwallex.js with init() function Source: https://www.airwallex.com/docs/banking-as-a-service__overview/js These examples illustrate how to initialize Airwallex.js using the `init()` function for different element groups. The first example focuses on payment elements, while the second shows initialization for onboarding, payout, or risk elements, which require additional authentication parameters. ```TypeScript // Example 1: Initialize Airwallex.js for Payment Elements import { init } from '@airwallex/components-sdk'; const options = { locale: 'en', env: 'prod', enabledElements: ['payments'] }; await init(options); ``` ```TypeScript // Example 2: Initialize Airwallex.js for Onboarding, Payout, Risk, or Compliance Support Elements import { init } from '@airwallex/components-sdk'; const options = { locale: 'en', env: 'prod', enabledElements: ['onboarding', 'payouts', 'risk'], authCode: 'replace-with-your-auth-code', clientId: 'replace-with-your-client-id', codeVerifier: 'replace-with-your-code-verifier' }; await init(options); ``` -------------------------------- ### Example Response: Retrieve Connected Account Status (SUBMITTED) Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments-for-platforms__payments-for-saas__platform-as-the-owner-of-payments__sample-integration This JSON example shows a typical response from the Retrieve a Connected Account API, indicating that the account has been successfully submitted for KYC review. ```JSON { "id": "acc_xxxxxxxxxxxxxxxxx", "status": "SUBMITTED", "type": "INDIVIDUAL", "businessDetails": null, "individualDetails": { "firstName": "John", "lastName": "Doe", "dateOfBirth": "1990-01-01", "nationality": "US", "countryOfBirth": "US", "placeOfBirth": "New York", "gender": "MALE", "identification": { "type": "PASSPORT", "value": "123456789", "country": "US" }, "address": { "country": "US", "state": "NY", "city": "New York", "postcode": "10001", "streetName": "Main St", "streetNumber": "123" } }, "contactDetails": { "email": "john.doe@example.com", "phone": "+12125551234" }, "createdAt": "2023-01-01T12:00:00Z", "updatedAt": "2023-01-01T12:05:00Z" } ``` -------------------------------- ### Airwallex API: Download Financial Settlement Report Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__integration-checklist Describes the API endpoint for programmatically downloading financial settlement reports. This allows users to integrate report retrieval directly into their systems for automated data analysis and reconciliation. ```APIDOC API Endpoint: GET /api/v1/pa/financial_settlements/{id}/report Purpose: Programmatically download a financial settlement report. ``` -------------------------------- ### Airwallex API Endpoints for Authentication and Issuing Configuration Source: https://www.airwallex.com/docs/banking-as-a-service__overview/issuing__remote-authorization__respond-to-authorization-requests References to key Airwallex API endpoints required for initial setup: obtaining an access token for authentication and updating issuing configurations, including remote authorization settings. ```APIDOC API_Access: _api_v1_authentication_login/post: description: Obtain your access token by authenticating with Client ID and API key. Issuing_Config: _api_v1_issuing_config_update/post: description: Configure remote authorization settings, including HTTPS endpoint and default action. ``` -------------------------------- ### Install Airwallex.js using npm Source: https://www.airwallex.com/docs/banking-as-a-service__overview/js This snippet demonstrates how to install the Airwallex Components SDK using the npm package manager. This is a standard method for integrating the SDK into a JavaScript or TypeScript project. ```Shell npm install @airwallex/components-sdk ``` -------------------------------- ### Airwallex Demo API Transaction Test Scenarios Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__integration-checklist Provides a comprehensive set of test cases for validating various payment transaction flows against the Airwallex demo API endpoints, including successful frictionless and challenge flows, and different types of failed transactions. Each test case specifies the card number, expected amount, and the anticipated API response. ```APIDOC Transaction Tests: - Type: 1 successful transaction - 3DS frictionless flow Test Card: 4012 0003 0000 0021 Amount: Any CVC/Expiry: Any Expected Response: Frictionless Mode Success (HTTP 200) - Type: 1 successful transaction - 3DS challenge flow Test Card: 4012 0003 0000 0088 Amount: Any CVC/Expiry: Any OTP: 1234 Expected Response: Challenge Mode Success (HTTP 200) - Type: 1 failed transaction - 3DS authentication failed Test Cards: 4012 0003 0000 0013 / 4012 0003 0000 0039 / 4012 0003 0000 0070 Amount: Any CVC/Expiry: Any Expected Response: authentication_declined (HTTP 400) - Type: 1 failed transaction - authorization failed (3DS frictionless) Test Card: 4012 0003 0000 0021 Amount: $88.88 CVC/Expiry: Any Expected Response: issuer_declined (HTTP 400) - Type: 1 failed transaction - authorization failed (3DS challenge) Test Card: 4012 0003 0000 0088 Amount: $88.88 CVC/Expiry: Any OTP: 1234 Expected Response: issuer_declined (HTTP 400) - Type: 1 successful payment status check Test Card: None (after synchronous payment) Action: Call Retrieve a PaymentIntent API Expected Statuses: REQUIRES_PAYMENT_METHOD, REQUIRES_CUSTOMER_ACTION, REQUIRES_CAPTURE, CANCELLED, SUCCEEDED ``` -------------------------------- ### Install Airwallex Payment Elements Library Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__embedded-elements__legacy-embedded-elements__qr-code-element__registered-user-checkout Instructions for installing the Airwallex Payment Elements JavaScript client library using Yarn, NPM, or CDN for web integration. ```Shell yarn add airwallex-payment-elements ``` ```Shell npm install airwallex-payment-elements ``` ```HTML ``` -------------------------------- ### Install Airwallex Payment Elements package Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__embedded-elements__legacy-embedded-elements__redirect-element__registered-user-checkout Instructions for installing the `airwallex-payment-elements` JavaScript client library using Yarn or NPM package managers. ```Shell yarn add airwallex-payment-elements npm install airwallex-payment-elements ``` -------------------------------- ### Example Response: Retrieve Account Capability Status (ENABLED) Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments-for-platforms__payments-for-saas__platform-as-the-owner-of-payments__sample-integration This JSON example shows a response from the Retrieve Account Capability API, indicating that a specific payment method (e.g., WeChat Pay) has been successfully enabled for the account after KYB onboarding. ```JSON { "id": "acc_cap_xxxxxxxxxxxxxxxxx", "accountId": "acc_xxxxxxxxxxxxxxxxx", "paymentMethod": "WECHAT_PAY", "status": "ENABLED", "createdAt": "2023-01-01T12:00:00Z", "updatedAt": "2023-01-01T12:05:00Z" } ``` -------------------------------- ### Issuing Config: Retrieve Remote Authorization Settings Source: https://www.airwallex.com/docs/banking-as-a-service__overview/banking-as-a-service__remote-authorization__configure-remote-authorization Explains how to use the Get Issuing Config API to check the current remote authorization setup. If the `remote_auth_settings` object is absent in the response, remote authorization is not configured. ```APIDOC GET /api/v1/issuing/config Description: Check remote authorization setup. Returns: Issuing configuration, including `remote_auth_settings` if configured. ``` -------------------------------- ### Example: Get Account Details API Call Source: https://www.airwallex.com/docs/banking-as-a-service__overview/developer-tools__implement-your-authorization-flow__existing-customers An example API endpoint call to retrieve details about a connected Airwallex account, demonstrating the usage of the Authorization header with the access token in a GET request. ```APIDOC GET /api/v1/account/ ``` -------------------------------- ### API: Initialize Airwallex SDK (JavaScript) Source: https://www.airwallex.com/docs/banking-as-a-service__overview/connected-accounts__kyb-and-onboarding__embedded-kyb-component Instructions for importing the `components-sdk` and initializing the Airwallex.js environment. This prepares the SDK for use in your application. ```APIDOC Reference: /docs/js/#initialize-airwallexjs Module: `components-sdk` Action: Import and initialize the SDK environment. ``` -------------------------------- ### Airwallex.js init() Function API Reference Source: https://www.airwallex.com/docs/banking-as-a-service__overview/js Detailed API documentation for the `init()` function, which loads and configures Airwallex.js elements. It accepts an optional `options` object to customize behavior and returns void. ```APIDOC init(options?: InitOptions): void Parameters: options: InitOptions (optional) Description: Configuration options for initializing Airwallex.js. Returns: void ``` -------------------------------- ### Create SCA Setup Element Source: https://www.airwallex.com/docs/banking-as-a-service__overview/js/sca/sca-setup Documents the `createElement` function specifically for creating an instance of the `scaSetup` Element. It details the required `type` parameter and the optional `options` parameter, which expects `ScaSetupElementOptions`. ```APIDOC createElement('scaSetup', options?) Parameters: type: Required: true Type: 'scaSetup' Description: The type of element you are creating. options: Required: false Type: ScaSetupElementOptions Description: Options for creating scaSetup Element. ``` -------------------------------- ### API Call: Create Hosted Flow Instance Source: https://www.airwallex.com/docs/banking-as-a-service__overview/banking-as-a-service__kyc-and-onboarding__hosted-onboarding Explains how to create a hosted flow instance for an account (own or connected). Requires `account_id` and `template` ID. A `return_url` must be specified for post-completion redirection. The successful response provides a short-lived `url` and `id`, which must be saved and not shared until authorized. Lists common error responses. ```APIDOC API Endpoint: POST /api/v1/hosted_flows Purpose: Create a hosted flow instance for a given account. Request Body: account_id: ID of the account for which the flow is created. template: Hosted flow template ID provided by Airwallex. return_url: URL for customer redirection upon flow completion. Response: url: Short-lived hosted flow URL (must not be shared until authorized). id: Hosted flow instance ID (must be saved). Error Responses: 400: template not found, account_id not found 403: not authorized, account status SUSPENDED (disabled/failed KYC) 500: server error ``` -------------------------------- ### Simulate and Test Connected Accounts, Payments, and Payouts Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments-for-platforms__payments-for-saas__platform-as-the-owner-of-payments__sample-integration Utilize simulation APIs in the demo environment to test connected account status transitions, shopper actions, and payout status transitions before going live. ```APIDOC Simulate connected account status transition API: Description: Simulate a connected account status transition in the demo environment. Endpoint: POST /v1/simulation/accounts/{account_id}/update_status ``` ```APIDOC Simulate a shopper action API: Description: Simulate various shopper actions related to payment acceptance in the demo environment. ``` ```APIDOC Payout status transition API: Description: Simulate a payout status transition in the demo environment. Endpoint: POST /v1/simulation/payments/{payment_id}/transition ``` -------------------------------- ### API Parameters for Airwallex BaaS Account and Customer Setup Source: https://www.airwallex.com/docs/banking-as-a-service__overview/banking-as-a-service__kyc-and-onboarding__native-api__business-kyc-requirements__france-(fr) Lists the various parameters, their data paths, and their requirement levels (Optional, Required, Conditional) across different scenarios for account details, business person identifications, and customer agreements. ```APIDOC | `account_details.business_person_details.identifications.primary.passport` | Optional | Optional | Optional | | `account_details.business_person_details.identifications.primary.passport.front_file_id` | Required if upload picture | Required if upload picture | Required if upload picture | | `account_details.business_person_details.identifications.primary.personal_id` | Optional | Optional | Optional | | `account_details.business_person_details.identifications.primary.personal_id.back_file_id` | Required if upload picture | Required if upload picture | Required if upload picture | | `account_details.business_person_details.identifications.primary.personal_id.front_file_id` | Required if upload picture | Required if upload picture | Required if upload picture | | `account_details.business_person_details.last_name` | Required | Required | Required | | `account_details.business_person_details.nationality` | Required | Required | Required | | `account_details.business_person_details.roles` | One or more of the following: AUTHORISED\_PERSON, BENEFICIAL\_OWNER, DIRECTOR | One or more of the following: AUTHORISED\_PERSON, BENEFICIAL\_OWNER | AUTHORISED\_PERSON and BENEFICIAL\_OWNER | | `account_details.legal_entity_type` | Business | Business | Business | | `customer_agreements` | Required | Required | Required | | `customer_agreements.agreed_to_data_usage` | Required | Required | Required | | `customer_agreements.agreed_to_terms_and_conditions` | Required | Required | Required | | `primary_contact` | Required | Required | Required | | `primary_contact.email` | Required | Required | Required | ``` -------------------------------- ### Retrieve Payment Intent Status API Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__apac__alipay-cn__mobile-app-alipay-cn Poll the status of a Payment Intent using this GET API endpoint. It is recommended to start polling after the shopper is redirected back to the `return_url` provided during Payment Intent creation. ```APIDOC GET /api/v1/pa/payment_intents/{id} ``` -------------------------------- ### Airwallex API: Retrieve PaymentIntent Status Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__integration-checklist Documents the API endpoint used to retrieve the current status of a PaymentIntent. This is crucial for verifying the outcome of synchronous payment processes and ensuring the correct status has been received by the frontend. ```APIDOC API Endpoint: GET /api/v1/pa/payment_intents/{id} Purpose: Retrieve the status of a specific PaymentIntent. Expected Statuses: - REQUIRES_PAYMENT_METHOD - REQUIRES_CUSTOMER_ACTION - REQUIRES_CAPTURE - CANCELLED - SUCCEEDED ``` -------------------------------- ### Airwallex Online Payments Webhook Event Types Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__integration-checklist Details the essential webhook events related to online payments that an integration should subscribe to and handle. These notifications provide real-time updates on transaction statuses and other payment-related activities. ```APIDOC Online Payments Webhook Events (HTTP 200 response expected for all): - Success notification - Authorization failure notification - 3DS authentication failure notification - (Optional) Refund creation notification - (Optional) Successful refund notification ``` -------------------------------- ### API Reference: Create Account (POST /v1/accounts/create) Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments-for-platforms__onboard-connected-accounts__kyc-and-onboarding__native-api__business-kyc-requirements__others Reference to the Airwallex API for creating new accounts, highlighting the availability of optional fields for additional account information during the application process. ```APIDOC API Endpoint: POST /api/v1/accounts/create Purpose: Create a new account. Details: Supports additional optional fields for providing comprehensive account information during the application. ``` -------------------------------- ### Airwallex Onboarding SDK: Triggering Errors for Testing Source: https://www.airwallex.com/docs/banking-as-a-service__overview/banking-as-a-service__kyc-and-onboarding__embedded-kyc-component This guide provides methods to intentionally trigger specific error codes within the Airwallex Onboarding SDK in a demo environment, facilitating comprehensive testing of error handling mechanisms. ```APIDOC Error Code | How to Trigger INIT_ERROR | Call init() function with unsupported values for options, e.g., await init({env: 'other'}) where other is not supported UNAUTHORIZED | Internal error, unable to trigger AUTH_TIMEOUT | Block your network CREATE_ELEMENT_ERROR | Call createElement() function with unsupported element type, e.g., createElement('wrong_type') MOUNT_ELEMENT_ERROR | Call mount() method with a non-existent div id. e.g., element.mount('nonexistent-div-id') SUBMIT_FAILED | Internal error, unable to trigger UNKNOWN | Internal error, unable to trigger API_ERROR | Block your network ``` -------------------------------- ### Confirm Payment Intent and Redirect to Klarna Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__global__klarna__desktopmobile-website-browser-klarna Explains how to confirm a Payment Intent to obtain a redirect URL for Klarna. Suggests sending `payment_method.klarna.billing` for higher success rates. Discusses `auto_capture` option for immediate fulfillment businesses and provides an example response structure. ```APIDOC POST /api/v1/pa/payment_intents/{id}/confirm Request Body (JSON): payment_method.klarna.billing: Suggested for increased success rate. auto_capture: Optional boolean. Set to true for immediate fulfillment (e.g., intangible goods). ``` ```JSON { "next_action": { "type": "redirect", "url": "https://klarna.com/redirect_url" } } ``` -------------------------------- ### Airwallex OAuth Scopes API Naming Convention Source: https://www.airwallex.com/docs/banking-as-a-service__overview/developer-tools__get-started Describes the naming convention for Airwallex OAuth scopes, which group client APIs into business actions. These scopes define what data your application can read or update, following a specific format to denote read/write access, the resource, and the permitted operation. ```APIDOC OAuth Scope Naming Convention: :awx_action:_ Components: rw_prefix: r: read-only scope w: write action scope awx_action: Standard prefix for Airwallex actions resource: Core resource associated with the scope (e.g., balances, global_accounts) action: Operation permitted (e.g., view, edit) Example Scopes: r:awx_action:balances_view (read-only access to view balances) w:awx_action:global_accounts_edit (write access to edit global accounts) ``` -------------------------------- ### Airwallex.js init() Function API Reference Source: https://www.airwallex.com/docs/banking-as-a-service__overview/js/payments/host-payment-page This section provides the API documentation for the `init()` function, including its parameters and return type. The `init()` function is crucial for loading Airwallex.js and specifying required resources. ```APIDOC init(options?): void Parameters: options: InitOptions (optional) ``` -------------------------------- ### Retrieve Payment Intent Status API Call Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__north-america-and-latam__venmo-beta__desktopmobile-website-browser-venmo To get the payment result, poll the status of the Payment Intent via the Retrieve a Payment Intent API. Polling can start after the shopper is redirected back to your website or mobile app. Asynchronous notifications are also available via webhooks. ```APIDOC GET /api/v1/pa/payment_intents/{id} ``` -------------------------------- ### Create SCA Setup Element with createElement in TypeScript Source: https://www.airwallex.com/docs/banking-as-a-service__overview/js/sca/sca-setup This snippet demonstrates how to initialize an `scaSetup` element using the `createElement` function from the `@airwallex/components-sdk`. It shows how to pass `userEmail` and `prefilledMobileInfo` options for user authentication and mobile number pre-filling. ```TypeScript import { createElement } from '@airwallex/components-sdk'; const scaElement = await createElement('scaSetup', { userEmail: 'replace-with-user-email', prefilledMobileInfo: { countryCode: 'replace-with-user-country-code', // e.g. "61" for country Australia nationalNumber: 'replace-with-user-national-number', // e.g. "04XXXXXXXX" for country Australia }, }); ``` -------------------------------- ### Transaction Test Cases for Payment Intents API Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__integration-checklist Recommended transaction types to test in the production environment to ensure your integration is working correctly with the Airwallex Payment Intents API. These tests cover successful 3DS triggers, standard successful transactions, and verifying payment statuses. ```APIDOC Transaction Type: 1 successful 3DS trigger Test Card Number: Use a real card and input a nominal amount (e.g. $1). Set three_ds_action as FORCE_3DS when creating the PaymentIntent. Expected Return Response: Authorization is successful with 200 response code Transaction Type: 1 successful transaction Test Card Number: Use a real card and input a nominal amount (e.g. $1). Expected Return Response: Authorization is successful with 200 response code Transaction Type: 1 successful payment status check Test Card Number: None. Expected Return Response: When your frontend receives the result of a synchronous payment, call Retrieve a PaymentIntent API (/docs/api#/Payment_Acceptance/Payment_Intents/_api_v1_pa_payment_intents__id_/get) and check that the correct status has been received: REQUIRES_PAYMENT_METHOD, REQUIRES_CUSTOMER_ACTION, REQUIRES_CAPTURE, CANCELLED, SUCCEEDED. ``` -------------------------------- ### Retrieve Payment Intent Status by ID Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__apac__wechat-pay__mobile-app-wechat-pay Polls the status of a Payment Intent using its unique identifier. This API call allows you to get the current payment result after a shopper is redirected back to your application, typically via the 'return_url' specified during Payment Intent creation. ```APIDOC GET /api/v1/pa/payment_intents/{id} ``` -------------------------------- ### Install Airwallex Magento Plugin Dependencies Manually Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__plugins__magento__install-the-magento-plugin Commands to install the necessary Composer dependencies for the Airwallex Magento plugin when performing a manual installation. These commands must be run in the Magento root directory. ```Shell composer require mobiledetect/mobiledetectlib composer require guzzlehttp/guzzle:^7.0 ``` -------------------------------- ### Reference Error Codes for Troubleshooting Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments-for-platforms__payments-for-saas__platform-as-the-owner-of-payments__sample-integration Access documentation for error codes related to payments, payouts, and charges/transfers to assist with troubleshooting issues. ```APIDOC Payments error codes: Description: Reference for error codes specific to payments. ``` ```APIDOC Payout error codes: Description: Reference for error codes specific to payouts. ``` ```APIDOC Charges and Transfers error codes: Description: Reference for error codes specific to charges and transfers. ``` -------------------------------- ### Airwallex Onboarding SDK Error Triggering Guide Source: https://www.airwallex.com/docs/banking-as-a-service__overview/global-treasury__kyc-and-onboarding__embedded-kyc-component Provides instructions on how to intentionally trigger specific Airwallex SDK errors in a demo environment for testing purposes. ```APIDOC Error Code | How to trigger --- | --- INIT_ERROR | Call init() function with unsupported values for options, e.g., await init({env: 'other'}) where other is not supported UNAUTHORIZED | Internal error, unable to trigger AUTH_TIMEOUT | Block your network CREATE_ELEMENT_ERROR | Call createElement() function with unsupported element type, e.g., createElement('wrong_type') MOUNT_ELEMENT_ERROR | Call mount() method with a non-existent div id. e.g., element.mount('nonexistent-div-id') SUBMIT_FAILED | Internal error, unable to trigger UNKNOWN | Internal error, unable to trigger API_ERROR | Block your network ``` -------------------------------- ### Retrieve Payment Intent Status via API Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__apac__truemoney__mobile-app-truemoney To obtain the payment result, poll the status of the Payment Intent using this GET API endpoint. It is advised to start polling after the shopper returns to your mobile app via the 'return_url'. Additionally, Airwallex provides asynchronous payment result notifications through webhooks, with 'payment_intent.succeeded' being a recommended subscription. ```APIDOC GET /api/v1/pa/payment_intents/{id} ``` -------------------------------- ### Retrieve Payment Intent Status API Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__apac__dana__mobile-app-dana Poll the status of a Payment Intent to get the payment result. It is recommended to start polling after the shopper is redirected back to your mobile app, i.e., the `return_url` passed when creating the Payment Intent. Airwallex also provides asynchronous notifications via webhooks; subscribing to the `payment_intent.succeeded` webhook is recommended for confirming successful payments. ```APIDOC GET /api/v1/pa/payment_intents/{id} Purpose: Retrieve the current status of a Payment Intent. Usage: Poll this endpoint after the shopper is redirected back to your mobile app (return_url). Related: Asynchronous notifications are available via webhooks (e.g., payment_intent.succeeded). ``` -------------------------------- ### Remote Authorization: Health Check Endpoint Source: https://www.airwallex.com/docs/banking-as-a-service__overview/banking-as-a-service__remote-authorization__configure-remote-authorization Describes the optional health check feature for remote authorization. Airwallex performs HTTP GET requests to a separate URL to pre-establish and maintain connection, significantly reducing authorization request time. The URL must have the same host as your remote authorization URL and be configured to always return 200 OK. ```APIDOC HTTP GET request to a separate URL (must have same host as remote auth URL). Expected Response: 200 OK Prerequisites: Remote authorization configured, shared_secret generated. ``` -------------------------------- ### Initialize Airwallex.js for Onboarding, Payout, Risk, or Compliance Support Elements Source: https://www.airwallex.com/docs/banking-as-a-service__overview/js/payments/host-payment-page This TypeScript example demonstrates initializing Airwallex.js for non-payment elements like onboarding, payouts, or risk. It includes additional authentication parameters such as `authCode`, `clientId`, and `codeVerifier`. ```TypeScript import { init } from '@airwallex/components-sdk'; const options = { locale: 'en', env: 'prod', enabledElements: ['onboarding', 'payouts', 'risk'], authCode: 'replace-with-your-auth-code', clientId: 'replace-with-your-client-id', codeVerifier: 'replace-with-your-code-verifier', }; await init(options); ``` -------------------------------- ### Airwallex.js Library Overview Source: https://www.airwallex.com/docs/banking-as-a-service__overview/js Airwallex.js is a browser-side JavaScript library that lets you seamlessly embed pre-built UI elements into your web pages. With Airwallex.js, you can enable payment acceptance, customer onboarding (KYC/KYB), payouts, risk management, and more—all with minimal effort. This reference provides detailed documentation on every available element, object, and method in Airwallex.js. ```APIDOC Library: Airwallex.js Type: Browser-side JavaScript library Purpose: Embed pre-built UI elements for various financial operations. Capabilities: Payment acceptance, customer onboarding (KYC/KYB), payouts, risk management. Integration: Designed for minimal effort. ``` -------------------------------- ### Retrieve Payment Intent Status API Endpoint Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__apac__alipay-cn__mobile-website-browser-alipay-cn To obtain the payment result, poll the status of a Payment Intent using this GET API endpoint. It is recommended to start polling after the shopper is redirected back to your application via the `return_url`. Additionally, Airwallex provides asynchronous notifications via webhooks, with `payment_intent.succeeded` being a key event to subscribe to for successful payment indications. ```APIDOC GET /api/v1/pa/payment_intents/{id} Path Parameters: id: The unique identifier of the Payment Intent to retrieve. Purpose: Poll the status of a Payment Intent to retrieve its current payment result. Usage Notes: - Begin polling after the shopper is redirected to your `return_url`. - Complementary to webhook notifications (e.g., `payment_intent.succeeded`). ``` -------------------------------- ### Minimum Verification Requirements for Business Account Setup Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments-for-platforms__onboard-connected-accounts__kyc-and-onboarding__native-api__business-kyc-requirements__hong-kong-(hk) This table specifies the mandatory and optional parameters required for account verification, categorized by business structure: Company, Partnership, and Sole Trader. It includes details for business information, attachments, identifiers, account usage, and business person details. ```APIDOC Parameter | Company | Partnership | Sole Trader --- | --- | --- | --- `account_details` | Required | Required | Required `account_details.business_details` | Required | Required | Required `account_details.business_details.registration_address` | Required | Required | Required `account_details.business_details.registration_address.address_line1` | Required | Required | Required `account_details.business_details.registration_address.country_code` | Required | Required | Required `account_details.business_details.registration_address.postcode` | Required | Required | Required `account_details.business_details.registration_address.state` | Required | Required | Required `account_details.business_details.registration_address.suburb` | Required | Required | Required `account_details.business_details.attachments.business_documents` | Required; Certificate of incorporation | Required; Partnership agreement AND Business register or Electronic extract of information on the business register | Required; Business register or Electronic extract of information on the business register `account_details.business_details.attachments.business_documents.file_id` | Required | Required | Required `account_details.business_details.attachments.business_documents.tag` | CERTIFICATE_OF_INCORPORATION | PARTNERSHIP_AGREEMENT AND CERTIFICATION_REGISTRATION | CERTIFICATION_REGISTRATION `account_details.business_details.business_name` | Required | Required | Required `account_details.business_details.business_structure` | COMPANY | PARTNERSHIP | SOLE_PROPRIETOR `account_details.business_details.description_of_goods_or_services` | Required | Required | Required `account_details.business_details.industry_category_code` | Required | Required | Required `account_details.business_details.operating_country` | Required | Required | Required `account_details.business_details.business_identifiers` | Required | Required | Required `account_details.business_details.business_identifiers.number` | Required; must be CRN on Certificate of incorporation | Required; BRN | Required; BRN `account_details.business_details.business_identifiers.type` | BRN | BRN | BRN `account_details.business_details.business_identifiers.country_code` | HK | HK | HK `account_details.business_details.account_usage` | Required | Required | Required `account_details.business_details.account_usage.product_reference` | Required | Required | Required `account_details.business_details.account_usage.estimated_monthly_revenue` | Required | Required | Required `account_details.business_details.account_usage.estimated_monthly_revenue.currency` | Required | Required | Required `account_details.business_details.account_usage.estimated_monthly_revenue.amount` | Required | Required | Required `account_details.business_person_details` | All UBOs and Directors, and PPTA if applicable | All UBOs and Directors, and PPTA if applicable | The UBO `account_details.business_person_details.residential_address` | Required | Required | Required `account_details.business_person_details.residential_address.address_line1` | Required | Required | Required `account_details.business_person_details.residential_address.country_code` | Required | Required | Required `account_details.business_person_details.date_of_birth` | Required | Required | Required `account_details.business_person_details.first_name` | Required | Required | Required `account_details.business_person_details.identifications` | Required | Required | Required `account_details.business_person_details.identifications.primary` | Required | Required | Required `account_details.business_person_details.identifications.primary.identification_type` | Required | Required | Required `account_details.business_person_details.identifications.primary.issuing_country_code` | Required | Required | Required `account_details.business_person_details.identifications.primary.drivers_license` | Optional | Optional | Optional `account_details.business_person_details.identifications.primary.drivers_license.back_file_id` | Required if upload picture | Required if upload picture | Required if upload picture `account_details.business_person_details.identifications.primary.drivers_license.front_file_id` | Required if upload picture | Required if upload picture | Required if upload picture `account_details.business_person_details.identifications.primary.passport` | Optional | Optional | Optional `account_details.business_person_details.identifications.primary.passport.front_file_id` | Required if upload picture | Required if upload picture | Required if upload picture `account_details.business_person_details.identifications.primary.personal_id` | Optional | Optional | Optional ``` -------------------------------- ### Authenticate to Airwallex API using Postman Source: https://www.airwallex.com/docs/banking-as-a-service__overview/developer-tools__api__quickstart-with-postman Steps to obtain an access token from the Airwallex API using the 'Obtain access token' endpoint in the Postman collection. This includes details on token validity (30 minutes), how to include it in subsequent requests (Authorization: Bearer [token]), and the API's rate limit (100 requests per minute) with its corresponding error code (429). ```APIDOC API Authentication Process: Endpoint: Authentication > API Access > Obtain access token Action: Make an authentication request by clicking 'Send' in Postman. Response: Contains an authentication token. Access Token Usage: Validity: 30 minutes (recommended to rely on 'expires_at') Inclusion: HTTP header "Authorization: Bearer [token]" Rate Limit: Limit: 100 requests per minute Error: 429 (Too Many Requests) if limit is exceeded. ``` -------------------------------- ### Retrieve Payment Intent Status API Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__apac__alipay-cn__pay-with-qr-code-(desktop-website-browser)-alipay-cn Describes the API endpoint to poll the status of a Payment Intent. This is used to get the payment result after a shopper attempts payment, either by scanning a QR code or being redirected to an Alipay page. Polling should start immediately if a QR code was presented, or after redirection back to the return_url if the shopper was redirected to Alipay. ```APIDOC GET /api/v1/pa/payment_intents/{id} ``` -------------------------------- ### Handle Airwallex RFI Component Ready Event Source: https://www.airwallex.com/docs/banking-as-a-service__overview/global-treasury__handle-kyc-rfi__embedded-kyc-rfi-component Describes how to listen for the 'ready' event from the Airwallex KYC RFI component, which indicates the component is rendered and ready for interaction. It is recommended to show a loading state until this event is received. ```JavaScript // Example of handling the 'ready' event for Airwallex RFI component airwallex.on('ready', function() { // Hide loading state and show the RFI component console.log('Airwallex RFI component is ready.'); }); ``` -------------------------------- ### Charge Webhook Event and API Response Payload Example Source: https://www.airwallex.com/docs/banking-as-a-service__overview/developer-tools__listen-for-webhook-events__payload-examples__charges This JSON object represents a typical payload for charge-related webhook events, such as charge.new, charge.pending, charge.settled, and charge.suspended. It also mirrors the response structure of the 'Get a charge by ID' API, providing comprehensive details about a specific charge including its ID, status, amount, currency, description, merchant order ID, timestamps, customer ID, payment method details, and metadata. ```JSON { "id": "chr_00000000000000000000000000000000", "object": "charge", "status": "NEW", "amount": "100.00", "currency": "AUD", "description": "Payment for order #12345", "merchant_order_id": "order_12345", "created_at": "2023-01-01T12:00:00Z", "updated_at": "2023-01-01T12:00:00Z", "customer_id": "cus_00000000000000000000000000000000", "payment_method": { "id": "pm_00000000000000000000000000000000", "type": "card", "card": { "brand": "visa", "last4": "4242", "expiry_month": "12", "expiry_year": "2025" } }, "metadata": { "key1": "value1", "key2": "value2" } } ``` -------------------------------- ### Common Airwallex Onboarding Error Codes and Next Steps Source: https://www.airwallex.com/docs/banking-as-a-service__overview/global-treasury__kyc-and-onboarding__embedded-kyc-component Lists common error codes encountered during Airwallex Onboarding, their corresponding error messages, and recommended next steps for resolution. ```APIDOC Error code | Error message | Next steps --- | --- | --- INIT_ERROR | No provided | Check the required init() JS options. INIT_ERROR | Failed to authorize | Confirm that the clientId, env, codeVerifier and authCode passed in the init() JS function are valid. INIT_ERROR | Auth timeout | Please check if your network connection is stable. If so, please contact Airwallex support. UNAUTHORIZED | Failed to refresh token | The refreshToken might be expired (currently 1 hour). Please redo the entire flow to get a new authCode and initialize the SDK, and then create the element again. CREATE_ELEMENT_ERROR | Please init() before createElement() | Please confirm you have correctly loaded the SDK script using the init() function. CREATE_ELEMENT_ERROR | CreateElement with type not supported | Check the supported types JS. MOUNT_ELEMENT_ERROR | Cannot find element with dom element id: | Please check if the container dom id or the dom element passed in the mount() function is valid. SUBMIT_FAILED | Internal API error: Failed to submit form. | Please retry or contact Airwallex support. UNKNOWN | Unknown error | Please retry or contact Airwallex support. API_ERROR | API error | Error occurred when calling internal API. Please retry or contact Airwallex support. - (Console message only) | Please initialize Airwallex SDK | Please confirm if you have correctly loaded the SDK script using the init() function. ``` -------------------------------- ### Create a PaymentIntent - Example Response Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments__north-america-and-latam__ach-direct-debit__desktopmobile-website-browser Example JSON response received after successfully creating a PaymentIntent. ```JSON { "id": "pi_a610f760-b98a-406c-829d-4c3116891000", "object": "payment_intent", "status": "requires_payment_method", "amount": 100, "currency": "USD", "client_secret": "pi_a610f760-b98a-406c-829d-4c3116891000_secret_123", "created_at": "2023-01-01T12:00:00Z" } ``` -------------------------------- ### Airwallex Onboarding SDK: Common Error Codes and Troubleshooting Source: https://www.airwallex.com/docs/banking-as-a-service__overview/banking-as-a-service__kyc-and-onboarding__embedded-kyc-component This section details common error codes that may occur during the Airwallex Onboarding SDK integration, providing their associated error messages and recommended next steps for debugging and resolution. ```APIDOC Error Code | Error Message | Next Steps INIT_ERROR | No provided | Check the required init() JS options. INIT_ERROR | Failed to authorize | Confirm that the clientId, env, codeVerifier and authCode passed in the init() JS function are valid. INIT_ERROR | Auth timeout | Please check if your network connection is stable. If so, please contact Airwallex support. UNAUTHORIZED | Failed to refresh token | The refreshToken might be expired (currently 1 hour). Please redo the entire flow to get a new authCode and initialize the SDK, and then create the element again. CREATE_ELEMENT_ERROR | Please init() before createElement() | Please confirm you have correctly loaded the SDK script using the init() function. CREATE_ELEMENT_ERROR | CreateElement with type not supported | Check the supported types JS. MOUNT_ELEMENT_ERROR | Cannot find element with dom element id: | Please check if the container dom id or the dom element passed in the mount() function is valid. SUBMIT_FAILED | Internal API error: Failed to submit form. | Please retry or contact Airwallex support. UNKNOWN | Unknown error | Please retry or contact Airwallex support. API_ERROR | API error | Error occurred when calling internal API. Please retry or contact Airwallex support. - (Console message only) | Please initialize Airwallex SDK | Please confirm if you have correctly loaded the SDK script using the init() function. ``` -------------------------------- ### Get Current Balances API Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payouts__manage-transfers__handle-failed-transfers Describes how to retrieve the updated Wallet balance after a transfer cancellation using the Get Current Balances API. ```APIDOC GET /api/v1/balances/current Description: Retrieves the current Wallet balance. Returns: Updated Wallet balance. ``` -------------------------------- ### Accounts API Onboarding Overview Source: https://www.airwallex.com/docs/banking-as-a-service__overview/connected-accounts__kyc-and-onboarding Details the characteristics, use cases, and integration considerations for implementing a highly customized onboarding workflow using the Airwallex Accounts API. ```APIDOC Accounts API: Description: Fully control the onboarding UI, built on top of Airwallex APIs Suitable for: A highly customized onboarding workflow. Requires more time and development resources to implement and maintain. KYC information: Collect on your own interface AML (Anti-money laundering): Supported Sanctions screening: Supported Identity verification: Verification after submitting to Airwallex in the back end Customization: Full control over look and feel Integration effort: Most coding ``` -------------------------------- ### Airwallex.js Library Overview Source: https://www.airwallex.com/docs/banking-as-a-service__overview/js/risk/transactionRfi Airwallex.js is a browser-side JavaScript library that lets you seamlessly embed pre-built UI elements into your web pages. With Airwallex.js, you can enable payment acceptance, customer onboarding (KYC/KYB), payouts, risk management, and more—all with minimal effort. This reference provides detailed documentation on every available element, object, and method in Airwallex.js. ```APIDOC Airwallex.js Library: Purpose: Browser-side JavaScript library for embedding pre-built UI elements. Capabilities: Payment acceptance, customer onboarding (KYC/KYB), payouts, risk management. Integration: Minimal effort, provides detailed documentation on elements, objects, and methods. ``` -------------------------------- ### Example Request: Simulate Connected Account Status to ACTIVE (Shell) Source: https://www.airwallex.com/docs/banking-as-a-service__overview/payments-for-platforms__payments-for-saas__platform-as-the-owner-of-payments__sample-integration This shell command demonstrates how to use the connected account simulation API to programmatically change an account's status to `ACTIVE` in the demo environment. ```Shell curl -X POST \ https://api.airwallex.com/api/v1/accounts/simulate \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -d '{ "accountId": "acc_xxxxxxxxxxxxxxxxx", "status": "ACTIVE" }' ``` -------------------------------- ### Connected Account Transfer Webhook Payload Example Source: https://www.airwallex.com/docs/banking-as-a-service__overview/developer-tools__listen-for-webhook-events__payload-examples__connected-account-transfers Example JSON payload for `connected_account_transfer.new` and `connected_account_transfer.settled` webhook events, demonstrating the complete structure of a webhook notification. ```JSON { "data": { "id": "cat_0000A123456789BCDEF00000", "object": "connected_account_transfer", "status": "SETTLED", "amount": "100.00", "currency": "AUD", "source_account_id": "acc_0000A123456789BCDEF00000", "destination_account_id": "acc_0000A123456789BCDEF00000", "created_at": "2023-01-01T12:00:00Z", "updated_at": "2023-01-01T12:05:00Z", "metadata": {} }, "event_id": "evt_0000A123456789BCDEF00000", "event_type": "connected_account_transfer.settled", "created_at": "2023-01-01T12:05:01Z" } ```