tjmugova/laravel-dpo
为Laravel提供DPO支付集成
1.0.3
2022-09-17 07:41 UTC
Requires
- php: >=7.4|^8.0
- illuminate/events: ^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0
- illuminate/notifications: ^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0
- illuminate/queue: ^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0
- illuminate/support: ^5.8 || ^6.0 || ^7.0 || ^8.0 || ^9.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-14 08:36:56 UTC
README
一个laravel包,用于将DPO支付网关API集成到您的应用程序中。
安装 🚀
将包添加到您的composer.json文件中
"require": {
...
"tjmugova/laravel-dpo": "{version}"
},
或者直接运行composer require
$ composer require tjmugova/laravel-dpo
配置
在.env文件中添加您的DPO令牌、支付URL、API URL和货币
DPO_API_URL=https://secure.3gdirectpay.com/API/v6/ # always required DPO_PAYMENT_URL=https://secure.3gdirectpay.com/payv2.php # always required DPO_TOKEN=57466282-EBD7-4ED5-B699-8659330A6996 # always required DPO_SERVICE_ID=1234
高级配置
运行php artisan vendor:publish --provider="Tjmugova\Dpo\DpoProvider"
/config/dpo.php
用法 ✅
有关完整文档,请参阅DPO公共API文档
创建令牌
use Tjmugova\Dpo\Facades\Dpo;
...
$token=Dpo::token();
$token->addService([
'serviceType' => 1111,
'serviceDescription' => 'Invoice',
'serviceDate' => \Carbon\Carbon::now()->format("Y/m/d h:i"),
]);
$response = $token->createToken([
'paymentAmount' => 200,
'customerFirstName' => 'Test',
'companyRef' => '15',
'paymentCurrency' => 'USD',
'redirectURL' => 'https://example.com',
'backURL' => 'https://example.com',
]);
令牌请求成功后重定向
return redirect($response['RedirectURL']);
验证令牌
您可以使用DPO API文档中指定的各种参数验证收到的令牌。
$token->verifyToken([ 'transToken' => $response['transToken'], ]);
注意
如果您发现任何错误或者有想法可以改进此项目,请毫不犹豫地创建一个pull request。
如果您觉得这个包很有帮助,一个简单的star也是十分感激的。
MIT许可证