search
Homephp教程php手册直接vender的微信官方支付V3包

直接放在vender的微信官方支付V3包,只是做了简单的路径修正,保持了官方直接下载的源文件
调用示例// +----------------------------------------------------------------------<br> // | Author: 左边 (加群:366504956(刚建,欢迎)  交流thinkphp下微信开发)<br> // +----------------------------------------------------------------------<br> <br> <br> public function Index(){<br>         //商户基本信息,可以写死在WxPay.Config.php里面,其他详细参考WxPayConfig.php        <br>         define('APPID','wx9dc408cb04cd6d2d');<br>         define('MCHID', '1709319401');<br>         define('KEY', 'e10adc3949ba59abbe56e757f20f883e');<br>         define('APPSECRET', '8c97c84a34f4be1d46bd35b7e51df86a');    <br> <br>         vendor('Pay.JSAPI');<br>         $tools = new \JsApiPay();<br>         $openId = 'oql2ZwUwTvQsD73jTZuzRc2KFYEA';<br>         $Out_trade_no=date('YHis').rand(100,1000);<br>         $Total_fee='测试';<br>         $Body='啥也不说';<br>         $Total_fee=1;<br>         $input = new \WxPayUnifiedOrder();<br>         $input->SetBody($Body);<br>         $input->SetOut_trade_no($Out_trade_no);<br>         $input->SetTotal_fee($Total_fee);<br>         $input->SetNotify_url("http://xx.xxx.com/pay/notify.php");<br>         $input->SetTrade_type("JSAPI");<br>         $input->SetOpenid($openId);<br>         $order = \WxPayApi::unifiedOrder($input);<br>         $this->jsApiParameters = $tools->GetJsApiParameters($order);<br>         $this->display();<br>     }htmlnbsp;html><br> <br>     <meta> <br>     <title>微信安全支付</title> <br>     <meta> <br>     <meta> <br>     <meta> <br>     <meta> <br>     <meta> <br>     <meta> <br>     <meta> <br>     <meta> <br>     <meta> <br> <br>     <script><br /> //调用微信JS api 支付<br /> function jsApiCall()<br /> {<br /> WeixinJSBridge.invoke(<br /> &#039;getBrandWCPayRequest&#039;,<br /> {$jsApiParameters},<br /> function(res){<br /> WeixinJSBridge.log(res.err_msg);<br /> if(res.err_msg == &#039;get_brand_wcpay_request:cancel&#039;) {<br /> alert("您已取消了此次支付");<br /> return;<br /> } else if(res.err_msg == &#039;get_brand_wcpay_request:fail&#039;) {<br /> alert("支付失败");<br /> return;<br /> } else if(res.err_msg == &#039;get_brand_wcpay_request:ok&#039;) {<br /> alert("支付成功!");//跳转到订单页面<br /> <br /> } else {<br /> alert("未知错误"+res.error_msg);<br /> return;<br /> }<br /> }<br /> );<br /> }<br /> <br /> function callpay()<br /> {<br /> if (typeof WeixinJSBridge == "undefined"){<br /> if( document.addEventListener ){<br /> document.addEventListener(&#039;WeixinJSBridgeReady&#039;, jsApiCall, false);<br /> }else if (document.attachEvent){<br /> document.attachEvent(&#039;WeixinJSBridgeReady&#039;, jsApiCall); <br /> document.attachEvent(&#039;onWeixinJSBridgeReady&#039;, jsApiCall);<br /> }<br /> }else{<br /> jsApiCall();<br /> }<br /> }<br /> </script><br> <br> <br> <br> <br>     <button><br>         确认支付<br>     </button><br> <br> <br>

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!