I have a checkout flow in which a customer can apply a coupon code to their purchase. Each customer has a limited set of coupons they can apply to get some percentage off their price. When a customer applies the coupon, the application registers in the database an attempt to use such coupon.
I plan to use a stripe webhook to listen to cancellations and succesful payments and mark the coupon as unusable or usable again for future purchases for that specific customer. In the case where the payment intent was cancelled, then the coupon can be used again by the customer. This works if the customer completes the checkout flow and enters a credit card number.
However, the problem happens when the customer does not complete the whole checkout flow, and the coupon code was applied and the attempt was marked in the database.
My question is if stripe has any automatic cancellation policy for incomplete payment intents, such a scheduled cancellation after certain period of time after creation. I read somewhere that payment intents under a checkout session expire after 24 hours. But I could not find anywhere in the official docs if this is what really happens or if it applies to payment intents alone. That would be nice for me because I could use a webhook to handle that automatic cancellation.
If that is not the case, how would I be able to handle this situation? By the way, I am using my own customer and coupon system. Not integrating those with Stripe at the moment. Thanks for your help!