PHP code example of lee-to / php-tochka-api-sdk

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

    

lee-to / php-tochka-api-sdk example snippets


use TochkaApi\TochkaApi;
use TochkaApi\HttpAdapters\CurlHttpClient;


$tochkaApi = new TochkaApi("client_id", "client_secret", new CurlHttpClient);
//Для установки JWT токена
//$tochkaApi->setAccessToken("");

// Урл для авторизации, после подтверждения вернет $_GET["code"] на redirect_uri
$tochkaApi->getAuthorizeUrl();

//Вернет объект AccessToken для $tochkaApi->setAccessToken("");
$tochkaApi->token($_GET["code"]);
 php
$tochkaApi->organization()->list()
 php
$tochkaApi->account()->list()
 php
$tochkaApi->statement()->create(array $parameters);
 php
$tochkaApi->statement()->status($request_id);
 php
$tochkaApi->statement()->result($request_id);
 php
$tochkaApi->payment()->create(array $parameters);
 php
$tochkaApi->payment()->status($request_id);
 php
$tochkaApi->salary()->employeeList($customer_code);
 php
$tochkaApi->salary()->result($request_id);
 php
$tochkaApi->salary()->employeeAdd($customer_code, array $employees);
 php
$tochkaApi->salary()->payrollCreate(array $customer, array $payments, $payment_period_start_date, $payment_period_end_date, $purpose_id);
 php
$tochkaApi->salary()->purposes();