Alipay, China's leading third-party online payment solutionAlipay, China's leading third-party online payment solution

Integrate the SDK Package

This topic covers how to easily integrate the iOS SDK package with CocoaPods and by manual operation.

Integrate the SDK Package with CocoaPods

Please follow the steps below to integrate the SDK package with CocoaPods.

  1. Update the .netrc file:

For security reasons, Antom SDK uses a private CocoaPods source to distribute the pods. To gain access to the private source, you need to update your .netrc file which holds the required credentials. Copy the code snippet below to update your .netrc file.

The .netrc file is located in the ~/.netrc directory, if it does not exist, you need to create a .netrc file. Refer to the .netrc file for more information.

copy
machine globaltech.alipay.com 
login antomsdk@aliyun.com
password Admin1234
  1. Add the private source and dependency to your Podfile:

Antom provides you with multiple integration package options. Use the corresponding code snippet to add CocoaPods private source and dependencies to your Podfile.

  • SDK package (Required)
copy
source 'https://globaltech.alipay.com/api/v1/file/common/5700989804217335/antom'

target 'YOUR_TARGET' do

  pod 'AMSComponent'

end
  • SDK security package (Optional): Enhance security performance and reduce security challenges in the payment process.
copy
source 'https://globaltech.alipay.com/api/v1/file/common/5700989804217335/antom'

target 'YOUR_TARGET' do
  
  pod 'AMSComponent'
  pod 'AMSSecurity'

end
  • Apple Pay package (Optional): When you need to integrate Apple Pay, use the following code snippet. The Apple Pay package can be used in conjunction with the security package.
copy
source 'https://globaltech.alipay.com/api/v1/file/common/5700989804217335/antom'

target 'YOUR_TARGET' do

  pod 'AMSComponent'
  pod 'AMSApplePay'

end

Integrate the SDK Package manually

If you are not using CocoaPods integration, you can follow the manual integration method provided by Antom.

  1. Download the latest SDK package in Alipay Global Partner Developer Center:

Go to Resources > Download Detail > iOS, select the corresponding product package, and click on View the download address of this package to download. Accept the download agreement for the first download.

  1. Add the frameworks:

Add the following frameworks to your project:

SDK package framework:

  • AMSComponent.framework
  • AlipayWebView.framework

Add AlipayWebView.framework/IWebContainer.bundle and AMSComponent.framework/AMSComponent.bundle.

image.png

  1. Add -ObjC:

Go to Build Settings > Linking > Other Linker Flags to add -ObjC.

image.png