Mobile WeChat payment error Summary (jsapi), payment for jsapi

Source: Internet
Author: User
Tags openid

Mobile Payment error Summary (jsapi), payment for jsapi

There are many demos for pc.

When you make a payment on the Mobile End, you must first configure the domain name that can be tested and the authorized domain name, one configured in the payment on the public platform.

Note: The method for obtaining the open Id must be written to the configured domain name. Otherwise, the domain name is not authorized.

There is also an authorized domain name configured in the payment, and there is a Web page authorization at the bottom, which configures your test domain name, and then you need to download a file, we recommend that you put it in the root directory of the domain name.

I want to download the official SDK and configure appid.

Then you can generate an order for testing. This is the beginning of the pitfall.

The first step is to obtain the openid. I guess his mechanism is to send a request through you, then he requests the Open Platform for payment, and then returns the openid to you. At this time, the parameters you carry are particularly important, if youIf the link uses "/" to link parameters and values, it may treat your parameters as paths and report an unregistered domain name error,When you make the payment, you still try to call it up, and then it will not succeed. The Android system will not report an error, and ios will report an error after the call (I don't know if it is the reason for my mobile phone ).

Error 1: The domain name is not registered. Check whether the domain name is the same as your configured domain name and whether it is the reason for parameter format or whether the method for obtaining openid is not under your registered domain name. (See WxPay. JsApiPay. php In the example folder to find the line of code that he assembled your link. Print it and see [I forgot a few lines].)

Error 2 missing parameter, timeStampIn the WxPay. JsApiPay. php class, find GetJsApiParameters. The timeStamp should be of the string type. check whether it is an integer. If yes, enclose it with quotation marks.

Error 3 redirect_url parameter error: Please check carefullyPayment-> account center-> review configuration-> webpage authorization to ensure that your test webpage has been set.

Error 4: I didn't report anything... I didn't try to make a payment. It should be because the unified order you made was not successful, and the order was not generated and could not be paid.WxPay. JsApiPay. phpAn error is reported and no result is returned. there is only one case where a parameter is not passed (price, order number, name, openid ...), printing one by one will always solve the problem. check whether two required parameters are generated:JsApiParameters, editAddress;

Error 5: after the call, no payment is displayed, and the order is invalid. Then, the system tries to call the call, but no error is reported. The input password box is displayed. This error is common, it is also difficult to find... is obtainedThe jsApiParameters and editAddress parameters should be in json format. If the above error is reported, it is because you return a string and you must convert it to a json object.

 

Note: If you want to complete the order generation and payment on the same page, do not use ajax to generate the order and obtain the openid. This will not return anything to you, obtain the openid in the method on the current page, and then upload it to this page. Then, after ajax generates the order, it uploads the openid and order information to the background. Call the interface to place an order and return two required parameters (JsApiParameters, editAddress.

 

Make a person with material in mind. <shiyan_stz@163.com>

 

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.