ycpfzf/pay is a Laravel package for wechat & alipay .
It currently has 0 GitHub stars and 77 downloads on Packagist (latest version 0.6.2).
Install it with composer require ycpfzf/pay.
Discover more Laravel packages by ycpfzf
or browse all Laravel packages to compare alternatives.
Last updated
测试完善中....
1 使用composer安装依赖
composer require ycpfzf/pay
2 发布资源
php artisan vendor:publish
在列表中选择 Ycpfzf\Pay\ServiceProvider,运行完毕会在config文件夹生成配置文件pay.php env文件配置示例
ALI_APP_ID=
ALI_PUBLIC_KEY=
ALI_PRIVATE_KEY=
WECHAT_APP_ID=
WECHAT_MINIAPP_ID=
WECHAT_APPID=
WECHAT_MCH_ID=
WECHAT_KEY=
各支付类型详见文档
use Ycpfzf\Pay\Pay;
Pay::alipay()->outTradeNo($outid)->money(0.1)->subject('测试')->app(); //使用支付宝的app支付0.1元
use Ycpfzf\Pay\Pay;
Pay::wechat()->outTradeNo($outid)->money(0.1)->subject('7天无理由退款')->refund('app');
//返回结果
[
'status'=>true, //退款是否成功
'trade_no'=>'xxxx' //平台返回的退款编号
]
use Ycpfzf\Pay\Pay;
Pay::notify(function($data){
.....
});
//回调函数中参数$data
[
'out_trade_no'=>'xxx' //商户订单编号
'status'=>true, //支付是否成功
'notify_no'=>//平台编号,
'money'=>0.10 //支付金额,单位统一都是元,
'appid'=>'xxx', //商户申请的appid
'mch_id'=>'xxx', //微信时返回mch_id,支付宝返回0
'type'=>'wechat', //类别 wechat 或 alipay
]