MercadoPago的iOS设备SDK
这是为什么用的?
MercadoPago的iOS设备SDK使您能够轻松地获取设备指纹信息。当您与MercadoPago处理支付时,应发送这些信息,以便我们能用它帮助您避免拒绝支付或退货。有关更多详细信息,请访问开发者指南。
要求
此模块目前支持Swift
或Objective-C
且为iOS 10.0+
。
安装
MercadoPago的设备SDK可以通过CocoaPods获得。要安装它,只需将以下行添加到您的Podfile中
pod "MercadoPagoDevicesSDK"
使用方法
导入此模块需要以下步骤
Swift
import MercadoPagoDevicesSDK
Objective-C
@import MercadoPagoDevicesSDK;
使用此模块,只需两个步骤。
首先,当应用启动时,您需要在AppDelegate
的didFinishLaunchingWithOptions
方法中包含以下行以初始化SDK。
Swift
MercadoPagoDevicesSDK.shared.execute()
Objective-C
[[MercadoPagoDevicesSDK shared] execute];
然后,当用户到达结账页面时,您可以执行以下其中一个方法来获取设备指纹信息。
Swift
MercadoPagoDevicesSDK.shared.getInfo() // Returns a Device object with the info, this class is a Codable class
MercadoPagoDevicesSDK.shared.getInfoAsJson() // returns a Data object from JSON library
MercadoPagoDevicesSDK.shared.getInfoAsJsonString() // returns a String object with the infomation encoded as JSON
MercadoPagoDevicesSDK.shared.getInfoAsDictionary() // returns a Dictionary<String,Any> object
Objective-C
[[[MercadoPagoDevicesSDK] shared] getInfoAsJson] // returns a Data object from JSON library
[[[MercadoPagoDevicesSDK] shared] getInfoAsJsonString] // returns a String object with the infomation encoded as JSON
[[[MercadoPagoDevicesSDK] shared] getInfoAsDictionary] // returns a Dictionary<String,Any> object
示例
我们包含了两个此SDK的用法示例,一个是Swift
语言的,另一个是Objective-C
语言的。
作者
设备团队,[email protected]
许可协议
Mercado Pago的设备SDK受MIT许可协议的保护。有关更多信息,请参阅LICENSE文件。