支付宝支付

//支付调用
public function alipay()
    {
        $money = $_REQUEST['money'];
        //支付标题 内容
        $attach = $_REQUEST['attach'];
  
        

        $aop = new AopClient ();
        $this->out_trade_no = substr(build_order_no().uniqid(),0,32);
        $aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do'; //请求地址
        $aop->appId = config('alipay_id'); //自己的支付宝APPID
        $aop->rsaPrivateKey = config('private_key'); //私钥
        $aop->apiVersion = '1.0';
        $aop->postCharset='utf-8';
        $aop->format='json';
        $aop->signType='RSA2';

        //后台生成订单
        
        $order_res = $this->OrderModel->addOrder($order_info);

        $request = new AlipayTradeWapPayRequest();
        $request->setNotifyUrl('');//异步回调地址
        $request->setReturnUrl('');//同步回调地址 

        $request->setBizContent("{" .
        "    \"body\":\"".$attach."\"," .
        "    \"subject\":\"".$attach."\"," .
        "    \"out_trade_no\":\"".$this->out_trade_no."\"," .
        "    \"timeout_express\":\"90m\"," .
        "    \"total_amount\":".$money."," .
        "    \"product_code\":\"QUICK_WAP_WAY\"" .
        "  }");
        $result = $aop->pageExecute ($request);
        return $result;
    }
/**
     * 支付宝支付回调页面
     * @param  string $type [description]
     * @return [type]       [description]
     */
    public function backHtmlAlipayUrl($type='alipay')
    {
        回调数据:
        // "gmt_create": "2018-08-29 09:44:11",
        // "charset": "utf-8",
        // "seller_email": "",
        // "subject": "",
        // "sign": "",
        // "body": "",
        // "buyer_id": "",
        // "invoice_amount": "0.01",
        // "notify_id": "",
        // "fund_bill_list": "[{\"amount\":\"0.01\",\"fundChannel\":\"ALIPAYACCOUNT\"}]",
        // "notify_type": "trade_status_sync",
        // "trade_status": "TRADE_SUCCESS",
        // "receipt_amount": "0.01",
        // "buyer_pay_amount": "0.01",
        // "app_id": "",
        // "sign_type": "RSA2",
        // "seller_id": "",
        // "gmt_payment": "2018-08-29 09:44:12",
        // "notify_time": "2018-08-29 09:44:12",
        // "version": "1.0",
        // "out_trade_no": "",
        // "total_amount": "0.01",
        // "trade_no": "",
        // "auth_app_id": "",
        // "buyer_logon_id": "",
        // "point_amount": "0.00"
        // end 打印数据
        
        $alipay_info = $_POST;
        
        
        
        
        $info = 调用自己的其他方法完成逻辑处理
        
        if ($info['status'] == 1) {
            echo 'success'; //回调必须反的字段 否则支付宝会一直发起请求
        }else{
            echo 'fail';
        }
    }

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

饭饭咿呀呀

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值