Collecting device data

DataCollector 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
dependencies {
  compile 'com.braintreepayments.api:data-collector:3.+'
}

Initializing

Drop-in

  1. Create a DropInRequest with a tokenization key or client token from your server.

    Java
    DropInRequest dropInRequest = new DropInRequest()
     .clientToken(clientToken);
  2. Specify true for the device data collection option.

    Java
    dropInRequest.collectDeviceData(true);
  3. Start the Drop-in activity.

    Java
    startActivityForResult(dropInRequest.getIntent(this), REQUEST_CODE);
  4. Send the device data string response from Drop-in to your server to be included in verification or transaction requests.

    Java
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
     if (requestCode == REQUEST_CODE) {
       if (resultCode == RESULT_OK) {
         DropInResult result = data.getParcelableExtra(DropInResult.EXTRA_DROP_IN_RESULT);
         String deviceData = result.getDeviceData();
       }
     }
    }
    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.

Custom

  1. Initialize a BraintreeFragment with a tokenization key or a client token from your server.
  2. When verifying a card or creating a transaction, call DataCollector#collectDeviceData.

    Java
    DataCollector.collectDeviceData(braintreeFragment, new BraintreeResponseListener<String>() {
     @Override
     public void onResponse(String deviceData) {
       // send deviceData to your server
     }
    });
  3. Send the string response from DataCollector#collectDeviceData to your server to be included in verification or transaction requests.

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.

Once you've acquired your Kount merchant ID, pass it as a parameter to DeviceCollector#collectDeviceData:

Java
DataCollector.collectDeviceData(braintreeFragment, kountMerchantId, new BraintreeResponseListener<String> {
  @Override
  public void onResponse(String 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 →