Alipay

This guide explains how to process Alipay payments with our SDK.

Configuration

In order to use Alipay your should register merchant account. You can find detailed instructions in the Alipay guide.

Adding Alipay to your app must be done in one of two ways, depending on whether you are using the Ready-to-Use UI or the SDK & Your Own UI.
These two ways are covered in the sections below. Please follow the instructions relevant to the approach you have chosen.

iOS

Ready-to-Use UI

If you are using our ready-to-use checkout screens

Drap and drop OPPWAMobile-Alipay.framework to the "Frameworks" folder of your project.Make sure "Copy items if needed" is checked.

Embed the framework

Go to the app target’s General configuration page.

Add the framework target to the Embedded Binaries section by clicking the Add icon.

Select OPPWAMobile-Alipay.framework from the list of binaries.

Add a Run Script

The framework contains a build for both the simulator (i386, x86_64) and the actual devices (ARM). As it is not permitted to submit a binary for an unsupported architecture to App Store, you have to add script that "manually" removes unused architectures from the final binary.

Go to the app target’s Build Phases tab.

In Xcode menu, select Editor > Add Build Phase > Add Run Script Build Phase. You should now see a Run Script section in your Build Phase options.
Important: "Run Script" phase should be put after "Embed Framework" phase. You can reoder build phases by dragging them using your mouse.

Set it to use /bin/sh and check the Run script only when installing option.

SDK & Your Own UI

If you are using our SDK & Your Own UI then there is a little more work to be done, but it is still easy to add. There are two options for accepting Alipay payments.
Create PaymentParams with the checkout id and submit a transaction:

PaymentParams paymentParams = new PaymentParams(checkoutId, "ALIPAY");
Transaction transaction = new Transaction(paymentParams);
/* use IProviderBinder to interact with service and submit transaction */
binder.submitTransaction(transaction);

Call the native method from Alipay SDK with the value alipaySignedOrderInfo property from the transaction which your received in the callback: