Collecting device data

To detect fraud, use dataCollector to collect information about a customer's device on your checkout page and pass it to Kount for review. Device data collection capabilities are included in version 2.16.0+ of our JavaScript SDK.

To collect device data, pass some additional dataCollector options to your braintree.setup call. The following example is for custom, but will also work for dropin.

JavaScript
braintree.setup(CLIENT_AUTHORIZATION, 'custom', {
  dataCollector: {
    kount: {environment: 'sandbox'}
  },
  onReady: function (braintreeInstance) {
    // At this point, you should access the braintreeInstance.deviceData value
    // and provide it to your server, e.g. by injecting it into your form as a
    // hidden input.
    deviceData = braintreeInstance.deviceData;
  }
  /* ... */
});

Available options for dataCollector.kount.environment:

  • sandbox
  • production

The braintreeInstance returned by onReady will have an additional deviceData string value. It is up to you to provide this value to your server. The most common mechanism for this is to inject the device data value into your form as a hidden input inside of your onReady callback.

JavaScript
braintree.setup(CLIENT_AUTHORIZATION, 'custom', {
  dataCollector: {
    kount: {environment: 'sandbox'}
  },
  onReady: function (braintreeInstance) {
    var form = document.getElementById('my-form-id');
    var deviceDataInput = form['device_data'];

    if (deviceDataInput == null) {
      deviceDataInput = document.createElement('input');
      deviceDataInput.name = 'device_data';
      deviceDataInput.type = 'hidden';
      form.appendChild(deviceDataInput);
    }

    deviceDataInput.value = braintreeInstance.deviceData;
  }
  /* ... */
});

Standalone usage

If you are not using braintree.setup for your integration, you can still collect device data by setting up the data collector directly through braintree.data.setup:

JavaScript
var dataCollector = braintree.data.setup({
  kount: {environment: 'sandbox'},
});

dataCollector.deviceData; /* for use in transaction creation */

You can use the teardown method to reset to a clean state; the same best practices apply to calling teardown on braintree.data.setup as do braintree.setup. In the case of braintree.data.setup calling teardown will invalidate any previously generated device data from the client session.

JavaScript
dataCollector.teardown(); /* for cleanly resetting your integration */
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.

Once you have spoken with our Accounts team and determined Kount Custom is a good fit for your business, they'll help you get your own credentials and a Kount merchant ID. Then, follow the instructions below to use your own Kount credentials and rules instead of Braintree's.

To use your own Kount merchant ID for fraud detection, pass it in as an additional dataCollector.kount.merchantId parameter in your braintree.setup call:

JavaScript
braintree.setup(CLIENT_AUTHORIZATION, 'custom', {
  dataCollector: {
    kount: {
      environment: 'sandbox',
      merchantId: 'my-custom-kount-id'
    }
  },
  onReady: function (braintreeInstance) {
    braintreeInstance.deviceData;
  }
  /* ... */
});

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 →