Premium Fraud Management Tools
Client-Side Implementation
Collecting device data
To help detect fraud, use dataCollector
to collect information about a customer's device on your checkout page. Device data collection capabilities are included in version 2.16.0+ of our JavaScript SDK, but these versions only support sending device data for Kount. To take advantage of device data collection with our Fraud Protection product, please upgrade to the latest version of the JavaScript SDK, v3.
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 */
PayPal
If you're also accepting PayPal using the Vault flow, you can simultaneously collect that device data by using the dataCollector
. See the PayPal Vault guide for details.
Next Page: Server-side →