PHP code example of zepson / dpo-php

1. Go to this page and download the library: Download zepson/dpo-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zepson / dpo-php example snippets




use Zepson\Dpo\Dpo;

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


$order = [
    'paymentAmount' => "10000",
    'paymentCurrency' => "TZS",
    'customerFirstName' => "Novath",
    'customerLastName' => "Thomas",
    'customerAddress' => "Tanzania",
    'customerCity' => "Dodoma",
    'customerPhone' => "0752771650",
    'customerEmail' => "[email protected]",
    'companyRef' => "34TESTREFF"
];


$dpo = new Dpo;
return $dpo->directPayment($data); // this will redirect user to DPO Payment page

$token = $dpo->createToken($data); //return array of response with transaction code
//you can save or do what ever you want with the response

$dpo->getPaymentUrl($token);

return Redirect::to($payment_url);