Package Data | |
---|---|
Maintainer Username: | hardywen |
Maintainer Contact: | hardy.wen@foxmail.com (HardyWen) |
Package Create Date: | 2015-03-12 |
Package Last Update: | 2018-07-06 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-22 03:00:42 |
Package Statistics | |
---|---|
Total Downloads: | 357 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 11 |
Total Watchers: | 3 |
Total Forks: | 7 |
Total Open Issues: | 1 |
自用 WeiXin Payment
##更新
###微信支付的配置要点:请留心注意本部分内容,因为这很可能是你遇到的大坑。 1.网页授权(设置错误会出现redirect_url参数错误的错误) 这个网页授权需要登录微信公众平台,点击左侧菜单“开发者中心”,在右侧“权限列表”中找到“网页账号”,点击最右侧的修改,把测试的网址写进去,不要加http。
2.支付授权目录(设置不对会无法发起js支付,因为没有权限,错误为:“getBrandWCPayRequest:fail_no permission to execute” ) 设置好授权目录即可。
###Install
"hardywen/wxpay": "dev-master"
"require": {
"hardywen/wxpay": "dev-master"
}
'providers' => array(
'Hardywen\Wxpay\WxpayServiceProvider'
)
'aliases' => array(
'Wxpay' => 'Hardywen\Wxpay\Facades\WxpayFacade'
)
composer update
命令php artisan config:publish hardywen/wxpay
php artisan view:publish hardywen/wxpay
###Usage
支付调用
$config = array(
'body'=>'',
'total_fee' =>'',
...
);
Wxpay::instance('jsApi')->setConfig($config)->pay();
支付回调
$wxpay = Wxpay::instance('jsApi');
$notify = $wxpay->verifyNotify(); //验证回调
if($notify){
//业务逻辑
return 'success';
}else{
//业务逻辑
return 'fail';
}