PHP code example of kagatan / privatbank-autoclient
1. Go to this page and download the library: Download kagatan/privatbank-autoclient 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/ */
kagatan / privatbank-autoclient example snippets
use Kagatan\PrivatbankAutoClient\ClientAPI;
$id = '0a550a93-XXX-XXXX-XXXX-1f345gtty56ac53';
$token = 'your_token';
// bank account
$acc = '123546788';
// time ts (~ previous 3 day)
$startDate = time() - 3600 * 24 * 3;
// time ts
$endDate = time();
$client = new ClientAPI($id, $token);
// Get lastday transactions
$transactions = $Client->getLastdayTransactions($acc);
var_dump($transactions);
// Get today transactions
$transactions = $Client->getTodayTransactions(acc);
var_dump($transactions);
// Get previous transactions
$transactions = $client->getPreviousTransactions($acc, $startDate, $endDate);
var_dump($transactions);
foreach ($transactions AS $transaction) {
$transaction = array_shift($transaction);
// Если платеж проведен и нашли инвойс
if (isset($transaction['BPL_PR_PR']) AND $transaction['BPL_PR_PR'] == 'r') {
//
}
}