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:
dependencies {
compile 'com.braintreepayments.api:data-collector:2.22.0'
}
Maven
<dependency>
<groupId>com.braintreepayments.api</groupId>
<artifactId>data-collector</artifactId>
<version>[2.0.0,)</version>
</dependency>
Initializing
Drop-in
Create a
DropInRequest
with a tokenization key or client token from your server.JavaDropInRequest dropInRequest = new DropInRequest() .clientToken(clientToken);
Specify
true
for the device data collection option.JavadropInRequest.collectDeviceData(true);
Start the Drop-in activity.
JavastartActivityForResult(dropInRequest.getIntent(this), REQUEST_CODE);
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(); } } }
Custom
Initialize a
BraintreeFragment
with a tokenization key or a client token from your server.When verifying a card or creating a transaction, call
DataCollector#collectDeviceData
.JavaDataCollector.collectDeviceData(braintreeFragment, new BraintreeResponseListener<String>() { @Override public void onResponse(String deviceData) { // send deviceData to your server } });
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
:
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.