https://github.com/dipnot/direct-pay-online-php
Unofficial PHP wrapper for Direct Pay Online API
https://github.com/dipnot/direct-pay-online-php
api composer direct-pay-online dpo payment-system php-library
Last synced: 5 months ago
JSON representation
Unofficial PHP wrapper for Direct Pay Online API
- Host: GitHub
- URL: https://github.com/dipnot/direct-pay-online-php
- Owner: dipnot
- License: mit
- Created: 2020-11-06T08:08:45.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-03-30T06:49:29.000Z (about 4 years ago)
- Last Synced: 2025-11-06T11:17:29.603Z (7 months ago)
- Topics: api, composer, direct-pay-online, dpo, payment-system, php-library
- Language: PHP
- Homepage:
- Size: 48.8 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Direct Pay Online API Wrapper for PHP
[](https://packagist.org/packages/dipnot/direct-pay-online-php)
[](https://packagist.org/packages/dipnot/direct-pay-online-php)
Unofficial PHP wrapper for [Direct Pay Online API](https://directpayonline.atlassian.net/wiki/spaces/API/overview)
Inspired by [cy6erlion/direct-pay-online](https://github.com/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](https://getcomposer.org/).
composer require dipnot/direct-pay-online-php
## Usage
You can see the full example in [examples](https://github.com/dipnot/direct-pay-online-php/tree/main/examples) folder.
### Config
All request are needs a Config.
```php
use Dipnot\DirectPayOnline\Config;
$config = new Config();
$config->setCompanyToken("9F416C11-127B-4DE2-AC7F-D5710E4C5E0A");
$config->setTestMode(true);
```
### Transaction
```php
use Dipnot\DirectPayOnline\Model\Transaction;
$transaction = new Transaction(100, "USD");
```
### Service
```php
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.
```php
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.
```php
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.
```php
$paymentUrl = $createTokenRequest->getPaymentUrl($createToken["TransToken"]);
print_r($paymentUrl);
```
## Test values
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|
## License
[](https://github.com/dipnot/direct-pay-online-php/blob/main/LICENSE)