微信/支付宝聚合支付

调起支付:

//聚合支付微信
            $channel = 'wxPay';									//支付渠道
            $using = 'PERSON';											//支付方式
            $order_id = $order_sn;						//商户订单号
            $amount = $pay_money*100;										//支付金额
            $subject = '翡翠';									//订单标题
            $return_url = 'https://.cn/statics/success.html';			//同步通知地址(可选)
            $notify_url = 'https://.cn/NotifyJuhe/package_notify';			//异步通知地址(可选)
            $body = '';									//订单描述(可选)
            $product_id = '';								//销售产品码(可选)
            $user_id = '';										//用户ID(可选)
            $remark = '';						//备注信息(可选)
            import('JuHePay.JuHePayAPI', EXTEND_PATH , '.php');
            $jtpay_model = new \JuHePayAPI();
            $pay_info = $jtpay_model->recv_create($channel,$using,$order_id,$amount,$subject,$return_url,$notify_url,$body,$product_id,$user_id,$remark);
            $this->success( __("Purchase success") ,[
                'url' => $pay_info,
                'type' => 1,
                ]);


//聚合支付支付宝
            $channel = 'aliPay';									//支付渠道
            $using = 'WAP';											//支付方式
            $order_id = $order_sn;						//商户订单号
            $amount = 0.01;										//支付金额
            $subject = '购买VIP套餐';									//订单标题
            $return_url = 'https://.cn/statics/success.html';			//同步通知地址(可选)
            $notify_url = 'https://.cn/NotifyJuhe/package_notify';			//异步通知地址(可选)
            $body = '';									//订单描述(可选)
            $product_id = '';								//销售产品码(可选)
            $user_id = '';										//用户ID(可选)
            $remark = '';						//备注信息(可选)
            import('JuHePay.JuHePayAPI', EXTEND_PATH , '.php');
            $jtpay_model = new \JuHePayAPI();
            $pay_info = $jtpay_model->recv_create($channel,$using,$order_id,$amount,$subject,$return_url,$notify_url,$body,$product_id,$user_id,$remark);
            if($pay_info){
                $this->success( __("Purchase success") ,[
                    'info' => $pay_info,
                    'type' => $type,
                    ]);
            }

支付类文件设置:

微信/支付宝聚合支付_第1张图片

回调:

public function package_notify() {
        
        file_put_contents("weixin_notify.txt",json_encode($_REQUEST));
        
        $crypto = file_get_contents("php://input");				//异步通知请求体
        import('JuHePay.JuHePayAPI', EXTEND_PATH , '.php');
        $jtpay_model = new \JuHePayAPI();
        $postdata = $jtpay_model->notify($crypto);

        if($postdata['code'] != 200){
                echo postdata['msg'];
        }else{

            //业务代码
            $w["a.order_sn"] = array("eq",$postdata['order_id']);
            $order_info = Db::name('app_package_order a')
               ->field('a.*,b.info,b.dynamic_rate,b.block_days')
               ->join('app_package b', 'a.package_id = b.id', 'left')
               ->where($w)
               ->find();
            
            if($order_info['pay_status']==1){
                //已支付
                echo 'ACCEPT';die;
            }

 

你可能感兴趣的:(微信/支付宝聚合支付)