Search...
APIJSLog inGet started
Airwallex logo
Home
Platform APIs
Connected Accounts
Accounts
Payments
Transactional FX
Payouts
Issuing
Back to home
OverviewChoose your payments solutionGet started with payments
Supported currencies
Online payments
Online payments overviewPayment Method Onboarding RequirementGet started with online paymentsHosted Payment Page
Drop-in Element
Embedded Elements
Card Element
Split Card Element
Legacy Embedded Elements
Full Featured Card Element
Guest user checkout
Registered user checkout
Redirect Element
QR Code Element
WeChat Pay Element
Mobile SDK
Plugins
Native API
Automatic Currency Conversion
Invoice integrations
Tax filing

Guest user checkout

This page describes how to embed a Full Featured Card Element on your payment page to accept payments.

How it works

The diagram below depicts the information flow in a Full Featured Card Element integration. Full Featured Card Sequence

Before you begin

Before you implement the integration, consider the following:

Step 1: Set up the server to create a PaymentIntent

When the shopper begins the checkout process, you will need to create a PaymentIntent object to indicate your intent to collect payment from the shopper.

When the checkout page loads, on your server, call Create a PaymentIntent API with an amount and currency. Always decide how much to charge on the server side, a trusted environment, as opposed to the client. This prevents malicious shoppers from being able to alter the payment amount.

Provide return_url in Create a PaymentIntent API to indicate where Airwallex should redirect the shopper after completing the payment, whether successful or otherwise.

The PaymentIntent’s id and client_secret are returned in the response these parameters let you confirm the payment and update card details on the client, without allowing manipulation of sensitive information, like payment amount.

Shell

Step 2: Initialize legacy Airwallex element on your checkout page

First, you will need to import the legacy airwallex-payment-elements SDK and then initialize the package. For details, see Initialize Airwallex .

Step 4: Handle the response

Add success and error event listeners to handle error and success events received from Airwallex.

JavaScript

If no error occurred, display a message that the payment was successful. If payment fails with an error, display the appropriate message to your shopper so they can take action and try again.

Retrieve the payment result

For any actions subsequent to the payment such as shipping goods or sending email receipts, you can retrieve the payment result using the following options:

  • Set up webhooks to receive notifications on whether the payment has succeeded. Airwallex sends payment_intent.succeeded event when a payment succeeds. Listen to these events rather than waiting on a callback from the client. On the client, the shopper could close the browser window or quit the app before the callback executes. For information on how to set up webhooks and listen to events, see Getting started with webhooks

  • On your server, call Retrieve a PaymentIntent API to check the PaymentIntent status.

  • Check Payment Activity screen on your Airwallex web app.

Test your integration

Use test card numbers and the test and go-live checklist to test your integration for various success and error scenarios in the demo environment and then go live in the production environment.

Example integrations

Explore a full, working code sample of an integration built using various web frameworks .

Supported features

You can use the following features in your Drop-in Element integration.

Style and appearance customization

You can customize the look and feel of the Drop-in Element JS using the following objects: appearance JS and layout JS.

theme and style objects have been deprecated in @airwallex/components-sdk version 1.19.1, use the enhanced appearance object instead.

appearance

You can customize the appearance of your Element to match the design of your website using the following customization options:

  • mode: The appearance mode for the Element. Accepts dark or light modes where each mode provides a different color variable preset and color generation logic. Defaults to light.

  • variables: Set variables to customize the appearance of the Element. Supports three color keys that accept RGB or HEX color formats.

    • colorBackground: Sets the primary text color. This option automatically generates a comprehensive color set, including secondary text, inverse text, disabled text, placeholder text, and more. Defaults to #14171a (light mode) and #F5F6F7 (dark mode).
    • colorBrand: Sets the main accent color used for Elements such as buttons, text links, focus borders, interactive backgrounds, highlights, etc. This color defines your brand's visual identity in the Element. Defaults to #612fff (light mode) and #ABA8FF (dark mode).
    • colorText: Sets the primary background color. This option alautomatically generates a complete set of background colors, including primary, secondary, field, and disabled backgrounds. Defaults to #ffffff (light mode) and #14171A (dark mode).
  • rules: Fine tune individual Elements and states by specifying custom CSS properties using rules. The following classes and pseudo-classes can be styled using rules.
    • .Button: CSSProperties
    • .Button:hover: CSSProperties
    • .GooglePayButton: CSSProperties
    • .GooglePayButton:hover: CSSProperties
    • .ApplePayButton: CSSProperties
    • .ApplePayButton:hover: CSSProperties
    • .Input: CSSProperties
    • .Input:hover: CSSProperties
    • .Input:active: CSSProperties
JavaScript

layout

The layout object supports two options:

  • alwaysShowMethodLabel: By default (false), the payment method icon is hidden when only one payment method is available. Set to true to always display the payment method icon.
  • type: Specify the layout for the payment elements. Defaults to accordion and tab layout on desktop and mobile interfaces respectively.
JavaScript
Accordion layout on Desktop Accordion layout - DesktopAccordion layout on MobileAccordion layout - Mobile
Tab layout on Desktop Tab layout - DesktopTab layout on Mobile Tab layout - Mobile

style (deprecated)

Provide base styling for the iframe using CSS properties. You can also customize the width and height of a pop-up overlay, e.g., payment with 3-D Secure authentication.

JavaScript

Localization

You can configure the Element to display localized text for payment fields based on the locale specified in init(). If no locale is specified, the browser's locale will be used, if it is supported by Airwallex.js. For a list of supported locales, see locales JS.

If the browser's locale is not supported, the Element will default to en.

Save card details for future payments

Airwallex allows you to create a PaymentConsent with the shopper to initiate future payments using shopper’s saved card details. For more information, see Save payment details for future payments.

3D Secure authentication

Airwallex automatically handles 3D Secure authentication offering either frictionless or challenge flow depending on the card issuer’s requirements. You can optionally pass the following fields in createElement() to support 3DS:

  • authFormContainer JS: A container for the authentication form. If a challenge flow is required to authenticate the shopper, an iframe will be rendered in this container to display the authentication page provided by the issuing bank. If not provided, Airwallex will create a div after body tag and use it as the container.
  • withBilling JS: If applicable set this to true to collect billing information from the shopper, which increases the likelihood of frictionless checkout.

Device fingerprinting

Device fingerprinting uniquely tracks and identifies devices used for transacting on your shopping site, increasing your protection from fraud. Airwallex.js automatically handles device fingerprinting, so no additional integration is needed.

Payments for platforms

You can accept payments as a platform via Drop-in Element. Example platforms include marketplaces, SaaS platforms, on-demand service providers. For more information on payments for platforms with Airwallex as an acquirer, see Airwallex payment gateway.

If you want the shopper to see the available payment methods activated by the connected account, specify the Connected Account ID in the platformConnectedAccount field in createElement().

To use Connected Account information to process the payment, e.g., statement descriptor displayed on the shopper's credit card or bank statement, provide connected_account_id in Create a Payment Intent API.

Troubleshooting

Some common error scenarios include :

ErrorNext steps
Airwallex is not definedCheck if you have initialized Airwallex (Step 2) before using Airwallex functions. If you are using CDN, check if you have changed the bundle version from x.x.x to the latest version in the package.json file. For example, https://checkout.airwallex.com/assets/elements.bundle.min.js is invalid
Access denied, authentication failedCheck if you have replaced your intent id and client_secret in createElement() and optionally confirm().
The PaymentIntent with ID int_xxxxxxxxx cannot be foundCheck if the environment you initialized Airwallex in, for example, demo or prod, matches the environment you retrieved your intent id and client_secret from. In other words, if you ran init in the demo environment, you must also create your PaymentIntent in the demo environment.
Was this page helpful?
On this page
Was this page helpful?