Answer the question
In order to leave comments, you need to log in
How to correctly account for the balance of goods in stock?
Good afternoon
How to correctly account for the balance of goods in stock? There are two options:
- Recalculate the balance when adding to the cart.
- Recalculate the balance when paying.
In the first option, if the buyer added to the cart and did not pay, the other will no longer be able to buy and pay.
In the second option, it may turn out that the goods will be paid for at the same time, because the store is waiting for a response from the payment system to confirm the payment.
How to do it right? Maybe there is a better option.
Answer the question
In order to leave comments, you need to log in
The second option is clear. In order not to manipulate the goods until it is actually paid for.
When sending a request to the payment system - put a lock on the ordered quantity of goods, after the answer - either reduce the quantity in case of success, or remove the lock.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question