I'm working on a .Net eCommerce site that allows users to use vouchers to get free products, discounts etc. The problem I have is that there have been instances of users, who have been issued single use vouchers, using their voucher multiple times across several sessions. They add the voucher to their basket in different browsers when it hasn't been used, then they can check out all of their sessions and use the voucher multiple times.
I've thought of a couple of possible solutions to this problem, the most obvious is essentially a "last ditch tackle" - i.e. just before persisting the order, doing another check to see if the voucher is valid. What I don't really like about this idea is the potentially poor user experience. All seems well, you go to make a payment and it's been rejected due to the voucher now being invalid.
Another idea I had was to "quarantine" the voucher when a user adds it to the their basket. Then other users and other sessions are prevented from adding the voucher to their basket until the user who has it quarantined removes the voucher or their session expires. I think this would be a better experience for the user, but it's much more complicated to develop and test.
It's also probably not a bad idea to do both.
I bring this to you because this feels like a problem that has already been solved a thousand times. Does anyone know of a pattern, a .Net compatible framework or anything else that would solve this problem without me having to reinvent the wheel?