-
Notifications
You must be signed in to change notification settings - Fork 18
Description
I'm struggling to get the select document type screen to show. You can see from the below video that the verification session is correctly set to type of document and shows both driving license and passport as valid options, but when the verification sheet runs, it doesn't ask which I want to choose and it seems to assume a default of 'ID Card', it will let me scan the front of the passport, but then it asks me to scan the back, and the terminology used seems to be that of an ID Card.
I appreciate there may be a misconfigured setting somewhere, but I've scoured the docs for both this SDK and the Stripe PHP library which is being used on the server side, and I can't see what I'm missing. Is this a bug?
Recorded on an iPhone 15 Pro Max:
RPReplay_Final1724864248.MP4
Here is my React Native, it's mostly just the boilerplate:
import { Text } from "react-native";
import { useStripeIdentity } from "@stripe/stripe-identity-react-native";
import createVerificationSession from "@/requests/create-verification-session/createVerificationSession";
import { useAuth } from "@/context/AuthProvider";
import useFetch from "@/hooks/useFetch";
import { createVerificationSessionResponseSchema } from "@/requests/create-verification-session/create-verification-session-response-schema";
import { Image } from "react-native";
import { useCallback } from "react";
import Button from "@/components/Button";
const logo = require("../../../../assets/images/space365-icon.png");
export default function VerificationScreen() {
const { session } = useAuth();
const { fetch } = useFetch({
fetchFn: createVerificationSession,
token: session.token,
responseSchema: createVerificationSessionResponseSchema,
});
const fetchOptions = async () => {
const response = await fetch();
if (!response || response.isError || !response.data)
throw new Error("Error creating session");
const {
verification_session_id: sessionId,
ephemeral_key_secret: ephemeralKeySecret,
} = response.data;
return {
sessionId,
ephemeralKeySecret,
brandLogo: Image.resolveAssetSource(logo),
};
};
const { status, present, loading } = useStripeIdentity(fetchOptions);
const handlePress = useCallback(() => {
present();
}, [present]);
return (
<Page themed>
<Text>Verification Screen Works!</Text>
<Button label={"Verify With Stripe"} themed onPress={handlePress} />
</Page>
);
}
And here is the PHP side:
namespace App\Services;
use Stripe\StripeClient;
class StripeIdentityService
{
public function createVerificationSession(): array | null {
$stripe = new StripeClient(getenv('STRIPE_SECRET'));
try {
$verificationSession = $stripe->identity->verificationSessions->create([
'type' => 'document',
'options' => [
'document' => [
'allowed_types' => [
'driving_license',
'passport'
]
]
]
]);
$ephemeralKey = $stripe->ephemeralKeys->create([
'verification_session' => $verificationSession->id,
], [
'stripe_version' => '2024-06-20'
]);
return [
'verification_session_id' => $verificationSession->id,
'ephemeral_key_secret' => $ephemeralKey->secret,
];
} catch(\Exception $exception) {
dump($exception);
return null;
}
}
}
Any help would be greatly appreciated.