PHP code example of perlur / php-fio-api

1. Go to this page and download the library: Download perlur/php-fio-api 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/ */

    

perlur / php-fio-api example snippets



nloader = new FioApi\Downloader('TOKEN@todo');
$transactionList = $downloader->downloadSince(new \DateTime('-1 week'));

foreach ($transactionList->getTransactions() as $transaction) {
    var_dump($transaction); //object with getters
}



en = get_your_fio_token();
$uploader = new FioApi\Uploader($token);
// currency, iban, bic is not needed
$account = new FioApi\Account('XXXXXXXXXX', 'ZZZZ', NULL, NULL, NULL);
$tx = Transaction::create((object) [
    'accountNumber' => 'YYYYYYYYYY',
    'bankCode' => 'WWWW',
    'date' => new \DateTime('2016-07-20'),
    'amount' => 6.66,
    'currency' => 'CZK',
    'userMessage' => 'money wasting',
    'comment' => 'fioapi.test'
]);

$builder = new FioApi\DomesticPaymentBuilder();
$request = $builder->build($account, [$tx]);
$response = $uploader->sendRequest($request);

echo $response->getStatus();


en = get_your_fio_token();
$uploader = new FioApi\Uploader($token);
$account = new FioApi\Account('XXXXXXXXXX', 'YYYY', null, null, null);
$tx = FioApi\Transaction::create((object) [
    'accountNumber' => 'XXXXXXXXXXXXXXXX',
    'bankCode'      => 'WWWWWWWWWW',
    'date'          => new DateTime('2016-05-30'),
    'amount'        => 66.5,
    'currency'      => 'EUR',
    'userMessage'   => 'Donation for poor ones',
    'comment'       => 'fioapi.test',
    'benefName'     => 'Something Finland Oy',
    'benefCountry'  => 'FI',
]);

$builder = new FioApi\EuroPaymentBuilder();
$request = $builder->build($account, [$tx]);
$response = $uploader->sendRequest($request);

echo $response->getStatus();
echo "\n";


en = get_your_fio_token();
$uploader = new FioApi\Uploader($token);
$account = new FioApi\Account('XXXXXXXXXX', 'YYYY', null, null, null);
$tx = FioApi\Transaction::create((object) [
    'accountNumber' => 'XXXXXXXXXXXXXXXX',
    'bankCode'      => 'WWWWWWWWWW',
    'date'          => new DateTime('2016-05-30'),
    'amount'        => 2,
    'currency'      => 'USD',
    'userMessage'   => 'Donation for homelesses at 6th Street',
    'comment'       => 'fioapi.test',
    'benefName'     => 'John Doe',
    'benefStreet'   => '6th Street',
    'benefCity'     => 'San Francisco, CA',
    'benefCountry'  => 'US',
]);

$builder = new FioApi\InternationalPaymentBuilder();
$request = $builder->build($account, [$tx]);
$response = $uploader->sendRequest($request);

echo $response->getStatus();
echo "\n";