1 Star 1 Fork 0

Yeardley / laravel-pay

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Pay

Scrutinizer Code Quality Build Status Latest Stable Version Total Downloads Latest Unstable Version License

该文档为 v2.x 版本,如果您想找 v1.x 版本文档,请点击https://github.com/yansongda/laravel-pay/tree/v1.0.3

运行环境

  • php >= 7.0
  • composer
  • laravel || lumen >= 5.1

安装

$ composer require yansongda/laravel-pay

添加 service provider(optional. if laravel < 5.5 || lumen)

// laravel < 5.5
Yansongda\LaravelPay\PayServiceProvider::class,

// lumen
$app->register(Yansongda\LaravelPay\PayServiceProvider::class);

添加 alias(optional. if laravel < 5.5)

'Pay' => Yansongda\LaravelPay\Facades\Pay::class,

配置文件

$ php artisan vendor:publish --provider="Yansongda\LaravelPay\PayServiceProvider" --tag=laravel-pay

lumen 用户请手动复制

随后,请在 config 文件夹中完善配置信息。

.env 文件里面配置

// alipay 配置
ALI_APP_ID=
ALI_PUBLIC_KEY=
ALI_PRIVATE_KEY=

// wechat 配置
WECHAT_APP_ID=
WECHAT_MINIAPP_ID=
WECHAT_APPID=
WECHAT_MCH_ID=
WECHAT_KEY=

使用方法

支付宝

use Pay;

$order = [
    'out_trade_no' => time(),
    'total_amount' => '1',
    'subject' => 'test subject - 测试',
];

return Pay::alipay()->web($order);

// 下面这个方法也可以
// return Pay::web($order);

微信

use Pay;

$order = [
    'out_trade_no' => time(),
    'body' => 'subject-测试',
    'total_fee'      => '1',
    'openid' => 'onkVf1FjWS5SBIixxxxxxxxx',
];

$result = Pay::wechat()->mp($order);

具体使用说明请传送至 https://github.com/yansongda/pay

License

MIT

The MIT License (MIT) Copyright (c) 2017 yansongda <me@yansongda.cn> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

可能是我用过的最优雅的 Alipay 和 WeChat 的 laravel 支付扩展包了 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/yeardley/laravel-pay.git
git@gitee.com:yeardley/laravel-pay.git
yeardley
laravel-pay
laravel-pay
master

搜索帮助