PHP code example of zepson / dpo-laravel

1. Go to this page and download the library: Download zepson/dpo-laravel 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-laravel 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! 😂



return [
    "company_token" => env("DPO_COMPANY_TOKEN", "9F416C11-127B-4DE2-AC7F-D5710E4C5E0A"),
    "account_type" => env("DPO_ACCOUNT_TYPE", "3854"),
    'is_test_mode' => env("DPO_IS_TEST_MODE", true),
    "back_url" => env("DPO_BACK_URL"),
    "redirect_url" => env("DPO_REDIRECT_URL")
];


$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);
sh
php artisan vendor:publish --provider="Zepson\Dpo\DpoServiceProvider" --tag="dpo-laravel-migrations"
sh
php artisan migrate