BTDataCollector
@objc
public class BTDataCollector : NSObject
Braintree’s advanced fraud protection solution.
-
Initializes a
BTDataCollectorinstance.Declaration
Swift
@objc(initWithAuthorization:) public init(authorization: String)Parameters
authorizationA valid client token or tokenization key used to authorize API calls.
-
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?) -> StringParameters
pairingIDA 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
completionA 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
AnErrordescribing the failureDeclaration
Swift
public func collectDeviceData() async throws -> StringReturn Value
A device data string that should be passed into server-side calls, such as
Transaction.sale. -
This method should be used for markets where high coverage of device data is needed (ex: Predictions Market). 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. When using this method you should only proceed if a success is returned. In cases where an error is returned, retrying this method is recommended.
Use the return value on your server, e.g. with
Transaction.sale. or in client side requests such as PayPal, Venmo, or Local Payment Methods.Declaration
Swift
@objc public func collectDeviceDataOnSuccess( riskCorrelationID: String? = nil, _ completion: @escaping (String?, Error?) -> Void )Parameters
riskCorrelationIDOptional: A risk correlation ID to associate with this device data collection
completionA completion block that returns either a device data string or an error with the failure reason. Retries are recommended on failure.
-
collectDeviceDataOnSuccess(riskCorrelationID:Asynchronous) This method should be used for markets where high coverage of device data is needed (ex: Predictions Market). 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. When using this method you should only proceed if a success is returned. In cases where an error is returned, retrying this method is recommended.
Use the return value on your server, e.g. with
Transaction.sale. or in client side requests such as PayPal, Venmo, or Local Payment Methods.Throws
AnErrordescribing the failure or timeout. Retries are recommended on failure to ensure coverage.Declaration
Swift
public func collectDeviceDataOnSuccess(riskCorrelationID: String? = nil) async throws -> StringParameters
riskCorrelationIDOptional: A risk correlation ID to associate with this device data collection.
Return Value
A device data string that should be passed into server-side calls, such as
Transaction.sale.
View on GitHub