For WeChat payment, what do you use to determine whether the payment is successful?

Source: Internet
Author: User
I currently know two situations: Payment successful, JSSDK notification. Advantage: the speed is fast, and the result is immediately obtained after the payment is complete. Disadvantage: the front-end notification does not pass through the background. If the payment is successful, the payment cannot be guaranteed. Wait for the notification from the platform. Advantage: Check whether it is true... I currently know two situations:

  1. Payment successful, JSSDK notification. Advantage: the speed is fast, and the result is immediately obtained after the payment is complete. Disadvantage: the front-end notification does not pass through the background. Is it true that the payment is successful and cannot be guaranteed?

  2. Payment successful. Wait for the platform callback notification. Advantage: Check whether the payment is successful. Disadvantage: The wait time is too slow. I refreshed the page several times after the payment was completed. I have not yet waited for the callback notification to be sent. As a result, after the payment is successful, see the unpaid status .....

How can this problem be solved?

Summarize the solutions I have made over the past two days:
1. After the payment is successful, JSSDK notifies you that the payment is successful and starts "polling" to check whether the order status is successful. If the payment is successful, OK is returned. Otherwise, the "polling" will continue"
2. backend, wait for a notification to be returned, check the status, and update the order

Note: The "Round Robin" mentioned above is not true Round Robin, but ajax recursion over and over again .... Solve the problem.

Here I will explain the best answer to the @ Eapen who first provides the reference answer

Reply content:

I currently know two situations:

  1. Payment successful, JSSDK notification. Advantage: the speed is fast, and the result is immediately obtained after the payment is complete. Disadvantage: the front-end notification does not pass through the background. Is it true that the payment is successful and cannot be guaranteed?

  2. Payment successful. Wait for the platform callback notification. Advantage: Check whether the payment is successful. Disadvantage: The wait time is too slow. I refreshed the page several times after the payment was completed. I have not yet waited for the callback notification to be sent. As a result, after the payment is successful, see the unpaid status .....

How can this problem be solved?

Summarize the solutions I have made over the past two days:
1. After the payment is successful, JSSDK notifies you that the payment is successful and starts "polling" to check whether the order status is successful. If the payment is successful, OK is returned. Otherwise, the "polling" will continue"
2. backend, wait for a notification to be returned, check the status, and update the order

Note: The "Round Robin" mentioned above is not true Round Robin, but ajax recursion over and over again .... Solve the problem.

Here I will explain the best answer to the @ Eapen who first provides the reference answer

Call back after jssdk is used successfully

I pay for an online project. The callback is timely.

Add a payment in the page status to increase user experience

-- Personal suggestion

Frontend page polling
For callback notifications such as backend interfaces, the database status is updated when the payment is successful, and the frontend Round-Robin will soon check whether the payment is successful.

In this case, you can play a text game with the user. For example, after the customer successfully pays the game, the user can be presentedPaid for confirmationStatus. After the callback is confirmed, the payment is confirmed ..

If the payment is successful or not, the corresponding payment will definitely return results! Is it possible to judge based on the Status returned by the interface?

Looking at these answers, there are active queries and official callback interfaces for payment.

I have made a few payments, and I have been using the callback notification in the back segment for judgment, and it has been very fast. The status of mainstream payment third parties is basically determined through backend callback. Optimize your program.

There should be a callback program in this case. We have previously done a similar payment interface docking program. I have made dozens of payment contacts, and they all have payment callbacks. Take a good look at the documentation. Although I have not done any documentation, I think they will always have this callback. You can see where the configuration is, which will let you configure the callback. Have a good look.

It has something to do with the server. The payment callback is still very fast. In my project, the callback is basically within one second.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.