Home  >  Q&A  >  body text

php - The third-party payment platform notifies multiple times asynchronously in a short period of time, and the order is confirmed and collected multiple times.

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

ringa_leeringa_lee2675 days ago924

reply all(4)I'll reply

  • ringa_lee

    ringa_lee2017-05-25 15:10:25

    Payment needs to be processed according to a unique ID, such as transaction number, serial number, etc. It is impossible to allow multiple repetitions.

    reply
    0
  • PHP中文网

    PHP中文网2017-05-25 15:10:25

    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

    reply
    0
  • PHPz

    PHPz2017-05-25 15:10:25

    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.

    reply
    0
  • PHP中文网

    PHP中文网2017-05-25 15:10:25

    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

    reply
    0
  • Cancelreply