PHP code example of lennon-mudenda / omnipay-dpo

1. Go to this page and download the library: Download lennon-mudenda/omnipay-dpo 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/ */

    

lennon-mudenda / omnipay-dpo example snippets



use Omnipay\DPO\Gateway;

// Declare a transaction array here
$paymentData = [
	'testMode' => true, // You would need to switch this to false once your application goes live
	'amount' => 85,
	'paymentCurrency' => 'USD',
	'companyToken' => '', // Pass your DPO company token here.
	'serviceType' => '', // Pass your DPO product service id here.
];

$gateway = new Gateway();

$request = $gateway->purchase(
	$paymentData
);

$response = $request->send();

//  After this you can call methods on the response object.
$response->isRedirect(); // Tells you if the response will redirect us to the DPO Payments page.

$response->isSuccessful(); // Tells you if the DPO request was successful

$response->getMessage(); // Gets the DPO request message

$response->getTransactionReference(); // Gets the DPO transaction message

$response->isCancelled(); // Tells you if the transaction was cancelled or not