知识卡片

支付系统案例卡 · 3456

付款失败后库存仍占用

理解等级:中级

若下单时先扣减原料库存、随后支付失败,而库存更新仍保留,商品可用量就与真实未成交订单不符。根因是库存与支付分属不同步骤,前一步提交后不能假定后一步必定成功。对应处置见 [[付款失败回退库存]]。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    原书出处

    参考来源

    - 位置:《Microservice APIs》第 1 章《What are microservice APIs?》(源文件:_epub-src/OEBPS/Text/01.htm) - 结论依据:1.3.4 节明确设定“下单时更新库存、之后支付失败”的顺序,并要求撤回库存变化,因而可推出未撤回时库存错误的具体问题。 - 原始内容:We may want to update the availability of the ingredients at the time of making the order, and if payment fails later on, we want to make sure we rollback the update.