Skip to main content

Usage

Import startAmaniSDKWithToken from our package as shown below.

import { startAmaniSDKWithToken } from "react-native-amani-ui";

startAmaniSDKWithToken method takes two parameters, first one is the data;

export interface StartAmaniSDKWithTokenParams {
server: string;
id: string;
token: string;
geoLocation?: boolean;
lang?: string;
sharedSecret?: string;
idVideoRecord?: boolean; // Enable video recording on idCapture, default is false
idHologram?: boolean; // Enable hologram detection. New Turkish ID only.
poseEstimationVideoRecord?: boolean; // Enable video recording on pose estimation
apiVersion?: "v1" | "v2";
// nvi data
birthDate?: string;
expireDate?: string;
documentNo?: string;
// additional customer information
email?: string;
phone?: string;
name?: string;
}

and the second part is callback that returning from our native sdk.

export interface SDKActivityResult extends Record<string, any> {
isVerificationCompleted?: boolean;
isTokenExpired?: boolean;
apiExceptionCode?: number;
}

It's extended with record for the future updates.

Example​

In the example useCallback used for reallocating the function for every render. It memoizes the function so only changes when idNumber and customerToken params changes.

import { useCallback, useState } from "react";
import { startAmaniSDKWithToken } from "react-native-amani-ui";

const onStartButtonPressed = useCallback(() => {
startAmaniSDKWithToken(
{
server: "https://server.example",
id: idNumber,
token: customerToken,
lang: "tr",
apiVersion: "v1",
},
(data) => {
if (data.apiExceptionCode) {
// Due to differences in the native SDKs this field always null for iOS
}
if (data.isTokenExpired) {
// CUSTOMER_TOKEN is expired
}
if (data.isVerificationCompleted) {
// User passed all KYC steps, if user used a back button or cancels the progess it will be false.
}
}
);
}, [idNumber, customerToken]);

Later in that code...

<Pressable onPress={onStartButtonPressed} style={styles.startButton}>
<Text>Start KYC</Text>
</Pressable>

Acquire profile token​

If you dont know hot to get profile token you need to read acquire profile token documentation.