yansongda/laravel-pay

https://packagist.org/packages/yansongda/laravel-pay

    $this->ali_config = array(
               'app_id' => config('pay.alipay.app_id'),
               'notify_url' => route("ali_notify"),
               'return_url' => route("ali_return"),
               'ali_public_key' =>config('pay.alipay.ali_public_key'),
               // 加密方式: **RSA2**
               'private_key' =>config('pay.alipay.private_key'),
               'log' => [ // optional
                    'file' => './logs/alipay.log',
                    'level' => 'info', // 建议生产环境等级调整为 info,开发环境为 debug
                    'type' => 'single', // optional, 可选 daily.
                    'max_file' => 30, // optional, 当 type 为 daily 时有效,默认 30 天
               ],
               'http' => [ // optional
                    'timeout' => 5.0,
                    'connect_timeout' => 5.0,
               // 更多配置项请参考 [Guzzle](https://guzzle-cn.readthedocs.io/zh_CN/latest/request-options.html)
               ],
               'mode' => 'dev', // optional,设置此参数,将进入沙箱模式
               'charset'=>'utf-8'
    );

    public function confirm_order_payment(Request $request){
    if($platform == 'alipay'){
              $order = [
                       'out_trade_no' => $order_id,
                       'total_amount' => '0.01',
                       'subject' => '艾康订单支付 - 沙盒测试',
              ];
    
           return Pay::alipay($this->ali_config)->web($order)->send();
    }
    }

    public function ali_return(Request $request){
          
          if(Pay::alipay($this->ali_config)->verify()){
               Order::where('id','=',$request->out_trade_no)->update(['status'=>2,'is_pay'=>1]);
          }
          return redirect(route("list_order"));
    }

    public function ali_notify(Request $request){
          if (Pay::alipay($this->ali_config)->verify()) {
               //更新订单状态
               Order::where('id','=',$request->out_trade_no)->update(['status'=>2,'is_pay'=>1]);
     }
          echo "success";
    }