Airwallex logo
Airwallex logo

Before you start

Follow these steps to set up Airwallex iOS SDK.

Requirements

  • Requires Xcode 15.4 or later and is compatible with apps targeting iOS 13 or above
  • Available through Swift Package Manager and CocoaPods . Please install the latest version of CocoaPods to ensure you can add Airwallex SDK to your application.

Step 1: Set up SDK

Swift Package Manager

Airwallex for iOS is available via Swift Package Manager. To integrate it into your project, follow these steps:

  1. Follow Apple's guide on how to add a package dependency in Xcode.

  2. Use the following URL for the Airwallex package: https://github.com/airwallex/airwallex-payment-ios

  3. Ensure you specify version 6.1.1 or later.

You can add Airwallex for a comprehensive integration that includes everything except WeChat Pay. Alternatively, you can selectively add specific products to your project for a more modular setup, depending on your payment needs:

  • AirwallexPaymentSheet: For UI integration.
  • AirwallexPayment: For low-level API integration.
  • AirwallexWeChatPay: Required for WeChat Pay integration.

CocoaPods

Airwallex for iOS is available via CocoaPods .

You can add Airwallex for a comprehensive integration that includes everything except WeChat Pay:

Ruby
1pod 'Airwallex', '~> 6.1.1'

Alternatively, you can selectively add specific products to your project for a more modular setup, depending on your payment needs:

Ruby
1pod 'Airwallex/AirwallexPaymentSheet' # For UI integration. 
2pod 'Airwallex/AirwallexPayment' # For low-level API integration
3pod 'Airwallex/AirwallexWeChatPay' # Required for WeChat Pay integration

Run the following command:

Ruby
1pod install

Step 2: Set up your server to access Airwallex API

Obtain your access token API using your unique Client ID and API key accessible via web app (Account > Developer > API keys).

Before processing a payment, your server must create a PaymentIntent API and pass it to the client. After the payment is completed, your server needs to retrieve the PaymentIntent API to check the payment result.

Step 3: Configure SDK

  1. Import the module where you want to use the Airwallex iOS SDK
swift
1import Airwallex
  1. Configure the working mode for SDK and the client secret

When your app starts:

  • Set the mode for SDK to connect with different Airwallex server environments.
swift
1Airwallex.setMode(.demoMode); // .demoMode, .stagingMode, .productionMode
swift
1AWXAPIClientConfiguration.shared().clientSecret = “Your client secret”;
Was this page helpful?