WeChat scan code payment returns signature error

When making WeChat scan code payment, the signature error is returned. I searched for various solutions on the Internet, and I have tried them all, but they still cannot be solved. I also verified the signature on the official website, which is exactly the same as the one generated by the local system.

At the beginning, it passed, it can be paid normally, and it can also be called back. Later, it was moved to the action that needs to be used. During the joint debugging, it was found that the signature error was reported. After trying various methods, it was added to the previously tested action. Executed it again and found that it was normal in that action!

So I suspect it is the problem of the method location, because after I put it into the action I want to use, in order to make the code concise, I extracted some methods used in it, such as getting the local ip and generating random numbers, into a new class. , and then call it through this class, and in the action of the test, all the methods are also placed in the action. With the mentality of trying, I moved all the methods I needed to call the scan code payment report. In the action with the wrong signature, restart the access and return to normal!

I really didn't expect it to be caused by this reason. There are many reasons for the wrong signature of WeChat payment report. Some say that there cannot be Chinese in the body, some say that the parameters involved in the signature are incomplete, and some are reset. The API password is fine. I almost had to reset the password. Fortunately, I tried the code in the action I tested before.

There are all kinds of complaints about WeChat payment on the Internet. Compared with Alipay payment, WeChat payment is indeed much worse, and the document process on the official website is not so clear. Take this signature error as an example, there is no problem at all indicating where it is, which is very inconvenient. It is helpful to find errors, I hope it can be improved...

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326706436&siteId=291194637