dipnot / direct-pay-online-php
Unofficial Direct Pay Online API Wrapper
v2.1
2020-11-10 07:49 UTC
Requires
- php: >=5.6.36
- ext-curl: *
- ext-json: *
- ext-simplexml: *
README
Unofficial PHP wrapper for Direct Pay Online API
Inspired by cy6erlion/direct-pay-online
Only covers createToken
and verifyToken
services.
Dependencies
- PHP 5.6.36 or higher
- ext-curl
- ext-simplexml
- ext-json
Installation
You can install via Composer.
composer require dipnot/direct-pay-online-php
Usage
You can see the full example in examples folder.
Config
All request are needs a Config.
use Dipnot\DirectPayOnline\Config; $config = new Config(); $config->setCompanyToken("9F416C11-127B-4DE2-AC7F-D5710E4C5E0A"); $config->setTestMode(true);
Transaction
use Dipnot\DirectPayOnline\Model\Transaction; $transaction = new Transaction(100, "USD");
Service
use Dipnot\DirectPayOnline\Model\Service; $service = new Service("Test Product", 3854, "2020/02/12 11:21");
"createToken" Request
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);
"verifyToken" Request
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);
Getting the payment URL
Get the payment URL with the created token to redirect the user to the payment page.
$paymentUrl = $createTokenRequest->getPaymentUrl($createToken["TransToken"]); print_r($paymentUrl);
Test values
You can fill the personal info randomly in the payment page.