As we all know, returning-1 represents all kinds of errors (pits), so check from the beginning. First, check whether the WXPayEntryActivity.java file is placed in. Whether the wxapi package and the registration in the list are wxapi. After WXPayEntryActivity is confirmed, check whether the parameters returned by the background are wrong.
At this point, if everything is normal, you can start to check whether the parameter settings in the background are correct.
Pay attention to the application signature and application package name here, because I didn't package the package in question. I suspect that the problem is that the application signatures don't match, and this is the result. The packaging colleague used another keystore file for packaging, which led to the inconsistency between the application signature and the background filling, so the signature was regenerated to update the background settings, and the problem was solved.
As for why some modes can be paid normally and some modes cannot be adjusted, I refer to the problems encountered by some coders. "WeChat payment can only be adjusted once successfully."
Because the successful payment model is the company tester and the unsuccessful model is the user machine, it is speculated that the company tester has debugged WeChat payment and has the correct package name and signature cache. WeChat directly reads the cache value when adjusting, and adjusts it directly after verification. When the cache value is wrong, WeChat will read the new package name and signature again for verification, so there is a problem that some models can pay. It is also for this reason that I debugged it again after modifying the signature. The first time I answered-1, I clicked again, but I didn't answer-1. Personal guess, if there are any mistakes, please point out the discussion.
There are too many pits paid by WeChat, and iOS IAP written by OC also has many hidden pits. I have always wanted to write down the detailed process of calling Java-integrated WeChat and Alipay payment in Unity and using OC-integrated iOS in-house purchase, but I have been lazy. . Be sure to write well during this time, make a record for yourself and give you a reference.