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:

    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:

    #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:

    [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.


If you choose to automatically vault a customer's new payment method, verifications for those payment methods will not include device data when they are evaluated by our Advanced Fraud Management Tools. Subsequent transactions can still pass device data.


If you're also accepting PayPal using the Vault flow, you can simultaneously collect that device data by adding a paypal option to your dataCollector. See the PayPal Vault guide for details.

Kount Custom integration

We offer a direct integration with Kount, our partner for providing customizable advanced fraud detection technology. Kount Custom is compatible with many 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.
[self.dataCollector setFraudMerchantId:@"YOUR_MERCHANT_ID"];
[dataCollector collectCardFraudData:^(NSString * _Nonnull deviceData) {
  // Send deviceData to your server

Creating orders on behalf of customers

Kount will flag 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 a few 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.
  • Create a rule in your Kount Custom panel to automatically approve transaction created from the Braintree Control Panel, and have customer service reps create transactions in the Braintree Control Panel instead of creating orders via your website.

Contact us for more information.

Next Page: Server-side →