#kevin_code

1 messages ยท Page 1 of 1 (latest)

prime robinBOT
#

๐Ÿ‘‹ 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/1400113741592395913

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

rose hedge
#

Hello
Just to clarify, do you want to control the Payment Method Types via the dashboard OR do you want to explicitly specify the supported payment methods?

atomic mauve
#

Hello, I want to specify clearly the supported payment methods when showing the iframe

rose hedge
#

Assuming you want to manually specify the payment method types based on ^^^, there are two ways you can integrate.

1/ You create a PaymentIntent/SetupIntent and use it's client-secret to render elements

2/ The other option is to use defer Intent flow which allows you to collect payment method details without creating an Intent first.

atomic mauve
#

Oh okay thank you

Might be a dumb question but currently since my Elements is really high in my component tree, I should put this inside my screen instead of my root component?

rose hedge
#

Depends on your flow really.

#

Also depends on when do you want to intialize Stripe specific stuff in your app's lifecycle

atomic mauve
#

Ah yes because I want to initialize on start but I can know the list of payment method types only really late in the funnel when the user added some prestations in the cart ๐Ÿ˜…

rose hedge
#

Sounds good! ๐Ÿ™‚

atomic mauve
#

But if I add Elements on my screen, then Stripe will only initialize when the user arrives in the Recap screen where we show the cart and not when the app started, no? ๐Ÿค”

rose hedge
#

Not sure what you mean by that ๐Ÿ˜…
I don't know how your app is structured so I won't know what Recap screen is versus app's root screen

But to answer your question, Stripe.js will initialize wherever you're calling Stripe('PUBLISHABLE_KEY')

#

and loadStripe (if you're using React)

atomic mauve
#

Oh sorry so I'm using react-router-dom

So I have my root component which is app.tsx that uses Elements and where I currently use loadStripe
But you're saying that I should add paymentMethodTypes inside Elements so that in the PaymentElement show the correct payment method types but I can only know this after the app initialized and after a request to my back-end server ๐Ÿค”

prime robinBOT
queen harness
#

Hello my colleague has to step out soon but I can help. Catching up on this thread

#

Yep that would be the way to do it if you are manually specifying the payment method types. The alternative is automatic payment methods which is the dashboard setting mentioned earlier. It does sound like the dashboard settings could help simplify this a bit but I'm not sure of your constraints. Is there a specific reason you're preferring specifying the types yourself over using the automatic type selection?

atomic mauve
#

Oh okay, yeah the dashboard would be a good compromise but it's complicated because where on the product where I work, we have really hard product conditions like "if the user select X or Y, we should show/hide paypal and if he's on X/Y country but has selected this product we can show PayPal" etc ๐Ÿ˜…

So it's okay if I use loadStripe and initialize Stripe really late in my funnel? ๐Ÿค” If yes, I'll try this and come back if I have any issue (or maybe contact you because I also need to do the migration on React Native as well)

#

And one last question before leaving, currently I'm using these Stripe versions

    "@stripe/react-stripe-js": "~2.6.2",
    "@stripe/stripe-js": "~3.0.10",

How do I know which JS stripe version match with which react-stripe-js version?

queen harness
#

Ah gotcha, one thing I was hoping might help is that we do have settings for restricting payment method availability but I believe they only go as far as country and payment amount.

#

And yep, as long as you have the list of payment method types you want by the time you initialize the payment element component you should be good here

atomic mauve
#

Oh okay really thanks, you've been really helpful ๐Ÿ™
Just one last question before closing this thread, is the last question about Stripe JS and Stripe React JS package compatibility, do you have a page where you say which @stripe/stripe-js version is compatible with which @stripe/react-stripe-js version?

queen harness
#

Not sure if we do but I will ask my colleagues and get back with what we can find

atomic mauve
#

Okay thanks a lot ๐Ÿ™

queen harness
#

@atomic mauve we aren't seeing a page like that, I think you may have to go off of the package info. That said, a bit more context may help. Are you seeing errors or some other issue now when you try to install both at once?

atomic mauve
#

Oh okay, TBH I don't encounter any issue ATM, it's because I'm preparing the migration project and I'm afraid of some incompatibilities when I'll migrate from @stripe/react-stripe-js 2.6.2 to 3.x and @stripe/stripe-js to 3.0.10 to 7.x ๐Ÿ˜…

queen harness
#

Gotcha, we think that should work but would recommend testing it out first. Apologies for the delay, server got busy and I missed this thread for some time