femlabs/laravel-dpo
Composer 安装命令:
composer require femlabs/laravel-dpo
包简介
Package to make online payment using DPO Group
README 文档
README
Femlabs DPO package will help you add DPO Payment API to your Laravel Application in easy way and simple.
How the package work
1. Create payment token
2. Verify payment token
3. Redirect to payment page
4. Fetch response
Installation
composer require femlabs/laravel-dpo
Publish the required file
php artisan vendor:publish --provider="Femlabs\Dpo\DpoServiceProvider"
Run Migration
php artisan migrate
Environment variables
DPO_COMPANY_TOKEN ="9F416C11-127B-4DE2-AC7F-D5710E4C5E0A"
DPO_SERVICE_TYPE = "3854"
DPO_SERVICE_DESCRIPTION = "Test Product"
DPO_LIVE_MODE = true
DPO_DEFAULT_CURRENCY = "TZS"
DPO_DEFAULT_COUNTRY = "Tanzania"
DPO_BACK_URL ="/cancel"
DPO_REDIRECT_URL = "/callback"
Usage
use the below dependancy in your controller
use Femlabs\Dpo\Dpo;
How the package work
=> Create array data of your order in the controller
$data['companyRef'] = 'ORD' . '' . time(); //$params['invoiceid']; (On this line you can put uniq id of your service)
$data['paymentAmount'] = 100;
$data['customerFirstName'] = 'Filbert';
$data['customerLastName'] = 'Msaki';
$data['customerAddress'] = 'Ubungo Kibangu';
$data['customerCity'] = 'Dar Es Salaam';
$data['customerPhone'] = '07********';
$data['customerEmail'] = 'filymsaki@gmail.com';
$data['customerCountry'] = 'TZ'; //ISO 2 letter code
$data['customerZip'] = '0000';
$data['serviceDescription'] = 'Test Order';
=> Call the DPO function
$dpo =new Dpo();
You can choose either to save the response in the database or to make direct payment in the DPO package
=> Go Direct to DPO payment page
return $dpo->directPaymentPage($data);
=> If you preffer to save details the follow the steps below.
1.Create payment token first and the redirect to payment page
$token = $dpo->createToken($data);
-
Check token response and save to database
if ($token['success'] === true) { $data['TransToken'] = $token['TransToken']; //Here you can save token details to database $verify = $dpo->verifyToken($data); if ($verify['success'] === true) { //Here you can save token details and verified data to database //Get payment url $payment_url = $dpo->getPaymentUrl($token); //redirect to payment page return redirect()->$payment_url; } }
License
This project is licensed under the MIT license.
femlabs/laravel-dpo 适用场景与选型建议
femlabs/laravel-dpo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 32 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 09 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 femlabs/laravel-dpo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 femlabs/laravel-dpo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 32
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-09-17