2
votes

I am currently migrating a number of my clients from Stripe's old checkout window to the latest version of the Stripe checkout window to get it SCA ready. I have migrated the majority of my clients but one particular client tracks stock levels on server side. This was fine with the previous Stripe checkout window because my application would simply update the stock level of an item when the /charge succeeded with Stripe.

Now, because of V3 of the checkout, I have to create a Checkout Session before the end customer has paid for the item. At this point I then update the stock level of an item and if purchased that is fine. If they cancel the payment then I can replenish the stock level and that works fine too. My problem comes when a customer doesn't cancel the payment but instead exits the checkout window, or leaves it open in their browser without completing it. This leaves the Payment Intent 'Incomplete' on my Stripe dashboard but never triggers the stock replenishment function because I haven't received a payment intent cancellation. Is there any way round this? With a maximum time before an incomplete payment is automatically cancelled perhaps?

Any help would be greatly appreciated. Thanks again

1

1 Answers

1
votes

If the customer leaves the CheckoutSession incomplete, it will expire and cancel the PaymentIntent automatically after 24 hours. If you don't want to wait that long, you'd likely want to use the Stripe API to poll for PaymentIntents that are older than a certain number of minutes and cancel incomplete ones manually.