#meterrel-embedded_checkout-errors

1 messages ยท Page 1 of 1 (latest)

flat stoneBOT
violet harness
#

Hello! That's... a good question! Let me see...

half sleet
#

Thanks! And again, I can probably avoid giving checkout a bad secret, but I'm concerned there might be other similar conditions.

violet harness
#

I think the best approach would be to check the status and expires_at values of the Checkout Session on your server before you provide the client secret to the frontend. If either of those has a problematic value (like a status of expired, or an expires_at in the near future) you can create a new Checkout Session instead.

#

That said, this does seem like a gap in Stripe.js. There should be some kind of callback or something. I'll flag this internally and see what we can do to improve the situation.

flat stoneBOT
#

meterrel-embedded_checkout-errors

whole rose
#

Hi @half sleet I'm taking over this thread

half sleet
#

Ok, I can probably manage that.
Just for more context for the checkout team, in my case, this is caused by the user hitting the back button, where the client secret remains in the app state. So while it's definitely possible to handle this case, the naive implementation by a dev is somewhat likely to have this problem.

#

๐Ÿ‘‹

violet harness
#

That's great context, thanks! I'll relay that to the team.

#

Although I would recommend not keeping the client secret in any state.

#

You should always fetch it fresh from the server every time you need it.

half sleet
#

Your React example definitely puts it in state ๐Ÿ˜‰

#

But point taken

violet harness
#

Welp. ๐Ÿ˜…

#

Will try to get that addressed!