Payment configuration information, JSAPI interface, H5 call js interface payment, public account payment, jsapih5
The payment has been completed, and I have never been contacted. After three very difficult days, I made the payment. For professional people, it is estimated that it will be done in an hour. Although it has been done for a long time, I have learned something and gained a lot. I would like to share with you the entire payment process, if you encounter the same problems as me, you can take a look.
When I took over, I applied for public accounts and other items, and the page for receiving the server's reply message was already completed by our predecessors, and the payment service was also applied.
Public platform: https://mp.weixin.qq.com/cgi-bin/loginpage? Wxm2-login & lang = zh_CN
I will organize the process in the form of text and text. Although I have just done it, I can't remember it, but I can't help it.
It is explained here that the landlord has not set up a local environment for testing. It is a step by step error, and then the answer is returned. I don't know how to set up a local environment.
Below:
1: Some things need to be configured at the beginning. Of course, these are the most basic things.
All the attributes in the Code must be configured. Let's take a look at them in advance to deepen the image.
Next, let's take a look at how to configure the Code. (here, we only want to focus on some important points. Other comments can be understood)
APPID: just mentioned above.
MCHID: The Merchant ID is the first in the payment column of the public account.
KEY: Let's talk about it here. We should pay attention to the fact that the seller pays the KEY and needs to go to the merchant's platform to view it.
Https://pay.weixin.qq.com/index.php/home/login? Return_url = % 2F (Merchant's payment platform)
Here is an article on how to get the key. The author found it based on this:
Http://help.ecmoban.com/article-2085.html
APPSECRET: not to mention, or an article: http://jingyan.baidu.com/article/6525d4b12af618ac7c2e9468.html
The certificate path here must be correct. It is best to create a new folder in the current project and put the Certificate in it. Otherwise, errors may occur.
Download the certificate to the merchant's platform. It seems that the key is paid by the merchant. You can download the certificate.
The password of the certificate is our merchant number. The above MCHID is the password of the certificate.
IP Address: the IP address here is the IP address on the server. Format: 192.11.11.111. This is similar. Do not add the port number, which is already Http. Otherwise, an error occurs.
The basic configuration information is on the top, and the problem is about the authorization directory. If it is wrong, it cannot be paid.
The authorization directory must be on your payment page. Otherwise, the payment page does not have the permission to pay. Note: It must be case-insensitive, otherwise, it would be wrong. (when the landlord couldn't pay, he thought it was missing the port number and added it intelligently. The result was still wrong. No port number is needed here, do not waste this time ).
Because the building lord has already done a good job here, and no test directory is used. When you are just doing this, you can test on the test directory. Remember to add a white list for the test, otherwise, you have no right to pay in the public account.
The following is a Demo for everyone. The landlord uses the Demo provided on the official website (in various languages)
Https://pay.weixin.qq.com/wiki/doc/api/jsapi.php? Chapter = 11_1 #
It is recommended that you read the document here. You must read the document when calling the interface. (The landlord is lazy, so it takes so long to complete the work)
In addition, the landlord encountered the projects under the MVC project, all changed many places, but the official demo notes are quite a lot, and it is quite good to use. Let's just look at the changes.
Common Errors:
The following describes some problems encountered by the landlord:
1: error message: "Sorry, an error occurred while processing your information." It may be wrong. I cannot remember it. This is probably the case. When I enter the page, I have nothing to do with it, in this sentence
Solution: Needless to say, it must be because the code is wrong or the parameter is passed incorrectly. The data type of a parameter is incorrect at the time, leading to such a problem, check the code and at least eliminate the above configuration problems.
2: the error message is "missing parameters". As for the missing parameters, you will be prompted by yourself. However, this problem is relatively well solved, the comparison clearly tells you where the problem is. check whether this parameter is obtained in the background or whether the data type and format of this parameter are correct, at that time, the poster was quoted as an escape character by the front-end because of the json format. All errors were reported.
3, when you tap the code, pay attention to this point to avoid it. There is a buddy who finds a space for two days.
4: there are also some questions about signatures and random strings. We recommend that you do not manually generate them. The Code has been written in the official demo and there will be no errors, do not modify it at will. Otherwise, you will not know why it is wrong.
Once that's all, it's impossible for the landlord to tell everyone how to modify every sentence of code, but it just provides some general problems for everyone. The landlord is also a newbie, and the actual situation is wrong, hope you can understand
One sentence: if you only do what you can, you will never make progress.