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
Mobile SDK
Guest user checkout
iOS Airwallex SDK
OverviewBefore you startNative UI integration
Apple PayCardRedirectWeChat Pay
Low-level API integrationSDK examples
Android Airwallex SDK
Registered user checkout
Airwallex iOS SDK Privacy Details
Plugins
Native API
Automatic Currency Conversion
Invoice integrations
Tax filing

WeChat Pay

This guide describes how to add WeChat Pay payment to your Airwallex iOS SDK integration.

Prerequisites
  1. Make sure you add dependency for AirwallexWeChatPay (Swift package manager) or Airwallex/AirwallexWechatPay (Cocoapods)
  2. Set up WechatOpenSDK by following the Wechat docs .

How it works

The diagram below depicts the integration flow for a WeChat Pay payment.

iOS WeChat one-off

Universal Link as returnURL

Please make sure that you provide a Universal Link (not a scheme URI link such as "airwallexcheckout://com.airwallex.payment") as the returnURL when creating a payment session. This allows the WeChat app to redirect shoppers back to your app as per iOS system security requirements.

Step 1: (Optional) Create a Customer

Create a Customer object and pass it to your server if you want to save your customer's details and attach payment information to this object. Note that this step is compulsory when you process recurring payments for a new customer.

From your server, access Airwallex API to Create a Customer API.

Step 2: Create a PaymentIntent

Your client app will need a PaymentIntent to create a payment session for Airwallex SDK to present a payment flow.

From your server, access Airwallex API to Create a PaymentIntent API and pass the returned PaymentIntent to the client app.

Step 3: Create a one-off PaymentSession

Create an AWXOneOffSession with the PaymentIntent created in the previous step, a returnURL to your app, and shipping address and shopper country code of this order.

swift

Step 4: Present payment flow to the shopper

Present payment flow with the Session created in the previous step. Airwallex SDK will then process the payment flow and return payment status to a delegate when the shopper completes or cancels payment.

Swift

Step 5: Query WeChat payment result

Implement the callback function onResp which will be invoked when the shopper is redirected from WeChat back to your app. The onResp function, declared in the WXApiDelegate protocol, lets you receive the payment result directly from WeChat. Alternatively, you can retrieve the PaymentIntent from your server afterward to confirm the payment result.

Retrieve the payment result by calling retrieve Payment Intent API and return it to the client app.

swift
Was this page helpful?
On this page
Was this page helpful?