The MercadoPago's Devices SDK for iOS makes it easy to obtain the device fingerprinting information. You should send this information when processing a payment with MercadoPago so we can use it to help you avoid rejected payments or chargebacks. For more details about this, visit the developers guide.
This module currently supports iOS 10.0+, with Swift or Objective-C.
MercadoPago's Devices SDK is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "MercadoPagoDevicesSDK"
To import this module you have to do the following:
Swift
import MercadoPagoDevicesSDK
Objective-C
@import MercadoPagoDevicesSDK;
To use the module, there are only two steps.
First, you have to initialize the SDK when the app opens.
For this you should include in the AppDelegate
's didFinishLaunchingWithOptions
method the following line.
Swift
MercadoPagoDevicesSDK.shared.execute()
Objective-C
[[MercadoPagoDevicesSDK shared] execute];
Then, when the user arrives to the checkout you can execute one the following methods to retrieve the device fingerprinting information.
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
We include two examples of the usage of this SDK, one in Swift
and one in Objective-C
.
Devices Team, [email protected]
Mercado Pago's Devices SDK is available under the MIT license. See the LICENSE file for more info.