#jean-baptiste-r_code
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1234450728555253841
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello 👋
Please lemme a bit of time to send code
Well, at first, I was creating a person token from my backend application using this code:
const token = await stripe.tokens.create({
person: {
verification: {
document: {
front: identityDocumentRecto,
back: identityDocumentVerso,
},
},
},
})
It works well, but in a prod environnement, I cannot create this token from my backend application.
I tried many things in my frontend application, like :
const personToken = await stripeJs.createToken('person', {
person: {
verification: {
document: {
front: identityDocumentRecto, // La chaîne base64 de l'image recto
back: identityDocumentVerso // La chaîne base64 de l'image verso
}
}
}
})
Or
const personToken = await stripeJs.tokens.create({
person: {
verification: {
document: {
front: identityDocumentRecto, // La chaîne base64 de l'image recto
back: identityDocumentVerso // La chaîne base64 de l'image verso
}
}
}
})
In the first one, "person" doesn't exist as a tokenType and on the second one, "token" doesn't exist in stripeJs object.
My problem currently is that this token must be created in the front, and I can't find how to do the same thing on the front app side.
Why you can't create it from your backend ?
Have you had a chance to check Stripe Js ?
https://docs.stripe.com/js/tokens/create_token?type=person
That's what Stripe tells me 😅
"When not in test mode, person tokens may only be created using your application's publishable key
. You should only create person tokens in your client application (e.g., using Stripe.js or the Android
or iOS SDKs) and never from your application server. Creating person tokens from your application server
may cause you to fall out of compliance with certain regulations."
I tried but as I said, It says that 'person' is not a valid tokenType...
Is @stripe/stripe-js package not up-to-date ?
I tried but as I said, It says that 'person' is not a valid tokenType...
Can you share the ID (req_xxx) of the failing API request?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
Sorry I'm just trying something
Okay that's exactly what I though
The problem is from the @stripe/stripe-js package
I forgot that JS is... well it's JS... and types are given from another package that can have fails
And It looks like it's the case: The token is created, but I still have an error from the TS transpilator because of this package...
Sorry for bothering you, and have a good day 🙏
Glad to hear that you managed to solve the issue!