PHP code example of vanta / t-id-client

1. Go to this page and download the library: Download vanta/t-id-client 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/ */

    

vanta / t-id-client example snippets


use GuzzleHttp\Client;
use Vanta\Integration\TId\Infrastructure\HttpClient\ConfigurationClient;
use Vanta\Integration\TId\RestClientBuilder;

$restClientBuilder = RestClientBuilder::create(new ConfigurationClient('ваш ClientId', 'ваш ClientSecret', 'https://id.tbank.ru', 'https://business.tbank.ru'), new Client());

$restUserClient = $restClientBuilder->createUserClient();

$restDocumentClient = $restClientBuilder->createDocumentClient();

$restUserStatusClient = $restClientBuilder->createUserStatusClient();

use GuzzleHttp\Client;
use Vanta\Integration\TId\Infrastructure\HttpClient\ConfigurationClient;
use Vanta\Integration\TId\RestClientBuilder;

RestClientBuilder::create(new ConfigurationClient('ваш ClientId', 'ваш ClientSecret', 'https://id.tbank.ru', 'https://business.tbank.ru'), new Client());
    ->createAuthUrlBuilder('https://id.tbank.ru', 'ваш redirectUrl')
    ->build()
;

$pairKey = $restUserClient->getPairKeyByAuthorizationCode('get параметр code, из url-а, на который вернулся пользователь', 'ваш redirectUrl');

$restUserClient->getUser($pairKey->accessToken);

use GuzzleHttp\Client;
use Vanta\Integration\TId\Infrastructure\HttpClient\ConfigurationClient;
use Vanta\Integration\TId\RestClientBuilder;

$restDocumentClient = $restClientBuilder
    ->addMiddleware(new SandboxBusinessClientMiddleware())
    ->createDocumentClient()
;

$restUserStatusClient = $restClientBuilder
    ->addMiddleware(new SandboxBusinessClientMiddleware())
    ->createUserStatusClient()
;

$pairKey = PairKey::createSandboxPairKey();

$restDocumentClient->getAddress($pairKey->accessToken, AddressType::RESIDENCE_ADDRESS);