Collecting device data

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

Gradle

In your build.gradle, add the following:

Groovy
Copy
Copied
dependencies {
  compile 'com.braintreepayments.api:data:1.+'
}

Maven

XML
Copy
Copied
<dependency>
    <groupId>com.braintreepayments.api</groupId>
    <artifactId>data</artifactId>
    <version>[1.0.0,)</version>
</dependency>

JAR

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.

    XML
    Copy
    Copied
    <uses-sdk android:minSdkVersion="8" />
  2. Specify INTERNET and ACCESS_NETWORK_STATE permissions in AndroidManifest.xml.

    XML
    Copy
    Copied
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Initializing

  1. Get an instance of BraintreeData. The second parameter should be either BraintreeEnvironment.SANDBOX for testing or BraintreeEnvironment.PRODUCTION for production.

    Java
    Copy
    Copied
    BraintreeData mBraintreeData = new BraintreeData(context, BraintreeEnvironment.PRODUCTION);
  2. When verifying a card or creating a transaction, call collectDeviceData().

    Java
    Copy
    Copied
    String deviceData = mBraintreeData.collectDeviceData();
  3. Send deviceData to your server to be included in verification or transaction requests.
important

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.

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

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 checks credit card and certain Google Pay transactions.

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:

Java
Copy
Copied
BraintreeData mBraintreeData = new BraintreeData(context, kountMerchantId, collectorUrl);

Contact our Accounts team for more information.

Next Page: Server-side →

Still have questions?

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