#Hemant-checkout-events

1 messages ยท Page 1 of 1 (latest)

daring sail
#

Hi there ๐Ÿ‘‹ ah, looks like you're creating Checkout Sessions in subscription mode, so they won't have payment intents attached to them. You'll likely want to listen to checkout.session.completed events, and then retrieve the subscription that was created from there.

elder moss
#

I have requirement to create subscription or direct payment. So can i assume i will get subscription object in case of subscription and Payment object in case of a Payment.

So i should save subscription_id and payment_intent_id , in case of subscription and payment respectively, in my database to check for the completion. Then listening to "checkout.session.completed" should mark them completed.

daring sail
#

You can check for the ID of the Payment Intent immediately after creating the Checkout Session (in payment mode).

#

But in subscription mode the Subscription is not created until the customer completes checkout, so those you won't be able to retrieve until the checkout session has been completed.

elder moss
#

But before forwarding to Stripe payment page , in case of subscription, i should have something to match , if the subscription is created(completed) or not. Isn't it ?

#

Shall i track it with session_id , i can see that. something like "cs_test_a1oJirohsBCZjjOY062LciuoFDmdsGv0iW7gMqFEpKOtRHNXgprMpK74li"

daring sail
#

Yeah there are a couple options. You can track the ID of the checkout session as you mentioned, or you could provide your own tracking identifies via the metadata on the checkout session:
https://stripe.com/docs/api/checkout/sessions/object?lang=python#checkout_session_object-metadata

elder moss
#

Cool , thanks for the help @daring sail . Let me try that with session id only and update you. I think this session_id will work for both scenarios.

daring sail
#

Awesome, happy to help!

daring sail
#

I need to step away soon, so I'm archiving this thread but if there is anything else that my teammates can assist with then please them know in #dev-help ๐Ÿ‘‹

pearl marsh
#

hey @elder moss I've re-opened this

elder moss
#

Thanks @pearl marsh

#

Can you please assist me with this quick question. When a checkout session is created and a user is forwarded to Stripe payment page. If user does not complete the payment and close the browser. Will i get an event back in webhooks ? If yes (as failed or incomplete), how long will stripe wait to send me that event ?

pearl marsh
#

from main:

Hemant โ€” Today at 11:15 AM
#946418159890600006 message

Hi team, in continuation to the above thread, i have a quick question. When a checkout session is created and a user is forwarded to Stripe payment page. If user does not complete the payment and close the browser. Will i get an event back in webhooks ? If yes (as failed or incomplete), how long will stripe wait to send me that event ?

#

By default, no, you wouldn't get any event in that case

elder moss
#

thanks @pearl marsh . Let me think over it and design a payment flow for my application.

pearl marsh
#

NP!