PHP code example of razor-informatics / dpo-php

1. Go to this page and download the library: Download razor-informatics/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/ */

    

razor-informatics / dpo-php example snippets


use RazorInformatics\DPOPhp;

$companyToken  = 'YOUR_COMPANY_TOKEN';

$dpo = new DPOPhp($companyToken);

$results = $dpo->account()->balance('USD')

print_r($results);

use RazorInformatics\DPOPhp;

$companyToken  = 'YOUR_COMPANY_TOKEN';

$dpo = new DPOPhp($companyToken);

$transactionToken = 'TRANSACTION_TOKEN_GIVEN';

$results = $dpo->token()->verify($transactionToken)

print_r($results);

use RazorInformatics\DPOPhp;

$companyToken  = 'YOUR_COMPANY_TOKEN';
$serviceType = 5525; //SERVICE TYPE
$paymentAmount = 500;
$reference ="INV-1000";
$cardNumber = 5436886269848367
$cardExpiry = 1224;// format My example 0123 i.e. January 2023
$cardCvv = 123;
$customerFirstName='John';
$customerLastName = 'Doe';
$customerPhone ='';
$customerEmail = '';
$currency = 'USD';
$description = 'Flight booking for 5th January 2032'

$dpo = new DPOPhp($companyToken);

$results = $dpo->payment()->card($reference,$serviceType,$paymentAmount,$cardNumber,$cardExpiry,$cardCvv, $customerFirstName,$customerLastName,$customerPhone,$customerEmail,$currency,$description)

print_r($results);

use RazorInformatics\DPOPhp;

$companyToken  = 'YOUR_COMPANY_TOKEN';
$serviceType = 5525; //SERVICE TYPE
$reference ="INV-1000";
$paymentAmount = 500;
$customerFirstName='John';
$customerLastName = 'Doe';
$customerPhone = 2547100100100;
$customerEmail = '';
$description = 'Flight booking for 5th January 2032'

$dpo = new DPOPhp($companyToken);

$results = $dpo->payment()->chargeMpesa($reference,$serviceType,$paymentAmount, $customerFirstName,$customerLastName,$customerPhone,$customerEmail,$description)

print_r($results);
bash
composer