-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathaccountInfo.php
More file actions
47 lines (35 loc) · 1.77 KB
/
Copy pathaccountInfo.php
File metadata and controls
47 lines (35 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
header('Content-Type: text/html; charset=UTF-8');
/**
* Read-only account-level reference calls: balance, commissions, currency rates,
* BIN info. They authenticate with the ACCOUNT key + login — the login is a method
* argument and the key goes in the options array, overriding the project key from the
* constructor. getMethodsAvailable is project-level and uses the project key (no login).
* Note that BIN lookup lives on the payouts service, next to the SBP bank list.
* The data-changing offsetAdvance is in offsetAdvance.php.
*
* @link https://help.unitpay.ru/api/balance
* @link https://help.unitpay.ru/api/commissions
* @link https://help.unitpay.ru/api/conversion-rates
* @link https://help.unitpay.ru/api/bin_info
*/
use Unitpay\Exception\UnitpayExceptionInterface;
use Unitpay\Unitpay;
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/config.php';
$unitpay = new Unitpay($domain, $secretKey);
$accountKey = ['secretKey' => $accountSecretKey];
try {
$reference = $unitpay->reference();
// Account balance and the amount available for withdrawal.
var_dump($reference->getPartner($login, $accountKey)->result ?? null);
// Acquiring commissions for the project.
var_dump($reference->getCommissions($projectId, $login, $accountKey)->result ?? null);
var_dump($reference->getCurrencyCourses($login, $accountKey)->result ?? null);
// BIN — the first 6 digits of the card number.
var_dump($unitpay->payouts()->getBinInfo($login, 424242, $accountKey)->result ?? null);
// Payment methods available on the project: project key, no login.
var_dump($reference->getMethodsAvailable($projectId)->result ?? null);
} catch (UnitpayExceptionInterface $exception) {
print 'SDK error: ' . $exception->getMessage();
}