PHP code example of justcommunication-ru / paykeeper-sdk
1. Go to this page and download the library: Download justcommunication-ru/paykeeper-sdk 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/ */
justcommunication-ru / paykeeper-sdk example snippets
use JustCommunication\PaykeeperSDK\PaykeeperAPIClient;
$client = new PaykeeperAPIClient($url, $username, $password, $tokenHandler);
use JustCommunication\PaykeeperSDK\TokenHandler\FileTokenHandler;
$tokenHandler = new FileTokenHandler('/path/to/token.txt');
use JustCommunication\PaykeeperSDK\TokenHandler\CallbackTokenHandler;
$tokenHandler = new CallbackTokenHandler(function () use ($db) {
return $db->fetchColumn('SELECT token FROM tokens WHERE name = "paykeeper"');
}, function ($new_token) {
$db->update('UPDATE tokens SET token = :token WHERE name = "paykeeper"', [
'token' => $new_token
]);
});
use JustCommunication\PaykeeperSDK\PaykeeperAPIClient;
$client = new PaykeeperAPIClient($url, $username, $password, $tokenHandler, [
'proxy' => 'tcp://localhost:8125',
'timeout' => 6,
'connect_timeout' => 4
]);
// Http клиент с логгированием всех запросов
$stack = HandlerStack::create();
$stack->push(Middleware::log($logger, new MessageFormatter(MessageFormatter::DEBUG)));
$httpClient = new \GuzzleHttp\Client([
'handler' => $stack,
'timeout' => 6
]);
use JustCommunication\PaykeeperSDK\PaykeeperAPIClient;
$client = new PaykeeperAPIClient($url, $username, $password, $tokenHandler, $httpClient);
use JustCommunication\PaykeeperSDK\PaykeeperAPIClient;
$client = new PaykeeperAPIClient($url, $username, $password, $tokenHandler);
$client->setHttpClient($httpClient);
$client->setLogger($someLogger);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.