#KarolinaRw-checkout-session-expiration
1 messages ยท Page 1 of 1 (latest)
Hi ๐ as far as I know you can still retrieve a checkout session after it has expired, but I'm not sure I fully understand your question/scenario.
Okay, well I have a webhook controller that handles event and in all other event cases I get the payment intent like this. (.net) var stripeEvent = EventUtility.ConstructEvent(json,
Request.Headers["Stripe-Signature"], endpointSecret); var paymentIntent = stripeEvent.Data.Object as PaymentIntent; But when I got to the Events.CheckoutSessionExpired my paymentintent was null, and there is where I normally access my bookingId.
Hm, can you share the ID of a Checkout Session where you're seeing this that I can take a closer look at?
Im not sure how you mean.
I wondering if the paymentintent that I can acces in webhook event Events.CheckoutSessionExpired is supposed to be null or if I can access data in another way at that stage
Here is a session id: cs_test_a1OM0gmf3UUdu2HeIuz8V98OsdvIDk1A1pEp6onyVQnpIR2uVeMqWRkdQi
I don't think that payment intent field should be null, which is why I'm a little puzzled and trying to figure out if I'm overlooking anything. I've checked the last couple checkout.session.expired events and they all seem to have a valid value for the payment intent.
Hmm okay. Maybe I should try it again, but its a little bit hard when I have to wait 1 hour ๐
You can manually expire a session to accelerate testing:
https://stripe.com/docs/api/checkout/sessions/expire
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Thanks! Can I just ask another question. When a payment is successfull you get som events like charge succeeded and payment succeeded, is there any of them that always accurse before the other one or is it different depending on the situation? Im asking because I want to know when to be sure a payment is succeeded. Or should I go on the event checkoutsession completed?
That can vary based on payment method, but assuming you're referring to real time payment methods such as cards, then either charge.succeeded or payment.succeeded will work. You shouldn't rely on receiving events in any particular order as we can't guarantee they'll be delivered in a specific order.
Okay thanks ๐
One last question, is it possible to get an event if a customer just closes the webbrowser or the tab for checkout?
Not a problem! No, we don't have an event for that scenario.
okay thanks!
Do you now how others handle that case? If you are creating a booking like in our case, in advanced, just temporary, and then if it expires we remove the booking, but if a customer closes the payment session we don't know that so we cant handle that case.
Unfortunately there is not an event like that for Checkout. You can set the expiration to be much earlier if you want to restrict how much time the user has the opportunity to pay for their booking https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-expires_at