#iandk-event-checkout

1 messages · Page 1 of 1 (latest)

marble cloak
#

Hello 👋
AFAIK don't think so.

#

When you say leave, do you mean by clicking the back/cancel button or just close the tab?

tame atlas
#

exactly

marble cloak
#

sorry, which one out of the two?

tame atlas
#

I'd like to catch both, before the user visits the checkout page, he can configure some options which I'm saving as a "checkout attempt".
And I'd like to catch if he clicks on pay but closes the tab or just goes back again so I can delete the checkout attempt

marble cloak
#

I don't think there's a way to track if they just decide to close the tab.
You could listen for each checkout.session.created webhook event and check the customer property (if you're passing a customer ID when creating a session) to track session creation and then you can check each checkout.session.completed event to check if that customer ever completed their checkout session.
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-customer

If they click back/cancel, they're redirected to the cancel_url page on which you can write some logic to handle your use-case.
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-cancel_url

tame atlas
#

Thank you!
One more question, there seems to be an option to set the expires_at option.

Does that only apply for unfinished checkout sessions or in general?

marble cloak
#

It's property that you can set when creating a session.
if the session isn't completed by the expires_at timestamp, it would expire.

#

completed sessions won't be affected as they're already complete.

tame atlas
#

perfect, then I'll set this to 30min and delete the checkout attempt via the webhook

#

thanks!