Bei diesem Projekt handelt es sich um ein Laravel-Paket, das auf der API von PAYJS basiert und direkt in der Produktionsumgebung verwendet werden kann.
PAYJS bietet WeChat-Zahlungszugriffsfunktionen für einzelne Personen. Es handelt sich um eine formelle, sichere und zuverlässige WeChat-Zahlungsschnittstelle, die getestet wurde.
Andere Versionen: PAYJS Universal Development Kit
Unterstützt Laravel 5.x, Laravel 6.x, Laravel 7.x, Laravel 8.x
Über Composer installieren
$ composer require xhat/payjs-laravel
php artisan vendor:publish --provider= " XhatPayjsPayjsServiceProvider "
config/payjs.php
um die Händlernummer und den Kommunikationsschlüssel zu konfigurieren return [
' mchid ' => '' , // 填写商户号
' key ' => '' , // 填写通信KEY
];
Stellen Sie zunächst die Fassade im Geschäftsmodul vor
use Xhat Payjs Facades Payjs ;
// 构造订单基础信息
$ data = [
' body ' => '订单测试' , // 订单标题
' total_fee ' => 2 , // 订单标题
' out_trade_no ' => time (), // 订单号
' attach ' => ' test_order_attach ' , // 订单附加信息(可选参数)
' notify_url ' => ' https://www.baidu.com/notify ' , // 异步通知地址(可选参数)
];
return Payjs:: native ( $ data );
// 构造订单基础信息
$ data = [
' body ' => '订单测试' , // 订单标题
' total_fee ' => 2 , // 订单金额
' out_trade_no ' => time (), // 订单号
' attach ' => ' test_order_attach ' , // 订单附加信息(可选参数)
' notify_url ' => ' https://www.baidu.com/notify ' , // 异步通知地址(可选参数)
' callback_url ' => ' https://www.baidu.com/callback ' , // 支付后前端跳转地址(可选参数)
];
$ url = Payjs:: cashier ( $ data );
return redirect ( $ url );
// 构造订单基础信息
$ data = [
' body ' => '订单测试' , // 订单标题
' total_fee ' => 2 , // 订单金额
' out_trade_no ' => time (), // 订单号
' attach ' => ' test_order_attach ' , // 订单附加信息(可选参数)
' openid ' => ' xxxxxxxxxxxxxxxxx ' , // 订单附加信息(可选参数)
' notify_url ' => ' https://www.baidu.com/notify ' , // 异步通知地址(可选参数)
];
return Payjs:: jsapi ( $ data );
// 构造订单基础信息
$ data = [
' body ' => '订单测试' , // 订单标题
' total_fee ' => 2 , // 订单金额
' out_trade_no ' => time (), // 订单号
' attach ' => ' test_order_attach ' , // 订单附加信息(可选参数)
' notify_url ' => ' https://www.baidu.com/notify ' , // 异步通知地址(可选参数)
' callback_url ' => ' https://www.baidu.com ' , // 前端跳转地址(可选参数)
];
return Payjs:: mweb ( $ data );
// 构造订单基础信息
$ data = [
' mchid ' => ' 123123 ' , // 商户号
];
return Payjs:: complaint ( $ data );
// 根据订单号查询订单状态
$ payjs_order_id = ' **************** ' ;
return Payjs:: check ( $ payjs_order_id );
// 根据订单号关闭订单
$ payjs_order_id = ' **************** ' ;
return Payjs:: close ( $ payjs_order_id );
// 根据订单号退款
$ payjs_order_id = ' **************** ' ;
return Payjs:: refund ( $ payjs_order_id );
// 返回商户基础信息
return Payjs:: info ();
// 根据订单信息中的 OPENID 查询用户资料
$ openid = ' *************** ' ;
return Payjs:: user ( $ openid );
// 根据订单信息中的银行编码查询银行中文名称
$ bank = ' *************** ' ;
return Payjs:: bank ( $ bank );
// 接收异步通知,无需关注验签动作,已自动处理
$ notify_info = Payjs:: notify ();
Log:: info ( $ notify_info );
Version 1.5.0 fügt Beschwerde-API und H5-Zahlungs-API hinzu
Version 1.4 behebt das Filterproblem von Nullparametern
Wenn Sie während der Nutzung Fehler entdecken, geben Sie bitte ein positives Feedback und ich werde diese so schnell wie möglich beheben.