700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > PHP 微信扫码支付

PHP 微信扫码支付

时间:2023-02-17 03:12:48

相关推荐

PHP 微信扫码支付

$count = $count*100;vendor('WeixinPC.WxPayApi');//引入vendor('WeixinPC.Notify');//引入vendor('WeixinPC.WxPayNativePay');//引入$notify = new \NativePay();$input = new \WxPayUnifiedOrder(); //调用统一下单类$input->SetBody($data['title']);$input->SetAttach($data['title']);$input->SetOut_trade_no($_POST['number']);$input->SetTotal_fee($count);//$input->SetTotal_fee($count);//$input->SetTotal_fee("$count");$input->SetTime_start(date("YmdHis"));$input->SetTime_expire(date("YmdHis", time() + 7200));//$input->SetGoods_tag("test");$ss=S('config');$input->SetNotify_url("http://".$_SERVER['SERVER_NAME']."/Wxpay/WxHui");$input->SetTrade_type("NATIVE");$input->SetProduct_id($_POST['number']);$result = $notify->GetPayUrl($input);$url2 = $result["code_url"];

//二维码地址 调用方式<img alt="模式一扫码支付" src="http://paysdk./example/qrcode.php?data='$url2" style="width:200px;height:200px;"/>

//前台可做一个js定时 每两秒执行 查询是否支付成功 成功后跳转页面等操作

'" style="width:200px;height:200px;"/>///微信支付扫码支付 回调地址public function WxHui(){vendor('WeixinPC.Notify'); $notify = new \PayNotifyCallBack(); $notify->Handle(false); $is_success = $notify->IsSuccess(); $bdata = $is_success['data']; //获取微信回调数据if($is_success['code'] == 1){ $total_fee=$bdata['total_fee']/100;//支付金额$trade_no=$bdata['transaction_id'];//微信订单号$out_trade_no=$bdata['out_trade_no'];//系统订单号$openid=$bdata['openid'];//用户在商户appid下的唯一标识$number = explode('-',$out_trade_no);$type = substr($out_trade_no,0,1);echo 'success';}}//

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。