#jasperste-checkoutsession-metadata

1 messages · Page 1 of 1 (latest)

copper drumBOT
grim carbon
#

jasperste-checkoutsession-metadata

#

@sick mica that's mostly impossible. You can't "update" a Checkout Session after creation. So you'll have to mostly track this in your own database/on your end really

sick mica
#

(If there is a way). We also considered creating different checkout sessions for each way, however that would give us the risk of orders being paid twice. Since you can't create a checkout session for one paymentIntent

grim carbon
#

you can always cancel the first Session before creating the new one for example

#

But there's no way to re-use the Session and update its settings

sick mica
#

Thanks. That's what we were afraid of indeed.

The documentation around checkout session is a bit confusing, stating: We recommend creating a new Session each time your customer attempts to pay. . An attempt to pay can mean multiple things, it could be trying again in a different browser/device and the same order or it could mean for a different order in general.
Could you specify that? Since we do the latter, but the first might be closer to something we want to achieve (if done correctly)

grim carbon
#

I'm not sure I really grasp what you are trying to answer. I think it depends a lot on the situation. Checkout Sessions are ephemeral and automatically expire after 24 hours so it's meant to indicate that if the customer leaves your app/website and comes back hours later it's best to just create a brand new Session for their payment attempt

sick mica
#

Isn't there a risk of double payments if you do not cancel the first session? Or are we thinking to defensive there? Could be that this is not really an issue normally

grim carbon
#

yes the assumption is that you would cancel the first session in that case

sick mica
#

Thanks

#

We mainly trying to figure out how to handle for example customers who start a payment via desktop and customers starting a payment via a mobile phone. If we should create a seperate session or reuse the same one.
And if we use the same one determine on what device the payment was finished when receiving the paid event.

grim carbon
#

whether to reuse the same one or not is up to you. And there is no way today to track where they came from other than doing it in your own systems if you re-use the same Session

sick mica
#

How is it not up to us if I may ask? We have full control over the created checkout sessions

grim carbon
#

I said it is up to you, I think you misread my sentence

#

hether to reuse the same session or not reuse the same session, is up to you

sick mica
#

Haha, sorry about that!

grim carbon
#

all good, that was weirdly worded

#

The problem you have is that if you have a Session URL valid for 24 hours and then a customer, from any device, can click a button and get to that URL to pay, then you can't track in Stripe which device they come from as there's no API to "update" the Session to indicate that

#

so the only way would be to either track this in your own database, or create different Session(s) (and cancel the previous one to avoid double payments)

sick mica
#

Indeed, we were hoping you had some way we couldn't think of. We will see what fits our use case best

#

Thanks for helping out, still insightful.

#

Have a good evening!

#

(or day, depending on your location)