问题描述:

I am building a real-time reservation system and would like to allow users to buy a specific time slot using Paypal.

I can use IPN to call back to the server once payment has been completed however I am unsure how to proceed if the slot has already been sold i.e. another user has bought the slot moments before. At this point payment will have been taken.

I could potentially "lock" the slot as the buying process has been initiated however what happens if the user starts the buying process and then quits half way through?

Can anyone advise on a stratergy for such payment types?

Best regards, Ben.

网友答案:

You were correct, you put a lock on the slot but let it be time-based expiry. So if after a certain time that slot is still in locked state free it.

States assumed : FREE, LOCKED, ASSIGNED

相关阅读:
Top