微信/支付宝聚合支付

调起支付:

//聚合支付微信
            $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,
                    ]);
            }

支付类文件设置:

回调:

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;
            }

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值