tltc / momovn
此包的最新版本(1.0.3)没有可用的许可证信息。
1.0.3
2019-07-18 16:21 UTC
Requires
- ixudra/curl: ^6.16
This package is not auto-updated.
Last update: 2024-09-21 08:45:52 UTC
README
关于Tltc/Momovn
Momo是越南最受欢迎的支付网关之一。此包可以帮助开发者轻松连接到其API。
安装
composer require tltc/momovn
需求
"ixudra/curl": "^6.16"
支持
Laravel/ Lumen 5.7.*
配置
公共配置文件
php artisan vendor:publish --tag=config
配置值包括
PARTNER_CODE: partner code of Momo Account
SECRET_KEY: Key using to generate signature
ACCESS_KEY: Key using to authen when call API
API_END_POINT: api route (/gw_payment/transactionProcessor)
DOMAIN: Momo url - change it to sandbox url in local/develop env
使用它
将此行添加到config/app.php中的provider列表
\Tltc\Momovn\Providers\MomovnServiceProvider::class,
示例代码
$momoService = new MomovnService(); $orderId = 'M'.rand(1, 20000); $amount = (string)rand(1000000, 2000000); $orderInfo = "Momo API testing"; $requestId = 'M'.rand(1,200000); $returnUrl = route('home'); $notifyUrl = route('home'); $extraData = "merchantName=;merchantId="; $response = $momoService->requestMomoPayment($requestId, $amount, $orderId, $orderInfo, $returnUrl, $notifyUrl, $extraData); if ($response && !empty($response->payUrl)) { return redirect($response->payUrl); // Redirect to Momo payment } else { dd($response); // Check error code in Momo document }
Momo API文档
许可证
此包是开源软件,根据MIT许可证授权。