Quick start
This topic introduces how to quickly set up the Alipay+ iOS SDK.
Before you begin
Before you get started, ensure that the following requirements are met:
- Install Xcode 12.* or later
- Ensure that the minimum deployment target is set to iOS 9 or later.
Step 1. Add the SDK to your project
- Log on to Alipay+ Developer Center to download the SDK binaries as a package. You can also obtain the source code if you need to review or customize the SDK source code. The following table lists the SDK packages that are required for different Alipay+ payment products:
Product | Merchant-presented Mode Payment | Auto Debit | |
Framework | Foundational |
| |
Product-specific |
|
| |
Product-specific bundle |
| N/A |
Note: If you want to accelerate page loading for Merchant-presented Mode Payment, integrate the page loading acceleration frameworks in the SDK and call the preload API to enable acceleration as soon as the MPP app is launched.
- Ensure that the SDK is linked to your project.
- If you use CocoaPods to publish your SDK, add the following lines to your podspec file:
- If you do not integrate the page loading acceleration frameworks:
s.subspec 'Foundation' do |ss|
ss.vendored_frameworks= ["YOUR_PATH/MPPAlipayPlusClient.framework", "YOUR_PATH/IAPTinyLogger"]
end
s.subspec 'MPM' do |ss|
ss.vendored_frameworks= ["YOUR_PATH/MPPAlipayPlusClientMPM.framework", "YOUR_PATH/IAPMinContainer.framework"]
ss.resources = ["YOUR_PATH/IAPMinContainer.framework/IAPMinContainer.bundle"]
ss.dependency "YOUR_POD/Foundation"
end
s.subspec 'AutoDebit' do |ss|
ss.vendored_frameworks= ["YOUR_PATH/MPPAlipayPlusClientAutoDebit.framework"]
ss.dependency "YOUR_POD/Foundation"
end
- If you integrate the page loading acceleration frameworks:
s.subspec 'Foundation' do |ss|
ss.vendored_frameworks= ["YOUR_PATH/MPPAlipayPlusClient.framework", "YOUR_PATH/IAPTinyLogger"]
end
s.subspec 'MPM' do |ss|
ss.vendored_frameworks= ["YOUR_PATH/MPPAlipayPlusClientMPM.framework", "YOUR_PATH/IAPMinContainer.framework", "YOUR_PATH/IAPManifestResource.framework", "YOUR_PATH/IAPResourceManager.framework"]
ss.resources = ["YOUR_PATH/IAPMinContainer.framework/IAPMinContainer.bundle"]
ss.dependency "YOUR_POD/Foundation"
end
s.subspec 'AutoDebit' do |ss|
ss.vendored_frameworks= ["YOUR_PATH/MPPAlipayPlusClientAutoDebit.framework"]
ss.dependency "YOUR_POD/Foundation"
end
- If you do not use CocoaPods, you can manually add the SDK as follows:
- Add the required framework and bundle files to your project based on the product you use. Make sure to select Copy items if needed.
(1) Merchant-presented Mode Payment
- If you do not integrate the page loading acceleration frameworks:
- If you integrate the page loading acceleration frameworks:
(2) Auto Debit
b. Make sure to add -ObjC to Build Settings > Linking > Other Linker Flags to use the class category.
Note: If your project is created using Swift and the "Undefined symbol: ___llvm_profile_runtime" error is triggered during the build, try to add -fprofile-instr-generate to Build Settings > Linking > Other Linker Flags to resolve the error.
Step 2. Set up the SDK before using other APIs
- Import the SDK header file to your project.
import <MPPAlipayPlusClient/MPPAlipayPlusClientAPI.h>
2. Set up the SDK with the required configurations.
MPPConfiguration *configuration = IAPConfiguration.new;
configuration.clientId = @"XXX";
configuration.envType = @"PROD";
configuration.siteName = @"YYY";
[[MPPAlipayPlusClient shared] setConfiguration:configuration];
Next steps
After you have integrated the SDK, you can move on to use the SDK in different payment scenarios.
For more information about how to use the SDK in Merchant-presented Mode Payment, see Merchant-presented Mode Payment integration.
For more information about how to use the SDK in Auto Debit, see Auto Debit integration.