Unofficial PHP wrapper for Direct Pay Online API
Inspired by cy6erlion/direct-pay-online
Only covers createToken
and verifyToken
services.
- PHP 5.6.36 or higher
- ext-curl
- ext-simplexml
- ext-json
You can install via Composer.
composer require dipnot/direct-pay-online-php
You can see the full example in examples folder.
All request are needs a Config.
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");
Create a token to start payment process.
use Dipnot\DirectPayOnline\Request\CreateTokenRequest;
$createTokenRequest = new CreateTokenRequest($config);
$createTokenRequest->setTransaction($transaction);
$createTokenRequest->addService($service1);
$createTokenRequest->addService($service2);
$createToken = $createTokenRequest->execute();
print_r($createToken);
Get the payment result by using VerifyTokenRequest.
use Dipnot\DirectPayOnline\Request\VerifyTokenRequest;
$verifyTokenRequest = new VerifyTokenRequest($config);
$verifyTokenRequest->setTransactionToken($_GET["TransactionToken"]);
$verifyToken = $verifyTokenRequest->execute();
print_r($verifyToken);
Get the payment URL with the created token to redirect the user to the payment page.
$paymentUrl = $createTokenRequest->getPaymentUrl($createToken["TransToken"]);
print_r($paymentUrl);
You can fill the personal info randomly in the payment page.
Value | |
---|---|
Company token | 9F416C11-127B-4DE2-AC7F-D5710E4C5E0A |
Card number | 5436886269848367 |
Card expiry date (Month/Year) | 12/22 |
Card CVV | 123 |