### Install Tochka API PHP SDK Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Installs the Tochka API v2 client for PHP using Composer. This is the primary method for adding the SDK to your PHP project. ```sh composer require lee-to/php-tochka-api-v2-sdk ``` -------------------------------- ### Get Customer List Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Fetches a list of all available customers accessible via the Open Banking API. This is a simple retrieval method with no specific parameters required. ```PHP $tochkaApi->customer()->all() ``` -------------------------------- ### Get Card Limits Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Retrieves current limits for a specific Tochka card. Requires the card's GUID and the customer's unique code, with support for additional query parameters. ```PHP $tochkaApi->card($cardCode, $customerCode)->limits($query) ``` -------------------------------- ### Tochka API v2 Balances Operations Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Provides a method to fetch balance information across multiple accounts simultaneously. This is useful for getting a consolidated view of financial positions. ```APIDOC Balances: get_balances_list_open_banking__apiVersion__balances_get: description: Retrieves balance information for multiple accounts. method: GET path: /open-banking/{apiVersion}/balances returns: 200 OK: Array of balance objects for multiple accounts. example: $tochkaApi->balance()->all() ``` -------------------------------- ### Get Customer Info Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Retrieves detailed information for a specific customer using their unique customer code. This method allows fetching individual customer data. ```PHP $tochkaApi->customer($customerCode)->get() ``` -------------------------------- ### Tochka API v2 Accounts Operations Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Details methods for interacting with account-related endpoints in the Tochka API v2. This includes fetching a list of available accounts, retrieving information for a specific account, and getting balance details for an account. ```APIDOC Accounts: get_accounts_list_open_banking__apiVersion__accounts_get: description: Retrieves a list of all available accounts for the authenticated user. method: GET path: /open-banking/{apiVersion}/accounts returns: 200 OK: Array of account objects. example: $tochkaApi->account()->all() get_account_info_open_banking__apiVersion__accounts__accountId__get: description: Retrieves detailed information for a specific account. method: GET path: /open-banking/{apiVersion}/accounts/{accountId} parameters: accountId (string, required): The unique and immutable identifier of the account. returns: 200 OK: Account information object. example: $tochkaApi->account($accountId)->get() get_balance_info_open_banking__apiVersion__accounts__accountId__balances_get: description: Retrieves the balance information for a specific account. method: GET path: /open-banking/{apiVersion}/accounts/{accountId}/balances parameters: accountId (string, required): The identifier of the account. returns: 200 OK: Balance information object. example: $tochkaApi->account($accountID)->balances() ``` -------------------------------- ### Get Payment Status Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Retrieves the current status of a payment using its unique request ID. This is essential for tracking payment processing. ```PHP $tochkaApi->payment($requestId)->get() ``` -------------------------------- ### Edit Card State Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Changes the state of a Tochka card. This method requires the card's GUID, the customer's unique code, and request body data specifying the new state. ```PHP $tochkaApi->card($cardCode, $customerCode)->state($data) ``` -------------------------------- ### PHP SDK Initialization and Usage Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Demonstrates how to import necessary classes, initialize the Tochka API client with credentials, and perform basic OAuth2 authorization flow. It covers obtaining an authorization URL, handling the redirect with a code, and exchanging it for an access token. ```php use TochkaApi\Client; use TochkaApi\HttpAdapters\CurlHttpClient; // Initialize the client with your application credentials $tochkaApi = new \TochkaApi\Client("client_id", "client_secret", "redirect_uri", new CurlHttpClient); // Get the authorization URL for user consent $authorizeUrl = $tochkaApi->authorize(); header("Location: {$authorizeUrl}"); exit( ); // After redirect, exchange the received 'code' for an access token // $accessToken = $client->token($_GET["code"]); // $tochkaApi->setAccessToken($accessToken); // Check if the token has expired (requires timestamp of token creation) // if($tochkaApi->isExpired($createdTimestamp)) { // // Handle token refresh or re-authentication // } ``` -------------------------------- ### Create Payment Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Creates a payment, with an option to prepare it for signing. It accepts payment data and a boolean flag to indicate if it's for signing. Returns a redirect URL for unsigned payments. ```PHP $tochkaApi->payment()->create($data, $forSign = true) ``` -------------------------------- ### Payment Processing API Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Handles payment creation, signing, and status retrieval. Supports creating payments for direct processing or for subsequent signing, and querying payment status via request ID. ```APIDOC Operation: create_payment_for_sign_payment__apiVersion__for_sign_post Description: Методы создания и подписания платежа (forSign = true) URL: /payment/{apiVersion}/for_sign Method: POST Parameters: - Path: apiVersion (string, required) - Body: data (object, required) - Request Body согласно документации Returns: 200 OK - Payment created for signing Operation: create_payment_payment__apiVersion__order_post Description: Методы создания и подписания платежа (forSign = false) URL: /payment/{apiVersion}/order Method: POST Parameters: - Path: apiVersion (string, required) - Body: data (object, required) - Request Body согласно документации Returns: 200 OK - Payment created, returns redirectURL if unsigned Example Response Data: { "Data": { "requestId": "openapi-b96d770e-769f-49ce-9630-890e00d47720", "redirectURL": "https://enter.tochka.com/payment/?requestId=openapi-b96d770e-769f-49ce-9630-890e00d47720&clientId=ВАШ_КЛИЕНТ_ID" } } Operation: get_payment_status_payment__apiVersion__status__requestId__get Description: Метод получения статуса платежа URL: /payment/{apiVersion}/status/{requestId} Method: GET Parameters: - Path: apiVersion (string, required) - Path: requestId (string, required) - Идентификатор запроса (платежа) Returns: 200 OK - Payment status information ``` -------------------------------- ### Customer Management API Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Endpoints for managing customer data, including listing all customers and retrieving details for a specific customer. Utilizes Open Banking API specifications. ```APIDOC Operation: get_customers_list_open_banking__apiVersion__customers_get Description: Метод получения списка доступных клиентов URL: /open-banking/{apiVersion}/customers Method: GET Parameters: - Path: apiVersion (string, required) Returns: 200 OK - List of customers Operation: get_customer_info_open_banking__apiVersion__customers__customerCode__get Description: Метод получения информации по конкретному клиенту URL: /open-banking/{apiVersion}/customers/{customerCode} Method: GET Parameters: - Path: apiVersion (string, required) - Path: customerCode (string, required) - Уникальный код клиента Returns: 200 OK - Customer information ``` -------------------------------- ### Tochka API v2 Statements Operations Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Covers methods for managing bank statements via the Tochka API v2. This includes fetching a list of available statements and initiating the creation of a new statement for a specific account. ```APIDOC Statements: get_statements_list_open_banking__apiVersion__statements_get: description: Retrieves a list of all available statements. method: GET path: /open-banking/{apiVersion}/statements returns: 200 OK: Array of statement objects. example: $tochkaApi->statement()->all() init_statement_open_banking__apiVersion__statements_post: description: Initiates the creation of a bank statement for a specific account. method: POST path: /open-banking/{apiVersion}/statements parameters: data (object, required): Request Body containing statement generation parameters (e.g., accountId, date range). returns: 200 OK: Statement creation confirmation. example: $tochkaApi->statement()->create($data) ``` -------------------------------- ### Card Management API Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Provides endpoints for managing Tochka cards, including retrieving limits and changing card states. Requires specific card and customer identifiers. ```APIDOC Operation: get_card_limits_card__apiVersion__card__cardCode__limits_get Description: Показывает действующие лимиты по карте URL: /card/{apiVersion}/card/{cardCode}/limits Method: GET Parameters: - Path: cardCode (string, required) - GUID карты в ПЦ Точки - Path: apiVersion (string, required) - Query: customerCode (string, required) - Уникальный код клиента - Query: query (object, optional) - Query parameters согласно документации Returns: 200 OK - Card limits information Operation: edit_card_state_card__apiVersion__card__cardCode__state_post Description: Метод смены состояния карты URL: /card/{apiVersion}/card/{cardCode}/state Method: POST Parameters: - Path: cardCode (string, required) - GUID карты в ПЦ Точки - Path: apiVersion (string, required) - Query: customerCode (string, required) - Уникальный код клиента - Body: data (object, required) - Request Body согласно документации Returns: 200 OK - Card state updated ``` -------------------------------- ### Tochka API v2 Cards Operations Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Details methods for managing bank cards via the Tochka API v2. This includes fetching a list of cards, updating card details, and closing/deactivating cards. ```APIDOC Cards: get_cards_card__api_version__card_get: description: Retrieves a list of cards associated with a customer. method: GET path: /card/{api_version}/card parameters: cardCode (string, required): The GUID of the card in the Tochka processing center. customerCode (string, required): The unique code of the customer. returns: 200 OK: Array of card objects. example: $tochkaApi->card($cardCode, $customerCode)->all() edit_card_card__apiVersion__card__cardCode__post: description: Updates the details of a specific bank card. method: POST path: /card/{apiVersion}/card/{cardCode} parameters: cardCode (string, required): The GUID of the card in the Tochka processing center. customerCode (string, required): The unique code of the customer. data (object, required): Request Body containing the updated card details. returns: 200 OK: Card update confirmation. example: $tochkaApi->card($cardCode, $customerCode)->update($data) delete_card_card__apiVersion__card__cardCode__delete: description: Closes or deactivates a specific bank card. method: DELETE path: /card/{apiVersion}/card/{cardCode} parameters: cardCode (string, required): The GUID of the card in the Tochka processing center. customerCode (string, required): The unique code of the customer. returns: 200 OK: Card deletion confirmation. example: $tochkaApi->card($cardCode, $customerCode)->delete() ``` -------------------------------- ### Token Refresh and Management Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Provides methods for refreshing the access token using a refresh token and checking the expiration status of the current access token. This is crucial for maintaining continuous API access. ```php // Refresh the access token using a refresh token // $client->refreshToken(string $refresh_token); // Set custom scopes for the client // $tochkaApi->setScopes(string $scopes); // Set custom permissions for the client // $tochkaApi->setPermissions(array $permissions); ``` -------------------------------- ### Custom API Request Endpoint Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Allows making arbitrary HTTP requests to the Tochka API, useful for endpoints not yet covered by the SDK. Supports specifying HTTP method, URL, and request body. ```APIDOC Operation: custom_request Description: Выполнение произвольного запроса к API URL: {url} (dynamic) Method: {method} (GET|POST|DELETE|UPDATE|PUT) Parameters: - Query: method (string, required) - HTTP method (e.g., GET, POST) - Query: url (string, required) - Full API URL (e.g., https://enter.tochka.com/uapi/sbp/v1.0/merchant/MF0000000001) - Body: data (object, optional) - Request Body - Header: customer-code (string, optional) - If customer-code is required in header Returns: Varies based on the executed request ``` -------------------------------- ### Tochka API v2 Account Statement Details Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Details the method for retrieving specific bank statement details for a given account and statement ID. This allows users to fetch historical financial records. ```APIDOC Account Statements: get_statement_open_banking__apiVersion__accounts__accountId__statements__statementId__get: description: Retrieves the details of a specific bank statement for a given account. method: GET path: /open-banking/{apiVersion}/accounts/{accountId}/statements/{statementId} parameters: accountId (string, required): The identifier of the account. statementId (string, required): The identifier of the statement. returns: 200 OK: Statement details object. example: $tochkaApi->account($accountID)->statement($statementId) ``` -------------------------------- ### Custom API Request Source: https://github.com/lee-to/php-tochka-api-v2-sdk/blob/master/README.md Executes a custom request to the Tochka API for methods not directly supported by the SDK, such as SBP endpoints. Supports various HTTP methods and optional request bodies. ```PHP $tochkaApi->custom()->request($method, $url, $data = []) ``` ```PHP $tochkaApi->custom(null, $customerCode)->request($method, $url, $data = []) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.