Top Related Projects
📦 一个 PHP 微信 SDK
可能是我用过的最优雅的 Alipay/WeChat/Unipay 的 laravel 支付扩展包了
微信 SDK for Laravel, 基于 overtrue/wechat
Quick Overview
The yansongda/pay
project is a PHP package that provides a unified API for various payment gateways, including Alipay, WeChat Pay, and UnionPay. It aims to simplify the integration of payment processing into PHP applications, offering a consistent and easy-to-use interface across different payment providers.
Pros
- Unified API: The package provides a consistent API for interacting with different payment gateways, reducing the complexity of integrating multiple payment methods.
- Extensive Documentation: The project has detailed documentation, including examples and usage guides, making it easier for developers to get started and understand the library's features.
- Active Development: The project is actively maintained, with regular updates and bug fixes, ensuring compatibility with the latest payment gateway requirements.
- Community Support: The project has a growing community of contributors and users, providing a valuable resource for troubleshooting and feature requests.
Cons
- Limited Payment Gateways: While the package supports several popular payment gateways, it may not cover all the payment methods required by some applications.
- Dependency on External Libraries: The package relies on external libraries, such as
guzzlehttp/guzzle
andsymfony/http-foundation
, which may introduce additional complexity and potential compatibility issues. - Potential Learning Curve: Developers unfamiliar with the package may need to invest time in understanding its structure and usage, especially if they need to integrate with multiple payment gateways.
- Potential Vendor Lock-in: By using this package, developers may become more dependent on the project's maintainers, which could lead to vendor lock-in concerns.
Code Examples
Here are a few code examples demonstrating the usage of the yansongda/pay
package:
Alipay Payment
use Yansongda\Pay\Pay;
$order = [
'out_trade_no' => time(),
'total_amount' => '1.00',
'subject' => 'test subject - 测试',
];
$result = Pay::alipay()->web($order)->send();
// 将结果返回给前端
return $result->getContent();
This code demonstrates how to create an Alipay payment order and generate the payment page HTML.
WeChat Pay Payment
use Yansongda\Pay\Pay;
$order = [
'out_trade_no' => time(),
'body' => 'test body - 测试',
'total_fee' => '1',
'openid' => 'openid',
];
$result = Pay::wechat()->mp($order)->send();
// 将结果返回给前端
return $result->getContent();
This code shows how to create a WeChat Pay payment order and generate the payment page HTML for a WeChat Mini Program.
Refund
use Yansongda\Pay\Pay;
$refund = [
'out_trade_no' => '1514027114',
'refund_amount' => '1',
'out_refund_no' => time(),
];
$result = Pay::alipay()->refund($refund)->send();
// 处理结果
var_dump($result->toArray());
This code demonstrates how to initiate a refund for an Alipay payment.
Getting Started
To get started with the yansongda/pay
package, follow these steps:
- Install the package using Composer:
composer require yansongda/pay
- Configure the payment gateway settings in your application:
use Yansongda\Pay\Pay;
// Alipay configuration
$config = [
'app_id' => 'your-alipay-app-id',
'ali_public_key' => 'path/to/your/alipay/public/key',
'private_key' => 'path/to/your/private/key',
'log' => [
'file' => './logs/alipay.log',
'level' => 'debug',
'type' => 'single', // optional
Competitor Comparisons
📦 一个 PHP 微信 SDK
Pros of EasyWechat
- EasyWechat provides a more comprehensive set of features for WeChat integration, including support for official accounts, mini-programs, and payment gateways.
- The library is actively maintained and has a larger community of contributors, ensuring regular updates and bug fixes.
- EasyWechat has better documentation and more detailed examples, making it easier for developers to get started with WeChat integration.
Cons of EasyWechat
- Pay is a more lightweight and focused library, which may be preferred by developers who only need basic payment functionality.
- EasyWechat has a larger codebase and may have a steeper learning curve for developers who are new to WeChat integration.
- The licensing and intellectual property considerations may be more complex with EasyWechat, as it is a commercial product.
Code Comparison
Pay:
$pay = Pay::wechat([
'app_id' => 'your-wechat-app-id',
'mch_id' => 'your-wechat-mch-id',
'key' => 'your-wechat-key',
'cert_path' => 'path/to/your/cert.pem',
'key_path' => 'path/to/your/key.pem',
]);
$order = $pay->order->unify([
'out_trade_no' => time(),
'total_fee' => 1,
'body' => 'test body',
'openid' => 'openid',
]);
EasyWechat:
$app = Factory::payment([
'app_id' => 'your-wechat-app-id',
'mch_id' => 'your-wechat-mch-id',
'key' => 'your-wechat-key',
'cert_path' => 'path/to/your/cert.pem',
'key_path' => 'path/to/your/key.pem',
]);
$result = $app->order->unify([
'body' => 'Your cart order',
'out_trade_no' => time(),
'total_fee' => 1,
'trade_type' => 'JSAPI',
'openid' => 'openid',
]);
可能是我用过的最优雅的 Alipay/WeChat/Unipay 的 laravel 支付扩展包了
Pros of yansongda/laravel-pay
- Easier Integration: yansongda/laravel-pay provides a Laravel-specific integration, making it more straightforward to use within a Laravel application.
- Automatic Configuration: The package handles the configuration and setup process, reducing the amount of boilerplate code required.
- Consistent API: The package follows the Laravel conventions, providing a familiar and consistent API for developers.
Cons of yansongda/laravel-pay
- Limited to Laravel: yansongda/laravel-pay is specifically designed for Laravel applications, limiting its use in non-Laravel projects.
- Dependency on Laravel: The package is tightly coupled with the Laravel framework, which may be a drawback for developers who prefer a more framework-agnostic solution.
- Potentially Slower Updates: The updates and maintenance of yansongda/laravel-pay may be slower compared to the more general yansongda/pay package.
Code Comparison
yansongda/pay:
$config = [
'alipay' => [
'app_id' => 'your-alipay-app-id',
'secret' => 'your-alipay-secret',
// ...
],
'wechat' => [
'app_id' => 'your-wechat-app-id',
'mch_id' => 'your-wechat-mch-id',
// ...
],
];
$pay = Pay::alipay($config['alipay'])->web([
'out_trade_no' => time(),
'total_amount' => 1,
'subject' => 'test subject',
]);
yansongda/laravel-pay:
$pay = Pay::alipay()->web([
'out_trade_no' => time(),
'total_amount' => 1,
'subject' => 'test subject',
]);
微信 SDK for Laravel, 基于 overtrue/wechat
Pros of Laravel-WeChat
- Provides a comprehensive set of APIs for interacting with WeChat's various services, including official accounts, mini-programs, payment, and more.
- Integrates seamlessly with the Laravel framework, allowing developers to leverage the framework's features and conventions.
- Offers a modular design, allowing developers to use only the components they need, reducing the overall project footprint.
Cons of Laravel-WeChat
- Primarily focused on WeChat integration, which may not be suitable for developers who need to work with other payment gateways or service providers.
- Requires a deeper understanding of the Laravel framework, which may be a barrier for developers who are not familiar with it.
- May have a steeper learning curve compared to a more generic payment library like yansongda/pay.
Code Comparison
yansongda/pay:
$pay = Pay::alipay([
'app_id' => 'your-alipay-app-id',
'notify_url' => 'http://example.com/alipay-notify',
'return_url' => 'http://example.com/alipay-return',
'ali_public_key' => 'path/to/alipay/public/key',
'private_key' => 'path/to/private/key',
'log' => [
'file' => './logs/alipay.log',
'level' => 'debug',
'type' => 'single',
],
]);
$result = $pay->web([
'out_trade_no' => time(),
'total_amount' => 1,
'subject' => 'test subject - 测试',
]);
Laravel-WeChat:
$app = app('wechat.official_account');
$app->server->push(function($message) {
switch ($message['MsgType']) {
case 'text':
return "Hello, I'm WeChat!";
case 'image':
return [
'type' => 'image',
'media_id' => 'media_id',
];
}
return '';
});
$app->server->serve()->send();
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
åè¨
v3 çä¸ v2 çå¨åºå±æå¾å¤§çä¸åï¼åºç¡æ¶æåäºéæ°ç设计ï¼æ´ææ©å±ï¼ä½¿ç¨èµ·æ¥æ´æ¹ä¾¿ã
å¼åäºå¤æ¬¡æ¯ä»å®ä¸å¾®ä¿¡æ¯ä»åï¼å¾èªç¶äº§çä¸ç§åæï¼æ°æ§åæ¥äºï¼æ³å¨ç½ä¸æ¾ç¸å ³çè½®åï¼å¯æ¯ä¸ç´æ²¡ææ¾å°ä¸æ¬¾èªå·±è§å¾éå¿å¦æçï¼è¦ä¹ä½¿ç¨èµ·æ¥å¤ªé¾ç解ï¼è¦ä¹æ件ç»æ太æä¹±ï¼åªæèªå·±æ¸èµ·è¢åå¹²äºã
æ¬¢è¿ Starï¼æ¬¢è¿ PRï¼
hyperf æ©å±å 请 ä¼ éè³è¿é
laravel æ©å±å 请 ä¼ éè³è¿é
yii æ©å±å 请 ä¼ éè³è¿é
ç¹ç¹
- å¤ç§æ·æ¯æ
- Swoole æ¯æ
- çµæ´»çæ件æºå¶
- 丰å¯çäºä»¶ç³»ç»
- å½åä¸é£ä¹ä¹±ä¸å «ç³
- éèå¼åè ä¸éè¦å ³æ³¨çç»è
- æ ¹æ®æ¯ä»å®ã微信ææ° API å¼åèæ
- é«åº¦æ½è±¡çç±»ï¼å å»åç§æ¼jsonä¸xmlççè¦
- æ件ç»ææ¸ æ°æç解ï¼å¯ä»¥éå¿æ欲添å æ¬é¡¹ç®ä¸æ²¡æçæ¯ä»ç½å ³
- æ¹æ³ä½¿ç¨æ´ä¼é ï¼ä¸å¿ åå»ç 究é£äºå¥æªççæ¹æ³åæè ç±»åæ¯åå¥ç¨ç
- å ç½®èªå¨è·åå¾®ä¿¡å ¬å ±è¯ä¹¦æ¹æ³ï¼åä¹ä¸ç¨åè´¹å²å»èè第ä¸æ¬¡è·åè¯ä¹¦ççé®é¢äº
- 符å PSR2ãPSR3ãPSR4ãPSR7ãPSR11ãPSR14ãPSR18 çå项æ åï¼ä½ å¯ä»¥åç§æ¹ä¾¿çä¸ä½ çæ¡æ¶éæ
çæ¬è®¡å
https://pay.yansongda.cn/docs/v3/overview/planning
详ç»ææ¡£
æ¯æçæ¯ä»æ¹æ³
yansongda/pay 100% å ¼å®¹ æ¯ä»å®/微信/é¶è ææåè½ï¼å æ¬æå¡ååè½ï¼ï¼åªééè¿ãæ件æºå¶ãå¼å ¥å³å¯ã
åæ¶ï¼SDK ç´æ¥æ¯æå ç½®äºä»¥ä¸æ件ï¼è¯¦æ 请æ¥é ææ¡£ã
æ¯ä»å®
- çµèæ¯ä»
- ææºç½ç«æ¯ä»
- APP æ¯ä»
- å·å¡æ¯ä»
- æ«ç æ¯ä»
- è´¦æ·è½¬è´¦
- å°ç¨åºæ¯ä»
- ...
微信
- å ¬ä¼å·æ¯ä»
- å°ç¨åºæ¯ä»
- H5 æ¯ä»
- æ«ç æ¯ä»
- APP æ¯ä»
- å·å¡æ¯ä»
- ...
æé³
- å°ç¨åºæ¯ä»
- ...
é¶è
- ææºç½ç«æ¯ä»
- çµèç½ç«æ¯ä»
- å·å¡æ¯ä»
- æ«ç æ¯ä»
- ...
æ±èé¶è¡(eèæ¯ä»)
- èåæ«ç æ¯ä»(微信,æ¯ä»å®,é¶è,eè)
- ...
å®è£
composer require yansongda/pay:~3.7.0 -vvv
æ·±æ ä¸æ
æ¯ä»å®
<?php
namespace App\Http\Controllers;
use Yansongda\Pay\Pay;
class AlipayController
{
protected $config = [
'alipay' => [
'default' => [
// å¿
å¡«-æ¯ä»å®åé
ç app_id
'app_id' => '2016082000295641',
// å¿
å¡«-åºç¨ç§é¥ å符串æè·¯å¾
'app_secret_cert' => '89iZ2iC16H6/6a3YcP+hDZUjiNGQx9cuwi9eJyykvcwhD...',
// å¿
å¡«-åºç¨å
¬é¥è¯ä¹¦ è·¯å¾
'app_public_cert_path' => '/Users/yansongda/pay/cert/appCertPublicKey_2016082000295641.crt',
// å¿
å¡«-æ¯ä»å®å
¬é¥è¯ä¹¦ è·¯å¾
'alipay_public_cert_path' => '/Users/yansongda/pay/cert/alipayCertPublicKey_RSA2.crt',
// å¿
å¡«-æ¯ä»å®æ ¹è¯ä¹¦ è·¯å¾
'alipay_root_cert_path' => '/Users/yansongda/pay/cert/alipayRootCert.crt',
'return_url' => 'https://yansongda.cn/alipay/return',
'notify_url' => 'https://yansongda.cn/alipay/notify',
// éå¡«-第ä¸æ¹åºç¨æætoken
'app_auth_token' => '',
// éå¡«-æå¡å模å¼ä¸çæå¡å idï¼å½ mode 为 Pay::MODE_SERVICE æ¶ä½¿ç¨è¯¥åæ°
'service_provider_id' => '',
// éå¡«-é»è®¤ä¸ºæ£å¸¸æ¨¡å¼ãå¯éä¸ºï¼ MODE_NORMAL, MODE_SANDBOX, MODE_SERVICE
'mode' => Pay::MODE_NORMAL,
],
],
'logger' => [ // optional
'enable' => false,
'file' => './logs/alipay.log',
'level' => 'info', // 建议ç产ç¯å¢ç级è°æ´ä¸º infoï¼å¼åç¯å¢ä¸º debug
'type' => 'single', // optional, å¯é daily.
'max_file' => 30, // optional, å½ type 为 daily æ¶ææï¼é»è®¤ 30 天
],
'http' => [ // optional
'timeout' => 5.0,
'connect_timeout' => 5.0,
// æ´å¤é
置项请åè [Guzzle](https://guzzle-cn.readthedocs.io/zh_CN/latest/request-options.html)
],
];
public function web()
{
Pay::config($this->config);
$result = Pay::alipay()->web([
'out_trade_no' => ''.time(),
'total_amount' => '0.01',
'subject' => 'yansongda æµè¯ - 1',
]);
return $result;
}
public function returnCallback()
{
Pay::config($this->config);
$data = Pay::alipay()->callback(); // æ¯çï¼éªç¾å°±è¿ä¹ç®åï¼
// 订åå·ï¼$data->out_trade_no
// æ¯ä»å®äº¤æå·ï¼$data->trade_no
// 订åæ»éé¢ï¼$data->total_amount
}
public function notifyCallback()
{
Pay::config($this->config);
try{
$data = Pay::alipay()->callback(); // æ¯çï¼éªç¾å°±è¿ä¹ç®åï¼
// 请èªè¡å¯¹ trade_status è¿è¡å¤æåå
¶å®é»è¾è¿è¡å¤æï¼å¨æ¯ä»å®çä¸å¡éç¥ä¸ï¼åªæ交æéç¥ç¶æ为 TRADE_SUCCESS æ TRADE_FINISHED æ¶ï¼æ¯ä»å®æä¼è®¤å®ä¸ºä¹°å®¶ä»æ¬¾æåã
// 1ãåæ·éè¦éªè¯è¯¥éç¥æ°æ®ä¸çout_trade_noæ¯å¦ä¸ºåæ·ç³»ç»ä¸å建ç订åå·ï¼
// 2ãå¤ætotal_amountæ¯å¦ç¡®å®ä¸ºè¯¥è®¢åçå®é
éé¢ï¼å³åæ·è®¢åå建æ¶çéé¢ï¼ï¼
// 3ãæ ¡éªéç¥ä¸çseller_idï¼æè
seller_email) æ¯å¦ä¸ºout_trade_noè¿ç¬åæ®ç对åºçæä½æ¹ï¼æçæ¶åï¼ä¸ä¸ªåæ·å¯è½æå¤ä¸ªseller_id/seller_emailï¼ï¼
// 4ãéªè¯app_idæ¯å¦ä¸ºè¯¥åæ·æ¬èº«ã
// 5ãå
¶å®ä¸å¡é»è¾æ
åµ
} catch (\Throwable $e) {
dd($e);
}
return Pay::alipay()->success();
}
}
微信
<?php
namespace App\Http\Controllers;
use Yansongda\Pay\Pay;
class WechatController
{
protected $config = [
'wechat' => [
'default' => [
// å¿
å¡«-åæ·å·
'mch_id' => '',
// éå¡«-v2åæ·ç§é¥
'mch_secret_key_v2' => '',
// å¿
å¡«-v3åæ·ç§é¥
'mch_secret_key' => '',
// å¿
å¡«-åæ·ç§é¥ å符串æè·¯å¾
'mch_secret_cert' => '',
// å¿
å¡«-åæ·å
¬é¥è¯ä¹¦è·¯å¾
'mch_public_cert_path' => '',
// å¿
å¡«
'notify_url' => 'https://yansongda.cn/wechat/notify',
// éå¡«-å
¬ä¼å· ç app_id
'mp_app_id' => '',
// éå¡«-å°ç¨åº ç app_id
'mini_app_id' => '',
// éå¡«-app ç app_id
'app_id' => '',
// éå¡«-æå¡å模å¼ä¸ï¼åå
¬ä¼å· ç app_id
'sub_mp_app_id' => '',
// éå¡«-æå¡å模å¼ä¸ï¼å app ç app_id
'sub_app_id' => '',
// éå¡«-æå¡å模å¼ä¸ï¼åå°ç¨åº ç app_id
'sub_mini_app_id' => '',
// éå¡«-æå¡å模å¼ä¸ï¼ååæ·id
'sub_mch_id' => '',
// éå¡«-微信平å°å
¬é¥è¯ä¹¦è·¯å¾, optionalï¼å¼ºç建议 php-fpm 模å¼ä¸é
ç½®æ¤åæ°
'wechat_public_cert_path' => [
'45F59D4DABF31918AFCEC556D5D2C6E376675D57' => __DIR__.'/Cert/wechatpay_45F***D57.pem',
],
// éå¡«-é»è®¤ä¸ºæ£å¸¸æ¨¡å¼ãå¯éä¸ºï¼ MODE_NORMAL, MODE_SERVICE
'mode' => Pay::MODE_NORMAL,
]
],
'logger' => [ // optional
'enable' => false,
'file' => './logs/wechat.log',
'level' => 'info', // 建议ç产ç¯å¢ç级è°æ´ä¸º infoï¼å¼åç¯å¢ä¸º debug
'type' => 'single', // optional, å¯é daily.
'max_file' => 30, // optional, å½ type 为 daily æ¶ææï¼é»è®¤ 30 天
],
'http' => [ // optional
'timeout' => 5.0,
'connect_timeout' => 5.0,
// æ´å¤é
置项请åè [Guzzle](https://guzzle-cn.readthedocs.io/zh_CN/latest/request-options.html)
],
];
public function index()
{
Pay::config($this->config);
$order = [
'out_trade_no' => time().'',
'description' => 'subject-æµè¯',
'amount' => [
'total' => 1,
],
'payer' => [
'openid' => 'onkVf1FjWS5SBxxxxxxxx',
],
];
$pay = Pay::wechat()->mp($order);
// $pay->appId
// $pay->timeStamp
// $pay->nonceStr
// $pay->package
// $pay->signType
}
public function callback()
{
Pay::config($this->config);
try{
$data = Pay::wechat()->callback(); // æ¯çï¼éªç¾å°±è¿ä¹ç®åï¼
} catch (\Throwable $e) {
dd($e);
}
return Pay::wechat()->success();
}
}
æé³
<?php
namespace App\Http\Controllers;
use Yansongda\Pay\Pay;
class DouyinController
{
protected $config = [
'douyin' => [
'default' => [
// éå¡«-åæ·å·
// æé³å¼æ¾å¹³å° --> åºç¨è¯¦æ
--> æ¯ä»ä¿¡æ¯ --> 产å管ç --> åæ·å·
'mch_id' => '73744242495132490630',
// å¿
å¡«-æ¯ä» Tokenï¼ç¨äºæ¯ä»åè°ç¾å
// æé³å¼æ¾å¹³å° --> åºç¨è¯¦æ
--> æ¯ä»ä¿¡æ¯ --> æ¯ä»è®¾ç½® --> Token(令ç)
'mch_secret_token' => 'douyin_mini_token',
// å¿
å¡«-æ¯ä» SALTï¼ç¨äºæ¯ä»ç¾å
// æé³å¼æ¾å¹³å° --> åºç¨è¯¦æ
--> æ¯ä»ä¿¡æ¯ --> æ¯ä»è®¾ç½® --> SALT
'mch_secret_salt' => 'oDxWDBr4U7FAAQ8hnGDm29i4A6pbTMDKme4WLLvA',
// å¿
å¡«-å°ç¨åº app_id
// æé³å¼æ¾å¹³å° --> åºç¨è¯¦æ
--> æ¯ä»ä¿¡æ¯ --> æ¯ä»è®¾ç½® --> å°ç¨åºappid
'mini_app_id' => 'tt226e54d3bd581bf801',
// éå¡«-æé³å¼æ¾å¹³å°æå¡åid
'thirdparty_id' => '',
// éå¡«-æé³æ¯ä»åè°å°å
'notify_url' => 'https://yansongda.cn/douyin/notify',
],
],
'logger' => [ // optional
'enable' => false,
'file' => './logs/alipay.log',
'level' => 'info', // 建议ç产ç¯å¢ç级è°æ´ä¸º infoï¼å¼åç¯å¢ä¸º debug
'type' => 'single', // optional, å¯é daily.
'max_file' => 30, // optional, å½ type 为 daily æ¶ææï¼é»è®¤ 30 天
],
'http' => [ // optional
'timeout' => 5.0,
'connect_timeout' => 5.0,
// æ´å¤é
置项请åè [Guzzle](https://guzzle-cn.readthedocs.io/zh_CN/latest/request-options.html)
],
];
public function pay()
{
Pay::config($this->config);
$result = Pay::douyin()->mini([
'out_order_no' => date('YmdHis').mt_rand(1000, 9999),
'total_amount' => 1,
'subject' => 'é«åµ©è¾¾ - test - subject - 01',
'body' => 'é«åµ©è¾¾ - test - body - 01',
'valid_time' => 600,
'expand_order_info' => json_encode([
'original_delivery_fee' => 15,
'actual_delivery_fee' => 10
])
]);
return $result;
}
public function callback()
{
Pay::config($this->config);
try{
$data = Pay::douyin()->callback(); // æ¯çï¼éªç¾å°±è¿ä¹ç®åï¼
} catch (\Throwable $e) {
dd($e)
}
return Pay::douyin()->success();
}
}
æ±èé¶è¡(eèæ¯ä»)
<?php
namespace App\Http\Controllers;
use Yansongda\Pay\Pay;
class JsbController
{
protected $config = [
'jsb' => [
'default' => [
// æå¡ä»£ç
'svr_code' => '',
// å¿
å¡«-åä½åID
'partner_id' => '',
// å¿
å¡«-å
¬ç§é¥å¯¹ç¼å·
'public_key_code' => '00',
// å¿
å¡«-åæ·ç§é¥(å å¯ç¾å)
'mch_secret_cert_path' => '',
// å¿
å¡«-åæ·å
¬é¥è¯ä¹¦è·¯å¾(æä¾æ±èé¶è¡è¿è¡éªè¯ç¾åç¨)
'mch_public_cert_path' => '',
// å¿
å¡«-æ±èé¶è¡çå
¬é¥(ç¨äºè§£å¯æ±èé¶è¡è¿åçæ°æ®)
'jsb_public_cert_path' => '',
//æ¯ä»éç¥å°å
'notify_url' => '',
// éå¡«-é»è®¤ä¸ºæ£å¸¸æ¨¡å¼ãå¯éä¸ºï¼ MODE_NORMAL:æ£å¼ç¯å¢, MODE_SANDBOX:æµè¯ç¯å¢
'mode' => Pay::MODE_NORMAL,
]
],
'logger' => [ // optional
'enable' => false,
'file' => './logs/epay.log',
'level' => 'info', // 建议ç产ç¯å¢ç级è°æ´ä¸º infoï¼å¼åç¯å¢ä¸º debug
'type' => 'single', // optional, å¯é daily.
'max_file' => 30, // optional, å½ type 为 daily æ¶ææï¼é»è®¤ 30 天
],
'http' => [ // optional
'timeout' => 5.0,
'connect_timeout' => 5.0,
// æ´å¤é
置项请åè [Guzzle](https://guzzle-cn.readthedocs.io/zh_CN/latest/request-options.html)
],
];
public function index()
{
Pay::config($this->config);
$order = [
'outTradeNo' => time().'',
'proInfo' => 'subject-æµè¯',
'totalFee'=> 1,
];
$pay = Pay::jsb()->scan($order);
}
public function notifyCallback()
{
Pay::config($this->config);
try{
$data = Pay::jsb()->callback(); // æ¯çï¼éªç¾å°±è¿ä¹ç®åï¼
} catch (\Throwable $e) {
dd($e);
}
return Pay::jsb()->success();
}
}
代ç è´¡ç®
ç±äºæµè¯å使ç¨ç¯å¢çéå¶ï¼æ¬é¡¹ç®ä¸åªå¼åäºãæ¯ä»å®ããã微信æ¯ä»ãããæé³æ¯ä»ãããé¶èãããæ±èé¶è¡ãçç¸å ³æ¯ä»ç½å ³ã
å¦ææ¨æå ¶å®æ¯ä»ç½å ³çéæ±ï¼æè åç°æ¬é¡¹ç®ä¸éè¦æ¹è¿ç代ç ï¼æ¬¢è¿ Fork 并æ交 PRï¼
èµä¸æ¯åå¡å§
LICENSE
MIT
Top Related Projects
📦 一个 PHP 微信 SDK
可能是我用过的最优雅的 Alipay/WeChat/Unipay 的 laravel 支付扩展包了
微信 SDK for Laravel, 基于 overtrue/wechat
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot