定制 femlabs/laravel-dpo 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

femlabs/laravel-dpo

最新稳定版本:V1.0.0

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);
  1. 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.

统计信息

  • 总下载量: 32
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固