Home >Backend Development >PHP Tutorial >WeChat official account payment pitfall: missing parameters timeStamp and other error solutions when calling payment jsapi

WeChat official account payment pitfall: missing parameters timeStamp and other error solutions when calling payment jsapi

WBOY
WBOYOriginal
2016-07-29 09:06:461373browse

I have been quite busy during this period. When I get busy, I really feel like I am just a money-making machine (it seems like I can earn a lot of money, haha). It is rare that I have some free time now, and I want to think about it. I would like to share with you the problems and solutions encountered during the development of WeChat public account payment. If you can't get rid of these "hidden pits", don't get rid of them. Otherwise, problems will occur at critical moments, which will really make people anxious and anxious.

The shopping mall activities for Double 12 customers are gaining momentum, but some users frequently reported that they could not pay, there was a problem, and the screenshots are as follows:

微信公众号支付之坑:调用支付jsapi缺少参数 timeStamp等错误解决方法

The problem felt very strange at the time, and I tested it many times. OK, solve the problem as soon as it comes, and finally find the solution:

The reason is that a string variable in the program was mistakenly set to a numeric type. The solution is very simple, just add double quotes to it.

Open the file WxPay.JsApiPay.php

Change $jsapi->SetTimeStamp($timeStamp);

to $jsapi->SetTimeStamp("$timeStamp");

微信公众号支付之坑:调用支付jsapi缺少参数 timeStamp等错误解决方法

Another point that needs to be reminded is that since WeChat public account payment requires obtaining user information through web page authorization, the page address for initiating payment cannot have parameters, otherwise it will prompt: returnurl does not exist.

Okay, this is also my personal solution. If you have a good solution, you are welcome to propose it and learn and make progress together, thank you!

The above introduces the pitfalls of WeChat official account payment: missing parameters timeStamp and other error solutions when calling the payment jsapi, including relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn