Package Data | |
---|---|
Maintainer Username: | crisenchou |
Maintainer Contact: | crisen@crisen.org (crisenchou) |
Package Create Date: | 2016-12-01 |
Package Last Update: | 2017-11-06 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-15 15:17:59 |
Package Statistics | |
---|---|
Total Downloads: | 21 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 1 |
Total Open Issues: | 0 |
微信支付
使用composer require命令进行安装
composer require "crisen/laravel-weixinpay":"1.0.*"
或者在composer.json中添加
"require": {
....
"crisen/laravel-weixinpay": "1.0.*"
},
注册服务提供者(Service Provider)
'providers' => [
...
Crisen\LaravelWeixinpay\WxpayServiceProvider::class,
}
添加门面(Facade)
'aliases' => [
...
'Wxpay' => Crisen\LaravelWeixinpay\Facades\Wxpay::class
]
配置文件部署
php artisan vendor:publish
$pay = Wxpay::factory('UnifiedOrder');
$payment = $pay->options([
'body' => $order->body,
'out_trade_no' => $order->orderid,
'total_fee' => 1
])->send();
if ($payment->isSuccessful()) {
dump($payment->getCodeUrl());
}
$payment = Wxpay::factory('OrderQuery')->options([
'out_trade_no' => 'xxxxxxx'//订单号
])->send();
if ($payment->isSuccessful() && $payment->isPaid()) {
//do something
}
$payment = Wxpay::factory('notify')->options($request);
if ($payment->isSuccessful()) {
//$outTradeNo = $payment->getOutTradeNo(); //do something with $outTradeNo
$reply = $payment->reply();
return response($reply);
}
MIT