-
Notifications
You must be signed in to change notification settings - Fork 6
/
getAccountBalance.php
39 lines (32 loc) · 1 KB
/
getAccountBalance.php
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
<?php
/**
* Detailed endpoint documentation
* https://dev.efipay.com.br/docs/api-pix/endpoints-exclusivos-efi#buscar-o-saldo-da-conta
*/
$autoload = realpath(__DIR__ . "/../../../vendor/autoload.php");
if (!file_exists($autoload)) {
die("Autoload file not found or on path <code>$autoload</code>.");
}
require_once $autoload;
use Efi\Exception\EfiException;
use Efi\EfiPay;
$optionsFile = __DIR__ . "/../../credentials/options.php";
if (!file_exists($optionsFile)) {
die("Options file not found or on path <code>$options</code>.");
}
$options = include $optionsFile;
$params = [
"bloqueios" => true
];
try {
$api = new EfiPay($options);
$response = $api->getAccountBalance($params);
print_r("<pre>" . json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "</pre>");
} catch (EfiException $e) {
print_r($e->code . "<br>");
print_r($e->error . "<br>");
print_r($e->errorDescription) . "<br>";
} catch (Exception $e) {
echo "<br><br>";
print_r($e->getMessage());
}