#bananarino - PI client secret local storage

1 messages · Page 1 of 1 (latest)

potent fableBOT
crude mango
#

Hey there, you can do this if you need to, but I'm not sure I understand what the advantage is to you. Is this a case where the change happens in some other context that you can't keep in a variable in memory and want to be able to access quicker later?

chrome current
#

hey! Well my cart works off of local storage, so when the user refreshes the contents are still waiting there. Because of this I was thinking that the payment intent for the items the customer is ordering should be maintained. What do you think? Is it better practice to just fetch the clientsecret like other objects?

crude mango
#

bananarino - PI client secret local storage

crude mango
#

Ah i see, well, that's really an implementation detail up to you

#

You can store this in local storage if you want to to set up elements to pay without fetching from your server, but you also have the option of rendering the payment element without a client secret, until the customer clicks to confirm/pay

#

In either case you may need to sort out a way to make sure you refresh the amount of the payment intent, in case you'd changed it between loads for some reason