I have an Asp.Net page which has process payment. Admin can process the payment. There can be multiple admins. If a page is open in 2 browsers and admin clicks Process payment, double payment is charged to customer.
I could do a check in my button click handler / controller method that we should not charge payment if it has been already charged once. However, that too doesn't prevent the problem entirely because if both of them click process payment at the same time it could again lead to issue. How can I solve this problem?
Should I be using lock / mutex. Please suggest what is the best way to solve this such that customers don't suffer.