I have an application in which users can create an order and payonline using stripe.js
When the order is created it's status is set to unpaid. The user then has the option to review the order on a checkout page and make a payment on a payment page which has the form for them to enter their card details.
I use the order id as an idempotent key to ensure no duplicate payments are made e.g. if the users click the pay button multiple times on the payment page etc.
However since it's a multiuser app i.e. other users from the same organization can view all orders to make payments. I want disable the pay button on checkout page for any orders that are currently being paid and display a 'payment in progress' message and redirect any other users trying to access the payment page for the same order if another user is already on the payment page.
if the first paying user navigates away from the payment page without making a payment then the pay button on the checkout can be enabled.
Any ideas how you would do this maybe using some kind of session