Skip to content

waveaccounting/jumio-mobile-react

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plugin for React Native

Official Jumio Mobile SDK plugin for React Native

Compatibility

With every release, we only ensure compatibility with the latest version of React Native.

Setup

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

Integration

iOS

  1. 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
  2. Now open the workspace and copy the iOS module (node_modules/react-native-jumio-mobilesdk/ios/JumioMobileSDK) into the project.
  3. Add the "NSCameraUsageDescription"-key to your Info.plist file.

Android

  1. Open your AndroidManifest.xml file and change allowBackup to false.
<application
    ...
    android:allowBackup="false"
    ...
</application>
  1. Make sure your compileSdkVersion and buildToolsVersion are high enough.
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    ...
}
  1. Enable MultiDex
android {
    ...
    defaultConfig {
        ...
        multiDexEnabled true
    }
}
  1. Add the Jumio Mobile SDK repository
repositories {  
    maven { url 'http://mobile-sdk.jumio.com' }
}
  1. 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);
  }

  ......

}

Usage

  1. Add "NativeModules" to the import of 'react-native'.
import {
    ...
    NativeModules
} from 'react-native';
  1. Create a variable of your iOS module:
const { JumioMobileSDK } = NativeModules;
  1. 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.

Offline scanning

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",

Android Netverify eMRTD

Use enableEMRTD to read the NFC chip of an eMRTD.

JumioMobileSDK.enableEMRTD();

If BAM Credit Card + ID is used, init BAM and Netverify

  1. Afterwards start the SDK with the following command.
JumioMobileSDK.startNetverify();
JumioMobileSDK.startDocumentVerification();
JumioMobileSDK.startBAM();
  1. 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.
  1. 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)
});

Customization

Android

The Netverify SDK can be customized to the respective needs by following this customization chapter.

iOS

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.

Callbacks

To get information about callbacks, please see the callback chapter of our Cordova plugin.

Copyright

© Jumio Corp. 268 Lambert Avenue, Palo Alto, CA 94306

Packages

No packages published

Languages

  • Objective-C 52.1%
  • Java 35.1%
  • JavaScript 9.2%
  • Python 2.1%
  • Ruby 1.5%