diff --git a/lib/recurly/venmo/strategy/braintree.js b/lib/recurly/venmo/strategy/braintree.js index 674f1ddff..f95fb5b67 100644 --- a/lib/recurly/venmo/strategy/braintree.js +++ b/lib/recurly/venmo/strategy/braintree.js @@ -65,11 +65,16 @@ export class BraintreeStrategy extends VenmoStrategy { braintree.client.create({ authorization }, (error, client) => { if (error) return this.fail('venmo-braintree-api-error', { cause: error }); debug('Braintree client created'); - braintree.venmo.create({ client, allowDesktop: true }, (error, venmo) => { + braintree.dataCollector.create({ client, paypal: true }, (error, collector) => { if (error) return this.fail('venmo-braintree-api-error', { cause: error }); - debug('Venmo client created'); - this.venmo = venmo; - this.emit('ready'); + debug('Device data collector created'); + this.deviceFingerprint = collector.deviceData; + braintree.venmo.create({ client, allowDesktop: true }, (error, venmo) => { + if (error) return this.fail('venmo-braintree-api-error', { cause: error }); + debug('Venmo client created'); + this.venmo = venmo; + this.emit('ready'); + }); }); }); } @@ -82,6 +87,11 @@ export class BraintreeStrategy extends VenmoStrategy { handleVenmoSuccess (payload) { const nameData = normalize(this.form, ['first_name', 'last_name']); + + if (this.deviceFingerprint) { + payload.deviceFingerprint = this.deviceFingerprint; + } + this.recurly.request.post({ route: '/venmo/token', data: { type: 'braintree', payload: { ...payload, values: nameData.values } },