service booking overview
Title may not be so clear. So I am trying to express here.

What I am doing is, building a website that has services which will be booked by the user. The vendor who has provided service has many agents for performing the service operation.( simple example, ordering a pizza form restaurant may leads one delivery man less during the service). 

So everything done till the add to cart. Choosing a vendor(if agents are available), choosing what service the user wants, and when.

Till here, everything is fine. Now comes booking part with payment. So can you suggest when to write into database for the decrement of number of agent for particular date/time. Will that be after payment is completed or before payment.

Also a problem occurs. During the time of adding to cart for booking, the vendor might be already packed by some other user. In that case what would be appropriate response (user might have selected 2 services, one is available and another is not). I am not willing to do something that the user books only the available service. And leaves the remaining service. Can there be any logic that user goes with what s/he have selected?

This might not seem a regular question asked in this forum. But can you help me doing some logic? 
service booking overview
===

Title may not be so clear. So I am trying to express here.

What I am doing is, building a website that has services which will be booked by the user. The vendor who has provided service has many agents for performing the service operation.( simple example, ordering a pizza form restaurant may leads one delivery man less during the service). 

So everything done till the add to cart. Choosing a vendor(if agents are available), choosing what service the user wants, and when.

Till here, everything is fine. Now comes booking part with payment. So can you suggest when to write into database for the decrement of number of agent for particular date/time. Will that be after payment is completed or before payment.

Also a problem occurs. During the time of adding to cart for booking, the vendor might be already packed by some other user. In that case what would be appropriate response (user might have selected 2 services, one is available and another is not). I am not willing to do something that the user books only the available service. And leaves the remaining service. Can there be any logic that user goes with what s/he have selected?

This might not seem a regular question asked in this forum. But can you help me doing some logic? 