PHP code example of saundefined / tinkoff

1. Go to this page and download the library: Download saundefined/tinkoff 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/ */

    

saundefined / tinkoff example snippets




$client = new Tinkoff\Business\OAuth\Client('client_id', 'client_secret', 'refresh_token');
$access_token = $client->renew()->getAccessToken();



$client = new Tinkoff\Business\Client('760000000000');
$client->setAccessToken('access_token');
    
$accounts = $client->accounts()->get();
$account = $accounts->current();



$client = new Tinkoff\Business\Client('760000000000');
$client->setAccessToken('access_token');

$accounts = $client->accounts()->get();
$account = $accounts->current();
    
$operations= $client->operations($account)->get();



$client = new Tinkoff\Business\Client('760000000000');
$client->setAccessToken('access_token');

$accounts = $client->accounts()->get();
$account = $accounts->current();
    
$payment = new Tinkoff\Business\Model\Payment();
$payment->setDocumentNumber('1');
$payment->setDate(new DateTime());
$payment->setAmount(100.0);

$recipient = new Tinkoff\Business\Model\Company();
$recipient->setName('ООО Ромашка');
$recipient->setInn('760000000000');
$recipient->setKpp('770000000');

$bank = new Tinkoff\Business\Model\Bank();
$bank->setAccountNumber('40101810900000000974');
$bank->setName('АО "ТИНЬКОФФ БАНК"');
$bank->setBic('044525974');
$recipient->setBank($bank);

$payment->setRecipient($recipient);
$payment->setPaymentPurpose('Тестовый платеж');
$payment->setExecutionOrder(5);
    
$document = $client->payment($account, $payment)->send();