We are using EPiServer.Commerce v9.14.1 and we have integration with a payment gateway that requires customer to be redirected to the gateway payment pages.
We want to reserve the quantity for each line item in the shopping cart until the payment is completed successfully and order is placed.
If payment was failed or 30 minutes have passed from the time of reservation, we need to release the quantity reserved.
Any idea how to achieve above requirements?
If you run the adjust inventory activity it will reserve a quantity for you, as it does not actual decrement inventory until you release the item for shipment. If you cancel the order it will add the inventory back.
Thanks Mark for the reply.
I have tried calling the AdjustInventory activity but unfortunately nothing happen.
I can see the 'Reserved' quantity property through editorial interface is still 0.
Also the Inventory value doesn't decremnt when I call this activity.
The Reserved quantity is pretty "legacy" field, it is not used anymore. The API:s will not change its value, until you explicitly set it via UI (again, it does not affect anything and it does not mean the reservation in your case)
Calling AdjustInventoryActivity only works if you set all the context parameters (for example, OrderGroup) correct. It would be simpler if you request the Inventory system directly. However, know when the cart is expired to cancel the "reservation" will be tricky.