Stripe Identity enables online businesses to securely verify the identities of users around the world. Robust identity verification helps prevent fraud, simplify compliance, and increase trust. Stripe will use biometric technology (on images of you and your IDs) and other data sources. With the Stripe Identity React Native SDK, you can confidently verify the authenticity of ID documents from over 33 countries in your React Native application.
To get access to the Identity React Native SDK, visit the Identity Settings page and click Enable.
Get started with our 📚 integration guides and example project.
Updating to a newer version of the SDK? See our changelog.
Simplified security: We've made it simple for you to securely collect your user's personally identifiable information (PII) such as identity document images. Sensitive PII data is sent directly to Stripe Identity instead of passing through your server. For more information, see our integration security guide.
Automatic document capture: We automatically capture images of the front and back of government-issued photo ID to ensure a clear and readable image.
Prebuilt UI: We provide IdentityVerificationSheet
, a prebuilt UI that combines all the steps required to collect ID documents, selfies, and ID numbers into a single sheet that displays on top of your app.
Automated verification: Stripe Identity's automated verification technology looks for patterns to help determine if an ID document is real or fake and uses distinctive physiological characteristics of faces to match your users' selfies to photos on their ID document. Collected identity information is checked against a global set of databases to confirm that it exists. Learn more about the verification checks supported by Stripe Identity, accessing verification results, or our integration guide on handling verification outcomes.
The SDK uses TypeScript features available in Babel version 7.9.0
and above.
Alternatively use the plugin-transform-typescript
plugin in your project.
app/src/main/AndroidManifest.xml
.android:theme
applied to the application
is a child of one of the material themes(e.g Theme.MaterialComponents.DayNight
).
See more details about material theme here.
Note: Xcode 13 is no longer supported by Apple. Please upgrade to Xcode 14.1 or later.
pod install
in your ios
directory to ensure that you also install the required native dependencies.Info.plist
.NSCameraUsageDescription
key.This app uses the camera to take a picture of your identity documents.
).Get started with our 📚 integration guides and example project, or 📘 browse the SDK reference.
To initialize Stripe Identity SDK in your React Native app, use the useStripeIdentity
hook in the screen where you want to use it.
First you need a server-side endpoint to create the VerificationSession and ephemeral key secret, then you can send a POST request to create verification session:
const fetchVerificationSessionParams = async () => {
try {
const data = await fetch(
`${YOUR_SERVER_BASE_URL}/create-verification-session`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: {},
}
);
const json = await data.json();
return json;
} catch (e) {
return {};
}
};
Once you get options you can use useStripeIdentity
passing fetchOptions to it.
// HomeScreen.tsx
import { useStripeIdentity } from '@stripe/stripe-identity-react-native';
import logo from './assets/logo.png';
function HomeScreen() {
const fetchOptions = async () => {
const response = await fetchVerificationSessionParams();
return {
sessionId: response.id,
ephemeralKeySecret: response.ephemeral_key_secret,
brandLogo: Image.resolveAssetSource(logo),
};
};
const { status, present, loading } = useStripeIdentity(fetchOptions);
const handlePress = useCallback(() => {
present();
}, [present]);
const renderButton = useCallback(() => {
if (loading) {
return <ActivityIndicator />;
}
return <Button title="Verify Identity" onPress={handlePress} />;
}, [loading, handlePress]);
return (
<View>
<View>{renderButton()}</View>
<Text>Status: {status}</Text>
</View>
);
}
Or if you don't want to use useStripeIdentity
hook, you can also use this method to create your own implementation:
// HomeScreen.tsx
import { useState } from 'react';
import { presentIdentityVerificationSheet } from '@stripe/stripe-identity-react-native';
import logo from './assets/logo.png';
function HomeScreen() {
const [loading, setLoading] = useState(false);
const [status, setStatus] = useState<
IdentityVerificationSheetStatus | undefined
>();
const [error, setError] = useState<StripeError | undefined>();
const fetchOptions = async () => {
const response = await fetchVerificationSessionParams();
return {
sessionId: response.id,
ephemeralKeySecret: response.ephemeral_key_secret,
brandLogo: Image.resolveAssetSource(logo),
};
};
const present = async () => {
setLoading(true);
const options = await fetchOptions();
setLoading(false);
const { status, error } = await presentIdentityVerificationSheet(options);
setStatus(status);
setError(error);
};
const handlePress = useCallback(() => {
present();
}, [present]);
const renderButton = useCallback(() => {
if (loading) {
return <ActivityIndicator />;
}
return <Button title="Verify Identity" onPress={handlePress} />;
}, [loading, handlePress]);
return (
<View>
<View>{renderButton()}</View>
<Text>Status: {status}</Text>
</View>
);
}
There are two types available: StripeError and IdentityVerificationSheetStatus, you can import these in your TypeScript project directly from Stripe Identity React Native SDK:
import type {
StripeError,
IdentityVerificationSheetStatus,
} from '@stripe/stripe-identity-react-native';
cd example && yarn
cd ios && pod install && pod update StripeIdentity
yarn example ios
yarn example android
yarn ios
yarn android
See the contributor guidelines to learn how to contribute to the repository.