The publisher has access to set stock quantity during program publishment, the purchasing quantity can not overflow the valid quantity or be zero.
Program quantity under payment process would be locked temporarily until payment process be done. If the payment did not finish in 5 mins, the order would be deleted automatically and release the locked quantity.