欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

直接vender的微信官方支付V3包

程序员文章站 2022-06-02 08:33:24
...
直接放在vender的微信官方支付V3包,只是做了简单的路径修正,保持了官方直接下载的源文件
调用示例// +----------------------------------------------------------------------
// | Author: 左边 (加群:366504956(刚建,欢迎) 交流thinkphp下微信开发)
// +----------------------------------------------------------------------


public function Index(){
//商户基本信息,可以写死在WxPay.Config.php里面,其他详细参考WxPayConfig.php
define('APPID','wx9dc408cb04cd6d2d');
define('MCHID', '1709319401');
define('KEY', 'e10adc3949ba59abbe56e757f20f883e');
define('APPSECRET', '8c97c84a34f4be1d46bd35b7e51df86a');

vendor('Pay.JSAPI');
$tools = new \JsApiPay();
$openId = 'oql2ZwUwTvQsD73jTZuzRc2KFYEA';
$Out_trade_no=date('YHis').rand(100,1000);
$Total_fee='测试';
$Body='啥也不说';
$Total_fee=1;
$input = new \WxPayUnifiedOrder();
$input->SetBody($Body);
$input->SetOut_trade_no($Out_trade_no);
$input->SetTotal_fee($Total_fee);
$input->SetNotify_url("http://xx.xxx.com/pay/notify.php");
$input->SetTrade_type("JSAPI");
$input->SetOpenid($openId);
$order = \WxPayApi::unifiedOrder($input);
$this->jsApiParameters = $tools->GetJsApiParameters($order);
$this->display();
}
html


微信安全支付