1. Go to this page and download the library: Download digitalvirgo/directpay 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/ */
digitalvirgo / directpay example snippets
use DigitalVirgo\DirectPay\Service\Client;
$client = new Client();
use DigitalVirgo\DirectPay\Service\Client;
$options = [
'timeout' => 10,
]
$client = new Client(Client::DP_V2_BASE_URL, $options);
$orderGetResponse = $client->orderGetRequest([
'orderId' => $orderNewResponse->getOrderId()
]);
if ($orderGetResponse->getError()) {
throw new \Exception("Unable to get order: {$orderGetResponse->getError()} {$orderGetResponse->getErrorDescription()}");
}
var_dump($orderGetResponse->getOrder()->getOrderId());
var_dump($orderGetResponse->getOrder()->getOrderStatus());
$body = file_get_contents('php://input');
//if you can't receive this notification throw some error.
// if everything is ok return status 200;
$orderNotifyRequest = OrderNotifyRequest::fromXml($body);
$response = new OrderNotifyResponse([
'order' => $orderNotifyRequest->getOrder(),
'updateDate' => new DateTimeImmutable(),
]);
print ($response->toXml());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.