Official Jumio Mobile SDK plugin for React Native
With every release, we only ensure compatibility with the latest version of React Native.
Create React Native project and add the Jumio Mobile SDK module to it.
react-native init MyProject
cd MyProject
npm install --save https://github.com/Jumio/mobile-react.git#v2.8.0
react-native link react-native-jumio-mobilesdk
- Add the Jumio Mobile SDK to your React Native iOS project. Manual integration or dependency management via cocoapods possible, please see the official documentation of the Jumio Mobile SDK for iOS
- Now open the workspace and copy the iOS module (node_modules/react-native-jumio-mobilesdk/ios/JumioMobileSDK) into the project.
- Add the "NSCameraUsageDescription"-key to your Info.plist file.
- Open your AndroidManifest.xml file and change allowBackup to false.
<application
...
android:allowBackup="false"
...
</application>
- Make sure your compileSdkVersion and buildToolsVersion are high enough.
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
...
}
- Enable MultiDex
android {
...
defaultConfig {
...
multiDexEnabled true
}
}
- Add the Jumio Mobile SDK repository
repositories {
maven { url 'http://mobile-sdk.jumio.com' }
}
- Call JumioPackage's onRequestPermissionsResult method in MainActivity
import com.jumio.react.JumioPackage;
public class MainActivity extends ReactActivity {
......
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
JumioPackage.onRequestPermissionsResult(getReactInstanceManager().getCurrentReactContext(), requestCode, permissions, grantResults);
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
......
}
- Add "NativeModules" to the import of 'react-native'.
import {
...
NativeModules
} from 'react-native';
- Create a variable of your iOS module:
const { JumioMobileSDK } = NativeModules;
- Initialize the SDK with the following call.
JumioMobileSDK.initNetverify(<API_TOKEN>, <API_SECRET>, <DATACENTER>, {configuration});
JumioMobileSDK.initDocumentVerification(<API_TOKEN>, <API_SECRET>, <DATACENTER>, {configuration});
JumioMobileSDK.initBAM(<API_TOKEN>, <API_SECRET>, <DATACENTER>, {configuration});
Datacenter can either be us or eu.
To get information about the different configuration options, please see the usage chapter of our Cordova plugin.
In your Jumio merchant backend on the "Settings" page under "API credentials" you can find your Offline token.
iOS
Pass your offline token to your configuration object of BAM Checkout.
offlineToken: "TOKEN",
Use enableEMRTD
to read the NFC chip of an eMRTD.
JumioMobileSDK.enableEMRTD();
If BAM Credit Card + ID is used, init BAM and Netverify
- Afterwards start the SDK with the following command.
JumioMobileSDK.startNetverify();
JumioMobileSDK.startDocumentVerification();
JumioMobileSDK.startBAM();
- Now you can listen to events to retrieve the scanned data:
- EventDocumentData for Netverify results.
- EventCardInformation for BAM results.
- EventDocumentVerification for Document Verification results.
- EventError for every error.
- First add NativeEventEmitter for iOS and DeviceEventEmitter for android to the import from 'react-native' and listen to the events.
iOS
import {
...
NativeEventEmitter
} from 'react-native';
The event receives a json object with all the data.
const emitter = new NativeEventEmitter(JumioMobileSDK);
emitter.addListener(
'EventDocumentData|EventCardInformation|EventDocumentVerification|EventError',
(reminder) => alert(JSON.stringify(reminder))
);
Android
import {
...
DeviceEventEmitter
} from 'react-native';
The event receives a json string with all the data.
DeviceEventEmitter.addListener('EventDocumentData|EventCardInformation|EventDocumentVerification|EventError', function(e: Event) {
alert(e)
});
The Netverify SDK can be customized to the respective needs by following this customization chapter.
The SDK can be customized to the respective needs by using the following initializers instead.
JumioMobileSDK.initNetverifyWithCustomization(<API_TOKEN>, <API_SECRET>, <DATACENTER>, {configuration}, {customization});
JumioMobileSDK.initDocumentVerificationWithCustomization(<API_TOKEN>, <API_SECRET>, <DATACENTER>, {configuration}, {customization});
JumioMobileSDK.initBAMWithCustomization(<API_TOKEN>, <API_SECRET>, <DATACENTER>, {configuration}, {customization});
You can find all the different customization options by following the customization chapter of our Cordova plugin.
To get information about callbacks, please see the callback chapter of our Cordova plugin.
© Jumio Corp. 268 Lambert Avenue, Palo Alto, CA 94306