How to realize the official account payment Interface of Thinkphp Wechat
This article mainly explains "how to achieve Thinkphp Wechat official account payment interface", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "how to achieve Thinkphp Wechat official account payment interface" bar!
The details are as follows
The first step is to configure the two images in the folder to have the same path except for the domain name to be changed.
The second step is to put the Weixinpay folder in\ ThinkPHP\ Library\ Vendor and place the Weixinpay folder in this Vendor folder
The third step is to put WxJsAPIController.class.php in the php file\ Home\ Controller.
Step 4: put the WxJsAPI folder in the\ Home\ View folder
The fifth step successfully calls the official account payment function of Wechat.
JsApiCall.html
Wechat secure payment / / call Wechat JS api pay function jsApiCall () {WeixinJSBridge.invoke ('getBrandWCPayRequest', function (res) {WeixinJSBridge.log (res.err_msg); if (res.err_msg = = "get_brand_wcpay_request:ok") {/ / alert (res.err_code+res.err_desc+res.err_msg) / * write down what to do if the payment is successful * /} else {/ / return to jump to the order details page alert (payment failed);}}) } function callpay () {if (typeof WeixinJSBridge = = "undefined") {if (document.addEventListener) {document.addEventListener ('WeixinJSBridgeReady', jsApiCall, false);} else if (document.attachEvent) {document.attachEvent (' WeixinJSBridgeReady', jsApiCall); document.attachEvent ('onWeixinJSBridgeReady', jsApiCall);}} else {jsApiCall ();}}