参考https://github.com/gaoxuxu123/laravel-alipay
composer require laravel-alipay/alipay dev-master
或者在composer.json中加入
"require": {
"laravel-alipay/alipay": "dev-master"
}
更新依赖 composer update
##使用说明
找到 config/app.php 文件
'providers' => [
Lxu\Alipay\AlipayServiceProvider::class,
]
运行 php artisan vendor:publish 命令
配置文件 config/lxu-alipay.php 已经生成,按照要求配置即可
<?php
/**
Time: 14:22
*/
return [
//pc配置
'pcconfig'=>
[
'partner' =>'2088302186611', //这里是你在成功申请支付宝接口后获取到的PID;
'key' =>'sxevk9h2vekjlx4y12arl6pryrz111', //这里是你在成功申请支付宝接口后获取到的Key
'seller_id' =>'208830211', //就是partner
'sign_type' =>strtoupper('MD5'), //不需修改
'input_charset' =>strtolower('utf-8'), //不需修改
'transport' =>'http',
'notify_url' =>getenv('APP_URL').'/alipay/getnotifyurl',//异步通知
'return_url' =>getenv('APP_URL').'/alipay/getreturnurl',//同步通知
'refund_notify_url' => 'http://自己的域名/自己的路由/方法',//不做退款无需配置
'service' =>'create_direct_pay_by_user', //不需修改,支付service
'refundservice' =>'refund_fastpay_by_platform_pwd',//退款service
'payment_type' =>'1', //不需修改
//卖家账户信息
'seller_email' =>'5352222222@qq.com', //卖家邮箱
],
//手机配置
'mobileconfig'=>
[
'partner' =>'xxxxxxxxxxxxxxxxxxxxxx',
'seller_id' =>'xxxxxxxxxxxxxxxxxxxxxx',
'key' =>'xxxxxxxxxxxxxxxxxxxxxx',
'sign_type' =>strtoupper('RSA'), //不需修改
'input_charset' =>strtolower('utf-8'), //不需修改
'notify_url' =>'http://自己的域名/自己的路由/方法', //异步通知
'return_url' =>'http://自己的域名/自己的路由/方法', //同步通知
'refund_notify_url' => 'http://自己的域名/自己的路由/方法',//不做退款无需配置
'transport' =>'http',
'service' =>'alipay.wap.create.direct.pay.by.user',//不需修改
'refundservice' =>'refund_fastpay_by_platform_pwd',//退款service
'payment_type' =>'1',
'seller_email' =>'xxxxxxxxxxxx@xxx.com',
]
];
再配置路由访问控制器进行回调即可
<?php
namespace App\Http\Controllers\Alipay;
use App\Http\Controllers\Controller;
use Omnipay\Omnipay;
use Illuminate\Http\Request;
use App\Http\Models\Painting;
use Auth;
use DB;
use App\Tools\OssUpload;
use App\Http\Models\SystemArea;
use App\Http\Models\Order;
use App\Http\Models\Cart;
use App\Http\Models\MemberAddress;
use App\Http\Models\MemberDistribution;
use App\Http\Models\MemberUpload;
use App\Http\Models\MemberCoupon;
use App\Http\Models\Warehouse;
use App\Http\Models\Collection;
use App\Http\Models\Member;
use App\Http\Models\Message;
use Symfony\Component\Console\Input\Input;
/**
pc 支付宝支付
*/
class IndexController extends Controller
{
/**
}
/**
}
}
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。