Client-Side Implementation

Collecting device dataAnchorIcon

PayPalDataCollector enables you to collect data about a customer's device and correlate it with a session identifier on your server.

Get the SDKAnchorIcon

CocoaPodsAnchorIcon

Include Braintree/PayPalDataCollector in your Podfile:

  1. Ruby
# Podfile
pod 'Braintree/PayPalDataCollector'

Swift Package ManagerAnchorIcon

Include the PayPalDataCollector framework.

CarthageAnchorIcon

Include the PayPalDataCollector and PPRiskMagnes frameworks.

ImplementationAnchorIcon

PayPalDataCollector collects data about a customer's device and returns a device_data string that contains one or more identifiers that correlate with the collected data. Collecting and passing this data with transactions helps reduce decline rates.

  1. Before making a request to your server, get the device data string by calling collectPayPalDeviceData.
  1. Swift
let deviceData = PPDataCollector.collectPayPalDeviceData()
print("Send this device data to your server: (deviceData)")

To collect device data as expected in sandbox you must use iOS v5.9.0+. Call collectDeviceData(isSandbox: Bool) to collect the appropriate device data.

  1. Swift
// for production pass 'isSandbox' as 'false'
self.dataCollector.collectDeviceData(isSandbox: true) { deviceData in
    // Send deviceData to your server
}
  1. Send the device data string to your server along with transaction or verification data (e.g. Transaction.sale calls). Your server will include this device_data parameter when submitting the request to the Braintree gateway.

PayPalAnchorIcon

If you're accepting PayPal using the Vault flow, collecting device data via PayPalDataCollector is required.