#Abhi ->
1 messages · Page 1 of 1 (latest)
can you share the code you're using to create the Session and redirect the client to it?
// For creating session
const verificationSession = await stripe.identity.verificationSessions.create({
type: 'document',
metadata: {
client_id: client_id
},
options: {
document: {
allowed_types:['driving_license','passport'],
require_id_number: true,
}
}
})
//for redirecting
this.props.history.push(verificationSession.url)
maybe try doing window.location.href=url instead.
actually url is opens successfully in a new tab but problem is with the url or session
and also i will try with a client_secrect with a model solution, i will give the code for that
const { error } = await this.props.stripe.verifyIdentity(response.client_secret);
and in end error will be this
{type: 'authentication_error', code: 'session_does_not_exist'}
in model message will be same as web
what guide are you using exactly?
unfortunately I don't much much about this Identity API, we don't get many questions about it
i'll take refrence from here
https://www.youtube.com/watch?v=mUgnRq9jC7s&list=PLy1nL-pvL2M6YzaXPC_1Lu_388ZonoAeB
i will did all of those thing and i will get a session details as well but when i goes to use those then it's show session is not created, and yup i also understand your concern but please try to solve this.
Stripe Identity lets you programmatically confirm the identity of global users so you can prevent attacks from fraudsters while minimizing friction for legitimate customers. In this edition, you'll learn how to implement an Identity integration using Stripe.js to open the modal based verification flow.
Table of contents
00:05 Introduction...
can you share the complete code that you've built, both backend and frontend?
sure i will
backend
//Below is API Function that return client_secret
getIdentitySession: async (client_id) => {
try{
const verificationSession = await stripe.identity.verificationSessions.create({
type: 'document',
metadata: {
client_id: client_id
},
options: {
document: {
allowed_types:['driving_license','passport'],
require_id_number: true,
}
}
})
return verificationSession
} catch (e) {
console.log("ERR>>SESSION CREATION FAILED FOR IDENTITY",e);
let message =
e.raw && e.raw.message
? e.raw.message
: 'Session Creation failed';
return {
success: false,
message: message
};
}
}
Frontend:
import { loadStripe } from '@stripe/stripe-js';
const stripePromise = loadStripe(configUrl.stripeKey);
const verifyKYC: AsyncAction<AddCreditStore, any> = (plan_id) => {
return async (dispatch: Dispatch) => {
// dispatch<FormLoadingAction>(formLoader(true));
const [, res] = await to<any>(
httpService.post(configUrl.apiServer + '/credit/create-session', {})
);
// dispatch<FormLoadingAction>(formLoader(false));
return res
};
};
const APP = () =>{
return (
<Elements stripe={stripePromise}>
<ElementsConsumer>
{({ stripe, elements }) => (
<VerifyButton verifyKYC={this.props.verifyKYC} stripe={stripe} />
)}
</ElementsConsumer>
</Elements>
)
}
and where does getIdentitySession get called from?
wait i will edit previous mess
add whole code
VerifyButton.js
onVerifyKYC = async () => {
if(!this.props.stripe || !this.props.verifyKYC){
return;
}
const response = await this.props.verifyKYC();
if(!response.client_secret){
this.props.showFailureToast('Failed to create a session.');
return;
}
const { error } = await this.props.stripe.verifyIdentity(response.client_secret);
console.log('err',error);
if (error) {
console.log('[error]', error);
} else {
console.log('Verification submitted!');
}
}
<Button
id="verify-btn"
variant={
this.props.loading ? 'secondary' : 'success'
}
style={{
float: this.props.isQuickCampignSidebar
? 'right'
: 'inherit'
}}
className={btn ${ this.props.loading ? ' ' : 'save-btn' }}
btnName={Verify KYC}
onClick={() => this.onVerifyKYC()}
/>
that's all i write
add a console.log to log response.client_secret and see what value that is
also what's the publishable key pk_test_xxx you're using in the frontend? (because you can get this error if you're using the wrong Stripe account on the frontend)
publishable key: pk_live_zONWGocQekjexZBX97HjnNNm00SEi5PzET
hmm, not sure why you're doing this in livemode if you're just developing it?
sandbox acc not working
maybe the issue is that you're using your test mode secret key in the backend and the livemode key in the frontend
what was the vs_xxxx ID? paste it here.
nope
that's was also a same account
if the problem is that then when i load url there is no publishable key works there stll getting same behaviour there
well let's do one thing at a time.
right now the code you're sharing with me is about using the modal, so let's get that working first.
what was the vs_xxxx ID? paste it here.
i will setup only model way but in backend i will log whole session so i get url and i 'll ttry that for confirmation only
vs_1NRCqCLeNoEOcpi8isGhmrcA_secret_live_YWNjdF8xQzBhQjlMZU5vRU9jcGk4LF9PRGU4aW9lQ1RYN0VwSlF3UVk3Tk95U1ExMURmWlRR01005awNOrb3
is there is setting from account that i need to activate or setup for this,
that vs_xxx was created on a different Stripe account than the one that the livemode key is for, which is why you get the "session_does_not_exist" error
probably it's your "sandbox" account you mentioned, and you're still using the backend secret live key for your sandbox account, but the frontend public live key for your other Stripe account.
Really , i know that's weird but thanks for your help buddy.