BTDataCollector
@objc
public class BTDataCollector : NSObject
Braintree’s advanced fraud protection solution.
-
Initializes a
BTDataCollector
instance with aBTAPIClient
.Declaration
Swift
@objc(initWithAPIClient:) public init(apiClient: BTAPIClient)
Parameters
apiClient
An instance of
BTAPIClient
-
Returns a client metadata ID.
Note
This returns a raw client metadata ID, which is not the correct format for device data when creating a transaction. Instead, it is recommended to usecollectDeviceData
.Declaration
Swift
@objc public func clientMetadataID(_ pairingID: String?) -> String
Parameters
pairingID
A pairing ID to associate with this clientMetadataID must be 10-32 chars long or null
Return Value
A client metadata ID to send as a header
-
Collects device data based on your merchant configuration.
We recommend that you call this method as early as possible, e.g. at app launch. If that’s too early, calling it when the customer initiates checkout is also fine. Use the return value on your server, e.g. with
Transaction.sale
.Declaration
Swift
@objc public func collectDeviceData(_ completion: @escaping (String?, Error?) -> Void)
Parameters
completion
A completion block that returns either a device data string that should be passed into server-side calls, such as
Transaction.sale
, or an error with the failure reason. -
collectDeviceData()
AsynchronousCollects device data based on your merchant configuration.
We recommend that you call this method as early as possible, e.g. at app launch. If that’s too early, calling it when the customer initiates checkout is also fine. Use the return value on your server, e.g. with
Transaction.sale
.Throws
AnError
describing the failureDeclaration
Swift
public func collectDeviceData() async throws -> String
Return Value
A device data string that should be passed into server-side calls, such as
Transaction.sale
.