$ yarn add https://github.com/Idea-Maker/react-native-cybersource-device-fingerprint
NOTE: if you use RN 0.60+ you can autolinking, ignore step 1.
- Add pod 'RNCybersourceDeviceFingerprint', :path => '../node_modules/react-native-cybersource-device-fingerprint/ios' to your Podfile
- Run pod install from ios folder
- Run your project (
Cmd+R)<
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.estuardoeg.CybersourceDeviceFingerprint.RNCybersourceDeviceFingerprintPackage;to the imports at the top of the file - Add private static Application _application;
- Add in onCreate() _application = this;
- Add
new RNCybersourceDeviceFingerprintPackage(_application)to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':react-native-cybersource-device-fingerprint' project(':react-native-cybersource-device-fingerprint').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-cybersource-device-fingerprint/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:implementation project(':react-native-cybersource-device-fingerprint')
import RNCybersourceDeviceFingerprint from 'react-native-cybersource-device-fingerprint'
// INITIALIZE THE SDK
RNCybersourceDeviceFingerprint.configure(ORG_ID).then( () => {
console.log('THE CYBERSOURCE INIT IS OK')
})
.catch(err => {
console.log('THE CYBERSOURCE INIT ERROR IS ', err)
})
// getSession accepts custom attributes for session, check the Cybersource SDK documentation
RNCybersourceDeviceFingerprint.getSessionID([]).then( (obj) => {
console.log(`The session ID is ${obj.sessionId}`)
})
.catch(err => {
console.log('THE CYBERSOURCE ERROR IS ', err)
})