Third-party payment asynchronous notification notifies the callback address multiple times. The previous notification request has not been processed yet, and the subsequent request is sent, resulting in multiple confirmations of receipt. How to solve it
Payment needs to be processed according to a unique ID, such as transaction number, serial number, etc. It is impossible to allow multiple repetitions.
When a request comes, first update the record status in the db from the initial state to an intermediate state
Then process the request, update the intermediate state to the processing completion state
and then return a message to the third-party asynchronous request
What I’m curious about is, multiple times in a short period of time, so how many times in a short period of time?
For example, 5-10 times in 10 seconds, you should consider optimizing your code. Why can't you process one request in 1 second? After the first one is processed, subsequent requests are ignored.
For example, 5-10 times in 1 second, simple processing is to queue up and turn concurrent requests into serial ones, which can be solved.
For the above, I feel that if the frequency is so high, there must be something wrong, and I can find a third-party platform to raise it.
After the program is processed, it will return success to the third party, otherwise it will fail. The third party will not make any more requests after receiving the success, otherwise the IP address will be blocked easily. This kind of problem should be written in the document for third parties to see