React Native quickstart

  1. 1

    Install

    bash
    git clone https://github.com/neetixai/liveliness-sdks
    npm i ./liveliness-sdks/packages/react-native

    Both packages must land together — the RN package links the web core as file:../web.

  2. 2

    Get a test key

    bash
    curl -X POST https://liveliness.neetix.in/v1/signup \
      -H 'Content-Type: application/json' \
      -d '{"email":"you@company.com"}'
    A key in a mobile bundle is extractable

    The JS bundle ships inside the app. Use a test key while building; in production mint short-lived keys from your own backend.

  3. 3

    Use the hook

    tsx
    import { useLiveliness } from "@neetix/liveliness-react-native";
    
    function KycScreen() {
      const nx = useLiveliness({ apiKey: NEETIX_API_KEY });
    
      const onCapture = async (selfieUri: string, idUri: string) => {
        const res = await nx.faceMatch(selfieUri, idUri, {
          clientRefId: "application-4821",
        });
        console.log(res.verdict, res.warnings);
      };
    
      return <Camera onPhoto={onCapture} busy={nx.loading} />;
    }

    The hook takes file URIs, not blobs — hand it whatever react-native-vision-camera or expo-camera gave you.

  4. 4

    Branch on the verdict

    tsx
    switch (res.verdict) {
      case "approved":
        return continueJourney();
      case "review":
        return queueForManualReview(res.warnings);
      case "declined":
        return stop(res.warnings);
    }

Hook surface

MemberDescription
clientThe full NeetixClient — every API method
loading / errorState for the wrapped calls
liveness(selfieUri)Passive liveliness (1 credit)
ageCheck(selfieUri)Selfie age estimation (1 credit)
faceMatch(selfieUri, cardUri, opts?)1:1 match + liveliness (2 credits)
authVerify(userId, selfieUri)Biometric re-authentication (1 credit)
documentId({ backUri?, frontUri? })DL/state-ID barcode parse (2 credits)

Anything not wrapped by the hook is on nx.client, which is the complete 46-operation web client.

Errors

Failures throw NeetixApiError with status and messageCode. The one to handle explicitly is HTTP 402 / insufficient_credits — the prepaid balance is gone and every call fails until a top-up.

Next