The common uses of payment in products are purchase and recharge. The operations of these two functions are quite different. Compared with recharge, purchase requires many more steps. It requires locking the product or inventory, and also requires operations such as canceling the order if the payment is overtime. In this article It mainly discusses the payment part, which belongs to the public part of purchase and recharge.
The following is a simple payment sequence diagram drawn
The above sequence diagram is not complete. In fact, the core steps are: place an order --> get the QR code, scan the code to pay --> asynchronous notification. In the previous article, we talked about distributed locks. The location of the lock depends on the business. Different. In the next article we will talk about how to use distributed locks when placing orders.