Search code examples
javascriptbraintreebraintree-javascript

BrainTree JavaScript Drop In API and Kount Device Data not being set


I'm trying to add Kount Fraud protection to an existing BrainTree Drop In installation and according to the docs I should just be able to provide a data collector to start the flow:

braintree.dropin.create({
        authorization: clientToken,
        container: '#dropin-container',
        // add the data collector for Kount
        dataCollector: {
            kount: true
        },
        card: {
            amount: amount,
            currency: "USD"
        }      
    },
    function(createErr, instance) {
        button.on("click", function() {
            instance.requestPaymentMethod(function (err, payload) {
                   // payload.deviceData is 'undefined'
               });
            });
    });

The problem is that `payload.deviceData is always undefined.

The docs are not really clear what dependencies are required for the drop in component. It shows the scripts for the client component but not the drop in.

I'm using:

<!--  <script src="https://js.braintreegateway.com/web/3.57.0/js/client.min.js"></script> -->
<script src="https://js.braintreegateway.com/web/dropin/1.22.0/js/dropin.min.js"></script>
<script src="https://js.braintreegateway.com/web/3.57.0/js/data-collector.min.js"></script>

Is 1.22 the correct version to be using for the drop in? Is that the last version? I can't find an official way to check which versions should be used other than what's in the drop in docs which use 1.22?

Also tried adding the client.min.js in (in addition to drop because without dropin the code above won't find the braintree.dropin.create.

Any idea what's missing here?


Solution

  • Full disclosure, I work at Braintree. If you have any further questions, I recommend contacting Support.

    You're definitely on the latest version (as of the post). I like to check the CHANGELOG.md when needing to double-check the version.

    In order for device data to be collected, you need to have Advanced Fraud Tools enabled in your gateway. I'd start with checking this, as device data will be undefined when this is turned off. To enable Advanced Fraud Tools, follow these steps:

    1. Log into the Control Panel (or sandbox Control Panel
    2. Click on the gear icon in the top right corner
    3. Click Fraud Management from the drop-down menu
    4. Next to Advanced Fraud Tools, click the toggle to turn it on

    Additionally, the data collector should be included in the Drop-in UI script and you should not need to include the data collector script tag. The Drop-in should be ready to go without that.