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

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

    

dipnot / direct-pay-online-php example snippets

  
use Dipnot\DirectPayOnline\Config;

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

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

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

$createTokenRequest = new CreateTokenRequest($config);  
$createTokenRequest->setTransaction($transaction);  
$createTokenRequest->addService($service1);
$createTokenRequest->addService($service2);
$createToken = $createTokenRequest->execute();  
print_r($createToken);  
  
use Dipnot\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);