Collecting device data
It is recommended that all customer-initiated transactions include device data. Device data increases the accuracy of our available Advanced Fraud Management Tools in determining when a transaction is fraudulent.
Integration
If you are using script
tags to load files, make sure to include:
HTML
<script src="https://js.braintreegateway.com/web/3.71.0/js/client.min.js"></script>
<script src="https://js.braintreegateway.com/web/3.71.0/js/data-collector.min.js"></script>
To collect device data, create a client
and a dataCollector
instance with the following options. You can use the same client
as you are using for other components, such as hostedFields
or paypal
.
braintree.client.create({
authorization: 'CLIENT_AUTHORIZATION'
}, function (err, clientInstance) {
// Creation of any other components...
braintree.dataCollector.create({
client: clientInstance,
paypal: true
}, function (err, dataCollectorInstance) {
if (err) {
// Handle error in creation of data collector
return;
}
// At this point, you should access the dataCollectorInstance.deviceData value and provide it
// to your server, e.g. by injecting it into your form as a hidden input.
var deviceData = dataCollectorInstance.deviceData;
});
});
Using Device Data
Include the device data string in the Transaction: Sale call on your server. If our Advanced Fraud Management Tools detect a high probability that the transaction is fraudulent it will be rejected.
Contact us for more information.