zepson/dpo-php

A simple package to add DPO API to your laravel application and make payment processing much easy

1.0.0 2021-10-21 01:17 UTC

This package is auto-updated.

Last update: 2024-04-11 11:08:14 UTC


README

The best DPO php package, simple Ever

Build Status

This is the package that will help you add DPO Payment API to your PHP Application, We are open to contribution and support to make it better.

Features

  • Create Payment Token (Initiate order at DPO servers)
  • Verify Payment Token (Check Transaction status)
  • Make Direct payment(Redirects order direct to DPO payment page)
  • Fetch Payment Token
  • Database migrations to save transaction details
  • Much easy to use
  • Constantly updated

How It works

  1. Create Payment token
  2. Verify token
  3. Redirect to DPO payment page
  4. Fetch response
  5. Done

The package does all this for you behind the scenes 😂

Basic Usage Example.

<?php

use Zepson\Dpo\Dpo;

$dpo = new Dpo();
$order = [
    'paymentAmount' => "10000",
    'paymentCurrency' => "TZS",
    'customerFirstName' => "Novath",
    'customerLastName' => "Thomas",
    'customerAddress' => "Tanzania",
    'customerCity' => "Dodoma",
    'customerPhone' => "0752771650",
    'customerEmail' => "novath@zepson.co.tz",
    'companyRef' => "34TESTREFF"
];
// Now make  payment
$dpo->directPayment($data);
// Its done! Simple right! 😂

Installation

Install the package Via Composer

composer require zepson/dpo-php

Requirements

  • PHP: "7.4|^8.0"

USAGE

  • create array of your order which match parrameters in the following exaple
$order = [
    'paymentAmount' => "10000",
    'paymentCurrency' => "TZS",
    'customerFirstName' => "Novath",
    'customerLastName' => "Thomas",
    'customerAddress' => "Tanzania",
    'customerCity' => "Dodoma",
    'customerPhone' => "0752771650",
    'customerEmail' => "novath@zepson.co.tz",
    'companyRef' => "34TESTREFF"
];
  • Now you can choose to make direct payment or createToken First and then make payment
  • Starting with Direct Payment
$dpo = new Dpo;
return $dpo->directPayment($data); // this will redirect user to DPO Payment page
  • If you preffer to save details then this is the ideal step to follow [Generate Token, Make payment]
  • Get Token
$token = $dpo->createToken($data); //return array of response with transaction code
//you can save or do what ever you want with the response
  • Get payment Url
$dpo->getPaymentUrl($token);
  • Redirect User to payment page
return Redirect::to($payment_url);

As [Novath Thomas] always says

There is a huge difference between sysem security and complications, Complication hurts, API should'nt be complicated Thats one of the primary AIM of the introduction of APIs

We would like more contributions to make the package more secure and readable.

License

This project is licensed under the MIT license.