QoreID React Native SDK
QoreID React Native SDK
Note
With this release (v1.0.3), customers can perform all Collection services like VeriFind (digital address verification), Passport, Driver's License and other QoreID services on Android using the SDK. Collection on iOS will be available in a future release.
Installation
npm install --save @qore-id/react-native-qoreid-sdk
yarn add @qore-id/react-native-qoreid-sdk
Android
Add the following to your app/build.gradle
//before your dependencies
repositories {
mavenCentral()
google()
maven {
url "https://repo.qoreid.com/repository/maven-releases/"
}
}
Add this snippet of code to your ~/java/com.<app name>/MainActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
QoreidSdkModule.initialize(this);
}
Remember to import library in MainActivity
import com.qoreidsdk.QoreidSdkModule;
iOS
From your root directory
cd ios && pod install
Usage
//verify.tsx
import React from 'react'
import { QoreIdButton } from '@qore-id/react-native-qoreid-sdk';
function App() {
const customButton = ({ onPress }) => <Button onPress={onPress} title="QoreId Button" />
const onError = (data) => {
console.error(data);
Alert.alert('Error', data);
};
const onSumitted = (data) => {
console.debug(data);
Alert.alert('Sumitted', data);
};
const onClosed = (data) => {
console.debug(data);
Alert.alert('Closed', data);
};
return (
<View>
{/* Other components */}
<QoreIdButton
title="Verify"
flowId=""
clientId="" {/* Required */}
productCode="" {/* Required */}
customerReference="" {/* Required */}
applicantData={{
firstName:"",
middleName:"",
lastName:"",
gender:"",
phoneNumber:"",
email:"",
}}
identityData={{ idType: "", idNumber:"" }}
addressData={{
address: "",
city:"",
lga:"",
}}
ocrAcceptedDocuments="DRIVERS_LICENSE_NGA,VOTERS_CARD_NGA,NIN_SLIP_NGA,PASSPORT_NGA"
onQoreIDSdkSubmitted={onSumitted}
onQoreIDSdkError={onError}
onQoreIDSdkClosed={onClosed}
render={customButton}
/>
</View>
)
}
Utilities
QoreId SDK exposes utilities that you can easily use
import React, {useRef} from 'react'
import { QoreIdButton, utils } from '@qore-id/react-native-qoreid-sdk';
function App() {
// Array of string
//For more information check -> https://docs.qoreid.com/docs/product-codes
const productIds = utils.productCodes;
//An array of accepted documents in a specific country
//For more information check -> https://docs.qoreid.com/docs/ocr-accepted-documents#accepted-documents-for-ocr-verifications
const ocrLists = utils.acceptedDocuments["Nigeria"]
...
}
Updated 1 day ago