Android v1 is deprecated. We recommend migrating to the latest version of our Android SDK. The best way to start is by making an incremental upgrade from v1 to v2.

Collecting device data

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


In your build.gradle, add the following:

dependencies {
  compile 'com.braintreepayments.api:data:1.7.10'




Download the latest JAR from Maven Central and include it in your project.

Android setup

If you are using Gradle, your manifest will automatically include the required permissions. There is no other setup required. For other integration methods, complete the following:

  1. Ensure your minSdk is set to 8 or higher.
    <uses-sdk android:minSdkVersion="8" />
  2. Specify INTERNET and ACCESS_NETWORK_STATE permissions in AndroidManifest.xml.
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />


  1. Get an instance of BraintreeData. The second parameter should be either BraintreeEnvironment.SANDBOX for testing or BraintreeEnvironment.PRODUCTION for production.
    BraintreeData mBraintreeData = new BraintreeData(context, BraintreeEnvironment.PRODUCTION);
  2. When verifying a card or creating a transaction, call collectDeviceData().
    String deviceData = mBraintreeData.collectDeviceData();
  3. Send deviceData to your server to be included in verification or transaction requests.

Keep a reference to the BraintreeData instance after calling collectDeviceData() until after a transaction has finished. The reference should persist through device rotations. Doing so allows us to ensure the best possible fraud detection measures.


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

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 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.
  • If you are using Kount Standard, have customer service reps create transactions in the Braintree Control Panel instead of creating orders via your website. This ensures that the transactions will be automatically approved by Kount's fraud rules. Kount Custom merchants need to create their own rules to mimic this behavior.
  • Skip Advanced Fraud Tools checks completely to avoid sending a transaction to Kount for evaluation.

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 is also 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.

Initialize BraintreeData with your own Kount merchant ID:

BraintreeData mBraintreeData = new BraintreeData(context, kountMerchantId, collectorUrl);

Contact us for more information.

Next Page: Server-side →