B
B
bastian192018-08-04 22:25:32
PHP
bastian19, 2018-08-04 22:25:32

Find out the balance of the QIWI API wallet?

I connected this class to work https://github.com/Shnapik/Qiwi-Api-Class-PHP
So, the essence of the matter.
Using the getBalance() method I get the following:
5b65fe08170fd242188156.png
Here is the method code:

public function getBalance() {
        return $this->sendRequest('funding-sources/v2/persons/' . $this->_phone . '/accounts');
    }

Everything corresponds to what is written in the documentation
spoiler
5b65fe15a1b7c197911507.png

But how can I get only the value of the balance of the wallet, without all the extra stuff. That is, only balance.amount

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Y
Yan-s, 2018-08-04
@Yan-s

Do php.net/manual/ru/function.json-decode.php you get a structure from which you take what you need

O
onezarabotok, 2021-05-20
@onezarabotok

echo $array['accounts'][0]['balance']['amount'];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question