availability

iOS v3 is deprecated. We recommend migrating to the latest version of our iOS SDK. The best way to start is by making an incremental upgrade from v3 to v4.

Collecting device data

Braintree Data enables you to collect data about a customer's device and include it when creating a transaction or verification on your server. For more information, refer to the iOS header file for BTData.

  1. Add the Braintree/Data subspec to your Podfile. For example:
    Ruby
    pod 'Braintree', '~> 3.9'
    pod 'Braintree/Data', '~> 3.9'
  2. In your app, initialize BTData using initWithClient: for your environment, e.g. sandbox:

    #import "Braintree.h"
    #import "BTData.h"
    // ...
    
    // Retain your `BTData` instance for your entire application lifecycle.
    @property (nonatomic, strong) BTData *data;
    // ...
    
    // Example. You should use your existing Braintree or BTClient object.
    // If CLIENT_TOKEN_FROM_SERVER is invalid, `braintree.client` and
    // the subsequent `self.data` object will be nil.
    Braintree *braintree = [Braintree braintreeWithClientToken:CLIENT_TOKEN_FROM_SERVER];
    BTClient *client = braintree.client;
    self.data = [[BTData alloc] initWithClient:client environment:BTDataEnvironmentSandbox];
  3. Optionally, set a delegate to receive lifecycle notifications.
  4. Before submitting a transaction from your server, call collectDeviceData:
    NSString *deviceData = [self.data collectDeviceData];
    NSLog(@"Send this device data to your server: %@", deviceData);
  5. Send the returned string to your server along with transaction data to be included with the request to the Braintree gateway.
note

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.

PayPal

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 BTData using initWithClient:environment:.
  2. Invoke setCollectorUrl: and/or setFraudMerchantId: with your own Kount merchant ID.
  3. Call collectDeviceData as shown above.
[self.dataCollector setFraudMerchantId:@"YOUR_MERCHANT_ID"];
[self.dataCollector collectDeviceData];

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 →