1.安装composer扩展
composer require yansongda/pay:^2.10 -vvv
2.更换自己的沙箱appid
<?php
namespace App\Http\Controllers;
use Yansongda\Pay\Pay;
use Yansongda\Pay\Log;
class PayController
{
protected $config = [
'app_id' => 'appid',
'notify_url' => 'http://xxxxx.cn/notify',
'return_url' => 'http://xxxxx.cn/return',
'ali_public_key' => '支付宝公钥',
// 加密方式: **RSA2**
'private_key' => '商户秘钥',
'log' => [ // optional
'file' => './logs/alipay.log',
'level' => 'info', // 建议生产环境等级调整为 info,开发环境为 debug
'type' => 'single', // optional, 可选 daily.
'max_file' => 30, // optional, 当 type 为 daily 时有效,默认 30 天
],