About the order status of the trading system
The
platform generates an order after the customer"s transaction (at this time, the status is: unpaid). Because the platform needs to connect to the third-party payment company, we do not know whether the customer has paid (because the third-party payment company does not have an asynchronous callback). So we need to keep polling, but this will have a timeliness problem, and we can"t get the upstream status in time.
is it possible to query each order independently so that customers can know in time whether the order status has been paid? Is there a plan?
if I remember correctly, Alipay itself uses polling to query payment results
you can determine different polling strategies for orders at different times, such as a callback for 2min in order 5min and a poll for 1min in 10min.
1. I think we can take a look at the documents paid by third parties. Generally speaking, there are two callbacks for payments. The first is Synchronize callback, and the second is asynchronous callback. I don't know if your third party is that. If not, this is a defect in the design of third-party payment software that needs to be improved. There is no asynchronous callback in ps:. I don't know how they fooled themselves. Then put the software online, this defect is too big.
2. Obviously, the polling strategy is wrong, because user payment is real-time payment. Unless you set up a long socket link with a third party to receive data in real time, the order status cannot be polled.
3. If you can confirm that your order number is the same as the other party's order number, you can check the payment status of the other party before confirming. This general third-party payment company has this interface, but a third-party payment that does not even have an asynchronous callback. Is there a third-party payment in this interface that I also doubt
are you sure there is no asynchronous callback? If not, it doesn't matter. There are two ways to solve it:
1. When the user pays, a new page pops up. The current page polls the backend, and the backend queries the status of the order
2. The background traverses all unpaid orders to poll
there is a timeout for an order. For example, if a 5-minute unpaid order times out, you can poll and check it every 1 minute.
I feel that I can also write a job in the database to detect
use redis or mongodb to cache the created order, and then perform polling detection