Airwallex logo

Before you start

Step 1: Set up SDK

The Airwallex iOS SDK requires Xcode 10.0 or later and is compatible with apps targeting iOS 10 or above.

Airwallex for iOS is available through either CocoaPods or Carthage . If you haven't already, please install the latest version of CocoaPods .

If you don't have an existing Podfile, run the following command to create one:

$ pod init

Add this line to your Podfile:

pod ‘Airwallex’

Run the following command:

$ pod install

Don’t forget to use the .xcworkspace file to open your project in Xcode, instead of the .xcodeproj file, from here on out.

To update to the latest version of the SDK, just run:

$ pod update Airwallex

Step 2: Configuration and create payment intent

1. Configure the SDK

When your app starts, configure the SDK. You can set mode with AirwallexSDKTestMode for testing, or set mode with AirwallexSDKLiveMode for production. Payment intent client secret can be returned from Create Payment Intent API Docs . If you want to use the entire Native UI in one Flow, please set customer secret, it could be returned from Create Customer Secret API Docs .

  [Airwallex setMode:AirwallexSDKTestMode]; // AirwallexSDKTestMode or AirwallexSDKLiveMode
   [AWXAPIClientConfiguration sharedConfiguration].clientSecret = “Payment intent clientSecret”;
   [AWXCustomerAPIClientConfiguration sharedConfiguration].clientSecret = “Customer secret”;

2. Create Payment Intent on your server

Before confirming the PaymentIntent, you must create a PaymentIntent on the server and pass it to the client.

Follow these steps to create a PaymentIntent in Merchat's server:

  1. To begin you will need to obtain an access token to allow you to reach all other API endpoints. Using your unique Client ID and API key (these can be generated within Account settings > API keys ) you can call the Authentication API endpoint. On success, an access token will be granted.
  2. Create customer(optional) allows you to save your customers’ details, attach payment methods so you can quickly retrieve the supported payment methods as your customer checks out on your shopping site. (/api/v1/pa/customers/create )
  3. Finally, you need to create a PaymentIntent object on your own server via /api/v1/pa/payment_intents/create and pass it to your client.
  4. In the response of each payment intent, you will be returned with client_secret, which you will need to store for later uses. After creating the payment intent, you can use Airwallex SDK to confirm payment intent and enable the shopper to complete the payment with selected payment methods

Step 3: Choose integration option

  1. Airwallex API integration. If you prefer to use your own payment UI, you can choose to integrate Airwallex iOS SDK via API.

  2. Airwallex Native UI Integration. You can choose to use Airwallex iOS SDK with our prebuilt UI page.

Our demo is available as an open source application on Github and it will help you to better understand how to integrate Airwallex iOS SDK in your iOS App.