E-commerce checkout, how to prevent user to buy if inventory got to 0 a few seconds ago?

Hello !

I am building an app in the same style as Airbnb.

I am looking for a solution to prevent a user who is on the checkout page to proceed to payment with Stripe, if while on the checkout page the property becomes unavailable.

On the checkout page I have a hidden repeating group that lists bookings (with the function “search for”) that overlap with the user desired dates.

The user can arrive on the checkout page, but if while on the checkout page the overlapping bookings repeating group count is greater than 0, a pop up is displayed and the user can’t proceed to the payment.

This is working fine, but I have found that this technique is not bulletproof, and the database might be lacking speed.

If I open 2 browser windows, simulate 2 different users, have 1 book the property, and just a second later click on “proceed to pay” for the other user, the user reaches the stripe checkout, which is not what is supposed to happen.

Any idea for a solution to fix this ?

Anyways, I think this just pushes the problem further. Because what if 2 users are on the stripe checkout page, both confirm payment at the same time. How can I prevent the property from being double booked ?

Thank you

This topic was automatically closed after 70 days. New replies are no longer allowed.