PHP code example of radioafricagroup / direct-pay-online-php

1. Go to this page and download the library: Download radioafricagroup/direct-pay-online-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/ */

    

radioafricagroup / direct-pay-online-php example snippets

  
use Rag\DirectPayOnline\Config;

$config = new Config();  
$config->setCompanyToken("9F416C11-127B-4DE2-AC7F-D5710E4C5E0A");  
$config->setTestMode(true);
  
use Rag\DirectPayOnline\Model\Transaction;

$transaction = new Transaction(100, "USD");
  
use Rag\DirectPayOnline\Model\Service;

$service = new Service("Test Product", 3854, "2020/02/12 11:21");
  
use Rag\DirectPayOnline\Request\CreateTokenRequest;

$createTokenRequest = new CreateTokenRequest($config);  
$createTokenRequest->setTransaction($transaction);  
$createTokenRequest->addService($service1);
$createTokenRequest->addService($service2);
$createToken = $createTokenRequest->execute();  
print_r($createToken);  
  
use Rag\DirectPayOnline\Request\VerifyTokenRequest;

$verifyTokenRequest = new VerifyTokenRequest($config);
$verifyTokenRequest->setTransactionToken($_GET["TransactionToken"]);
$verifyToken = $verifyTokenRequest->execute();
print_r($verifyToken);
  
$paymentUrl = $createTokenRequest->getPaymentUrl($createToken["TransToken"]);  
print_r($paymentUrl);
  
$getSubscriptionTokenRequest = new GetSubscriptionTokenRequest($config);
$getSubscriptionTokenRequest->setSearchCriteria($searchCriteriaSearch);  
$getSubscriptionTokenRequest->setSearchCriteriaValue($searchCriteriaSearchValue);  
$getSubscriptionToken = $getSubscriptionTokenRequest->execute();  
print_r($getSubscriptionToken);