Collecting device data

BraintreeDataCollector enables you to collect data about a customer's device and correlate it with a session identifier on your server.

  1. Add the Braintree/DataCollector subspec to your Podfile. For example:
    Ruby
    pod 'Braintree'
    pod 'Braintree/DataCollector'
    (If you're using Carthage, add BraintreeDataCollector.framework to your app.)
  2. Initialize the data collector and specify your environment, e.g. sandbox:

    Objective-C Swift
    #import "BTDataCollector.h"
    
    // Retain your `BTDataCollector` instance for your entire application lifecycle.
    @property (nonatomic, strong) BTDataCollector *dataCollector;
    
    BTAPIClient *apiClient = [[BTAPIClient alloc] initWithAuthorization:"@CLIENT_TOKEN_FROM_SERVER"];
    self.dataCollector = [[BTDataCollector alloc] initWithAPIClient:apiClient];
  3. Optionally, set a delegate to receive lifecycle notifications. This is useful if you need to guarantee that data collection is successful before creating a transaction.
  4. Before making a request to your server, get the device data string by calling the appropriate data collection method:
    Objective-C Swift
    [dataCollector collectCardFraudData:^(NSString * _Nonnull deviceData) {
     // Send deviceData to your server
    }];
  5. Send the device data string to your server along with transaction or verification data. Your server will include this device_data parameter when submitting the request to the Braintree gateway.

Creating orders on behalf of customers

Kount, our fraud detection partner, flags multiple orders from the same device if there are multiple card numbers associated with that device. If your customer service reps manually create orders through your normal checkout flow, Kount may identify false positives. This can increase your decline rate.

There are two ways to prevent false positives when creating multiple orders on the same device:

  • Build a separate checkout flow that doesn’t use device data and make it accessible only to customer service reps (e.g. via a VPN). This prevents Kount from linking and flagging transactions based on device data.
  • Have customer service reps create transactions in the Braintree Control Panel instead of creating orders via your website. This bypasses Kount’s fraud screening.

Kount Custom integration

We offer a direct integration with Kount, our partner for providing advanced fraud detection technology. Like our Kount Standard integration, Kount Custom only checks credit card payment methods.

To use this feature, you must be processing at least 2500 transactions per month, and you’ll be subject to additional fees from Kount for their services. Learn more about the requirements and considerations.

  1. Once you've acquired your Kount merchant ID, initialize BTDataCollector.
  2. Invoke setCollectorUrl: and/or setFraudMerchantId: with your own Kount merchant ID.
  3. Call collectCardFraudData as shown above.
Objective-C Swift
[self.dataCollector setFraudMerchantId:@"YOUR_MERCHANT_ID"];
[dataCollector collectCardFraudData:^(NSString * _Nonnull deviceData) {
  // Send deviceData to your server
}];

Contact our Accounts team for more information.

Next: Server-side →

Still have questions?

If you can’t find an answer, contact our Support team.