#hexiaolong

1 messages ยท Page 1 of 1 (latest)

opaque anchorBOT
whole garnet
#

Sure, could you elaborate?

serene torrent
# whole garnet Sure, could you elaborate?

thanks, The current problem with our business is that Elements are reloaded every time we make a payment, because clientSecret changes every time, which results in a long loading time and poor experience. Today, when I tried to change clientSecret without recreating Elements, I found that the first clientSecret was still used in the real payment reply when clientSecret was changed. How to deal with the change? I did see the instructions that clientSecret cannot be changed in the documentation,https://stripe.com/docs/stripe-js/react#elements-provider

Learn about React components for Stripe.js and Stripe Elements.

#

It takes more than 1s for Elements to be loaded for the first time, and about 800ms for elements to be loaded again. How can I solve the problem of slow loading

serene torrent
whole garnet
#

The best approach would be trying to not recreating client Secret that many time. Isn't it creating a lot of unconfirmed PaymentIntent?

serene torrent
whole garnet
#

No, not exactly. Please take a look at the Doc link provided, choose React on all frontend code and you will see

#

It completely doesn't take client_secret at all.

serene torrent
#

i see this in the Doc link

whole garnet
#

Ah yes, sorry! Yes it is talking both elements and client secret

serene torrent
prime relic
#

Hi! I'm taking over from my colleague. Please, let me know if you have any other questions.

serene torrent
prime relic
#

Are you creating a new PI on every change?

serene torrent
prime relic
#

My question was whether you create a new PaymentIntent or update an existing one

serene torrent
prime relic
serene torrent
prime relic
#

I believe it should update automatically, but it't best to check.

serene torrent
#

sorry,I don't see what you mean. I don't think my problem has been solved

prime relic
#

So, if you change the selected items, you can send a request to your backend to update a PaymentIntent with the new total amount.
Then, your Payment Element will update automatically, you don't need to change the client secret.

#

You don't need to create a new PI when you change your shopping cart.

chilly helm
#

๐Ÿ‘‹ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

serene torrent
chilly helm
serene torrent
chilly helm
#

this method suits your use-case better, please consider playing around a bit with the guide, build a small integration and see how it works

serene torrent
chilly helm
#

there's no expiry for a valid PaymentIntent

serene torrent
#

okay, thank u ,i will try it

chilly helm
#

let me know if you need any more help

serene torrent
chilly helm
#

I'm not sure I follow the question

serene torrent
#

can you speak Chinese?

chilly helm
#

no sorry, if you prefer to communicate in Chinese you can reach out to https://support.stripe.com/?contact=true they will be more than happy to assist you in Chinese

serene torrent
chilly helm
#

I'm not sure I fully understand, please leverage https://support.stripe.com/contact/email to send your question in your native tongue, and someone from our team will respond to you