Premium Fraud Management Tools
Client-Side Implementation
Collecting device data
DataCollector
enables you to collect data about a customer's device and correlate it with a session identifier on your server.
Get the SDK
In your build.gradle
, add the following:
- Groovy
dependencies {
compile 'com.braintreepayments.api:data-collector:3.20.1'
}
Initializing
Drop-in
- Create a
DropInRequest
with a tokenization key or client token from your server.
- Java
DropInRequest dropInRequest = new DropInRequest()
.clientToken(clientToken);
- Specify
true
for the device data collection option.
- Java
dropInRequest.collectDeviceData(true);
- Start the Drop-in activity.
- Java
startActivityForResult(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
.
- Java
DataCollector.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.
Next Page: Server-side →