#jean-baptiste-r_code

1 messages · Page 1 of 1 (latest)

cold spindleBOT
#

👋 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.

hidden garden
#

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.

desert wedgeBOT
jaunty rain
#

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 ?

hidden garden
# jaunty rain > My problem currently is that this token must be created in the front, and I ca...

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.
"

hidden garden
jaunty rain
hidden garden
#

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 🙏

jaunty rain
#

Glad to hear that you managed to solve the issue!