### Install Dependencies and Run Development Commands Source: https://github.com/onreza/tochka-sdk-ts/blob/main/README.md Use these commands to set up the project and manage its development lifecycle. Ensure you have Bun installed. ```bash bun install ``` ```bash bun run gen # генерация типов из specs/openapi.json ``` ```bash bun run build # сборка пакета ``` ```bash bun test # unit тесты ``` ```bash bun run lint # biome ``` ```bash bun run typecheck # tsc --noEmit ``` -------------------------------- ### Install @onreza/tochka-sdk Source: https://github.com/onreza/tochka-sdk-ts/blob/main/README.md Install the SDK using npm or bun. ```bash npm i @onreza/tochka-sdk # или bun add @onreza/tochka-sdk ``` -------------------------------- ### Install Dependencies and Run Scripts Source: https://github.com/onreza/tochka-sdk-ts/blob/main/CONTRIBUTING.md Install project dependencies and run development scripts using Bun. This includes setting up Git hooks, generating types, building the package, running tests, linting, and type checking. ```bash bun install # + ставит git hooks через lefthook bun run gen # генерация типов из specs/openapi.json bun run build # сборка пакета bun test # unit-тесты bun run lint # biome bun run typecheck # tsc --noEmit ``` -------------------------------- ### Quick Start: Sandbox Mode Source: https://github.com/onreza/tochka-sdk-ts/blob/main/README.md Use the sandbox mode for testing API interactions without affecting live data. Example shows registering SBP QR codes. ```typescript const client = TochkaClient.sandbox(); await client.sbp.qrCodes.register(merchantId, accountId, { ... }); ``` -------------------------------- ### Acquiring Internet Payment Webhook Payload Example Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/opisanie-metodov-vebhuki.md This example shows the webhook payload for the 'acquiringInternetPayment' event when a payment is made via 'Dolyame'. It contains similar fields to the general Dolyame payment but is specific to this event type. ```json eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJjdXN0b21lckNvZGUiOiAiMzAwMTIzMTIzIiwgImFtb3VudCI6ICIwLjMzIiwgInBheW1lbnRUeXBlIjogImRvbHlhbWUiLCAib3BlcmF0aW9uSWQiOiAiYmVlYWM4YTQtNjA0Ny0zZjM4LTg5MjItYTY2NGU2YjVjNDNiIiwgInB1cnBvc2UiOiAiXHUwNDFlXHUwNDNmXHUwNDNiXHUwNDMwXHUwNDQyXHUwNDMwIFx1MDQzZlx1MDQzZSBcdTA0NDFcdTA0NDdcdTA0MzVcdTA0NDJcdTA0NDMgXHUyMTE2IDEgXHUwNDNlXHUwNDQyIDAxLjAxLjIwMjEuIFx1MDQxMVx1MDQzNVx1MDQzNyBcdTA0MWRcdTA0MTRcdTA0MjEiLCAid2ViaG9va1R5cGUiOiAiYWNxdWlyaW5nSW50ZXJuZXRQYXltZW50IiwgIm1lcmNoYW50SWQiOiAiMjAwMDAwMDAwMDAxMjM0IiwgInN0YXR1cyI6ICJBUFBST1ZFRCIsICJwYXltZW50TGlua0lkIjogIjEyMzQ1LWFiLWNkIn0.J5GZjKgeScrbD5lHqbQEP3oJkmwMYKDSUBUrrSN07qNELpApEp9IclABEolS-ANh7_xVXF-9D8uLm4rNzrLhid90SHMwWOFTUW4BT-7lNM4jogaBUFqUf2d-kPfUI16-jFdNQIy-are6d9HbMjZGXunBUZpBOr2Pz8wEGJyaaywh4tBdgKMQbC-an1sY0JwJqdRK7memw-hv9gsDIAqLSSih80L4N7F2PUrSbzfbTrNj7u5nvYFPT3DkKknGh2IvHx27nzo9tK-JBNxgHN0HQOg3EOYFJV3e0H_JhGZqlxoU0zo2YNHeB7cZJ0qZy7HZMXv2g1Qlae-2JthyJjF9NEC2f8W79d8Z3CZJw40l4z0QXDIrMAgf01bHFt4eanP6fhq39iko04EbBiHH8Zmjhn5hLkAGymoc_rC60wDl8v11Tb1YJYO2xdNsRNaMaYuvFOhLqnjmgjQeEQoL6iHGB7ObUbAWB4_BU4M524Z_KpmNqmigRNSZDEdDCrYYPncd ``` -------------------------------- ### Build and Development Commands Source: https://github.com/onreza/tochka-sdk-ts/blob/main/CLAUDE.md Common CLI commands for managing the project, including dependency installation, code generation, testing, and linting. ```bash bun install bun run gen # openapi-typescript → src/_generated/ bun run build # tsup: ESM + CJS + DTS, subpath exports bun test # bun test (102 unit-тестов) bun run lint # biome check bun run typecheck # tsc --noEmit bun run spec:fetch # скачать свежий swagger.json в specs/ bun run spec:diff # diff путей между openapi.json и openapi.prev.json bun run spec:sync # fetch + gen + diff → .sync-report.md (для CI) ``` -------------------------------- ### Incoming Payment Webhook Example Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/opisanie-metodov-vebhuki.md Example JWT payload for an incoming payment event. This token needs to be decrypted using the RS256 algorithm and verified with Tochka Bank's public OpenAPI key. ```json eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJTaWRlUGF5ZXIiOiB7ImJhbmtDb2RlIjogIjAwMDAwMDAwMCIsICJiYW5rTmFtZSI6ICJcdTA0MWVcdTA0MWVcdTA0MWUgXHUwNDExXHUwNDMwXHUwNDNkXHUwNDNhIFx1MDQyMlx1MDQzZVx1MDQ0N1x1MDQzYVx1MDQzMCIsICJiYW5rQ29ycmVzcG9uZGVudEFjY291bnQiOiAiMDAwMDAwMDAwMDAwMDAwMDAwMDAwIiwgImFjY291bnQiOiAiMDAwMDAwMDAwMDAwMDAwMDAwMDAiLCAibmFtZSI6ICJcdTA0MThcdTA0MWYgXHUwNDIyXHUwNDM1XHUwNDQxXHUwNDQyIiwgImFtb3VudCI6ICI0MC4wIiwgImN1cnJlbmN5IjogIlJVQiIsICJpbm4iOiAiMDAwMDAwMDAwMCIsICJrcHAiOiAiMDAwMDAwMDAwMCJ9LCAiU2lkZVJlY2lwaWVudCI6IHsiYmFua0NvZGUiOiAiMDAwMDAwMDAwIiwgImJhbmtOYW1lIjogIlx1MDQxZVx1MDQxZVx1MDQxZSBcdTA0MTFcdTA0MzBcdTA0M2RcdTA0M2EgXHUwNDIyXHUwNDNlXHUwNDQ3XHUwNDNhXHUwNDMwIiwgImJhbmtDb3JyZXNwb25kZW50QWNjb3VudCI6ICIwMDAwMDAwMDAwMDAwMDAwMDAwMDAiLCAiYWNjb3VudCI6ICIwMDAwMDAwMDAwMDAwMDAwMDAwMDAiLCAibmFtZSI6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qLSFlkp6kKmQkIfeBn ``` -------------------------------- ### Quick Start: OAuth 2.0 (Multi-Tenant Authorization Code) Source: https://github.com/onreza/tochka-sdk-ts/blob/main/README.md Implement multi-tenant OAuth 2.0 flow using authorization code and PKCE. This involves building an authorization URL, exchanging a code for tokens, and initializing the client with these tokens for automatic refresh. ```typescript import { OAuthClient, generatePkce } from "@onreza/tochka-sdk"; const oauth = new OAuthClient({ clientId, clientSecret }); const pkce = await generatePkce(); // 1. Построить URL для пользователя const url = oauth.buildAuthorizeUrl({ redirectUri: "https://your.app/cb", consentId: "...", state: "random-csrf-token", codeChallenge: pkce.codeChallenge, }); // 2. После колбэка обменять code на токены const tokens = await oauth.exchangeCode({ code: receivedCode, redirectUri: "https://your.app/cb", codeVerifier: pkce.codeVerifier, }); // 3. Передать токены в клиент — SDK сам обновляет через refresh_token const client = new TochkaClient({ auth: { oauth: { clientId, clientSecret, mode: "authorization_code", tokens: { accessToken: tokens.access_token, refreshToken: tokens.refresh_token!, tokenType: tokens.token_type, expiresAt: Date.now() + tokens.expires_in * 1000, }, }, }, }); ``` -------------------------------- ### Dolyame Payment Webhook Payload Example Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/opisanie-metodov-vebhuki.md This is an example of a webhook payload received when a payment is made using the 'Dolyame' service. It includes details like customer code, amount, payment type, operation ID, and purpose. ```json eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJjdXN0b21lckNvZGUiOiAiMzAwMTIzMTIzIiwgImFtb3VudCI6ICIwLjMzIiwgInBheW1lbnRUeXBlIjogInNhc2JjIiwgIm9wZXJhdGlvbklkIjogImJlZWFjOGE0LTYwNDctM2YzOC04OTIyLWE2NjRlNmI1YzQzYiIsICJ0cmFuc2FjdGlvbklkIjogIjQzYzYzZWVjMS00MmZhLWE3MDQtZGRlNy02MDI1YzIwYjk2Y2UiLCAicHVycG9zZSI6ICJcdTA0MWVcdTA0M2ZcdTA0M2JcdTA0MzBcd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SBP Payment Webhook Payload Example Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/opisanie-metodov-vebhuki.md This is an example of the JSON payload received for an incoming payment via the Faster Payments System (SBP). It contains specific transaction details such as operation ID, QR code ID, amount, payer information, and merchant details. Notifications are typically received within 5 seconds. ```json eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJvcGVyYXRpb25JZCI6ICJBMjIwMDExMDAyNjM4MjAxMDAwMDA1MzNFNjI1RkNCMyIsICJxcmNJZCI6ICJBUzEwMDA2RFBSVEVGUEZTOUhKOVNRU0RTVlJISkQzTCIsICJhbW91bnQiOiAiMC4zMyIsICJwYXllck1vYmlsZU51bWJlciI6ICIrOTk5OTEyMzQ1NjciLCAicGF5ZXJOYW1lIjogIlx1MDQxOFx1MDQzMlx1MDQzMFx1MDQzZCBcdTA0MThcdTA0MzJcdTA0M0RcdTA0M2VcdTA0MzJcdTA0MzhcdTA0NDcgXHUwNDE4LiIsICJicmFuZE5hbWUiOiAiXHUwNDFhXHUwNDNlXHUwNDQ0XHUwNDM1XHUwNDM5XHUwNDNkXHUwNDRmIFx1MDQ0MyBcdTA0MTBcdTA0NDBcdTA0NDJcdTA0MzVcdTA0M2NcdTA0MzAiLCAibWVyY2hhbnRJZCI6ICJNRjAwMDAwMDAwMDEiLCAicHVycG9zZSI6ICJcdTA0MWVcdTA0M2ZcdTA0M2JcdTA0M0RcdTA0NDJcdTA0M0RcdTA0M2ZcdTA0M2VcdTA0NDFcdTA0NDdcdTA0MzVcdTA0NDJcdTA0NDMgXHUyMTE2IDEgXHUwNDNlXHUwNDQyIDAxLjAxLjIwMjEuIFx1MDQxMVx1MDQzNVx1MDQzNyBcdTA0MWRcdTA0MTRcdTA0MjEiLCAid2ViaG9va1R5cGUiOiAiaW5jb21pbmdTcHBDb21lbnQiLCAiY3VzdG9tZXJDb2RlIjogIjMwMDEyMzEyMyIsICJyZWZUcmFuc2FjdGlvbklkIjogImNiMWVmMTBiLTM5ZTktNGU1NS1hZWY5LWQ2YmNjMzk2ZmYwZiJ9.QroEOEYw-fxniFzvjcrgihSeYOhE9GLVuMwI9Uuc0ubuwc-wYP2pHRYF4Lu2-bqHZk2jP5QHn2aDYWFVWi3vBi6sbVTa_n3Y9qZ1ROjbRaF-Uuah5XyzijwNG0I--0jj-vvn3D3caC1mw6dOCP1Ehkd5ipZWtcsrzu0wPxni8bsiqDIBVcA4hg3a6Iu5AORANwy4whiFo295bzf1Y_fdBhZO1QjZqv3-Cc_fF9liKd56UMfljm3ChqVwCdNF85e69PXAjkeicp-pH12kkgeflA2zLq_LFurAZj9_JkrOS9qSpfDqYf0m-ciHYFVYJNGH4PZnIPOa7iYNlGi0WjVbxE6uJX2EDHnYCZ1qXAkdGlm3K1CNvmBzjIUEowWOmD9bkq4INGsd9MMmRRSo-K3fqqjPNXkVGw2-_ZbIgemG9TD4bGeZCWN4shXpzrWGcyfQ7mrhRW0XiECGxTy8K4QuK-WsijGBlkYGd-bZuBa9qyZXLnsX4FhTIdEHYDc_eW6v ``` -------------------------------- ### GET /open-banking/v1.0/statements Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/opisanie-metodov-vypiski.md Retrieves a list of all available statements. ```APIDOC ## GET /open-banking/v1.0/statements ### Description Returns a list of all statements currently available for the user. ### Method GET ### Endpoint /open-banking/v1.0/statements ``` -------------------------------- ### Get Webhooks Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/opisanie-metodov-vebhuki.md Retrieves a list of all webhooks configured for the application. ```APIDOC ## GET /webhook/v1.0/{client_id} ### Description Retrieves a list of all webhooks configured for the application. ### Method GET ### Endpoint /webhook/v1.0/{client_id} ### Parameters #### Path Parameters - **client_id** (string) - Required - The unique identifier of the client. ### Response #### Success Response (200) - **webhooks** (array) - A list of webhook objects. - **id** (string) - The unique identifier of the webhook. - **url** (string) - The URL where the webhook events will be sent. - **type** (string) - The type of events the webhook is subscribed to. ``` -------------------------------- ### Quick Start: JWT Key Authentication Source: https://github.com/onreza/tochka-sdk-ts/blob/main/README.md Initialize the TochkaClient with a JWT key for the simplest authentication. Access customer data and specific customer details. ```typescript import { TochkaClient } from "@onreza/tochka-sdk"; const client = new TochkaClient({ auth: { jwt: process.env.TOCHKA_JWT! } }); const customers = await client.customers.list(); const company = client.forCustomer("300000092"); const accounts = await company.accounts.list(); ``` -------------------------------- ### Quick Start: OAuth 2.0 (Service-to-Service) Source: https://github.com/onreza/tochka-sdk-ts/blob/main/README.md Configure the TochkaClient for service-to-service OAuth 2.0 using client credentials. The SDK automatically handles token acquisition and refresh. ```typescript const client = new TochkaClient({ auth: { oauth: { clientId: process.env.TOCHKA_CLIENT_ID!, clientSecret: process.env.TOCHKA_CLIENT_SECRET!, mode: "client_credentials", scope: ["accounts", "balances"], }, }, }); // Токен получается и обновляется автоматически ``` -------------------------------- ### Acquiring Internet Payment Webhook - SBP Payment Example Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/opisanie-metodov-vebhuki.md This JSON payload represents an incoming payment webhook for 'acquiringInternetPayment' when a customer pays using the System of Fast Payments (SBP). It includes fields specific to SBP, such as transaction ID and qrcId, along with common payment details. ```json eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJxcmNJZCI6ICJBUzEwMDA2RFBSVEVGUEZTOUhKOVNRU0RTVlJISkQzTCIsICJhbW91bnQiOiAiMC4zMyIsICJwdXJwb3NlIjogIlx1MDQxZVx1MDQzZlx1MDQzYlx1MDQzMFx1MDQ0Mlx1MDQzMCBcdTA0M2ZcdTA0M2UgXHUwNDQxXHUwNDQ3XHUwNDM1XHUwNDQyXHUwNDQzIFx1MjExNiAxIFx1MDQzZVx1MDQ0MiAwMS4wMS4yMDIxLiBcdTA0MTFcdTA0MzVcdTA0MzcgXHUwNDFkXHUwNDE0XHUwNDIxIiwgIndlYmhvb2tUeXBlIjogImluY29taW5nU2JwQjJCUGF5bWVudCIsICJjdXN0b21lckNvZGUiOiAiMzAwMTIzMTIzIn0.dty4QICBwDnglK9VKFchdKxG_QbOPHKHmqxSan5uDUadMT61391lNiRj7cKGiH35heZc7GEKp3rwmuqLIEwLcUQts2t90Baw7gVeHQSQMyeBjIEFoBXgkDCNsRwqJISmW8NfEv6xX87IEjLp6wKJi3VmfF_sffW6EpaXzyScA9DPIKjtUA9U-W5t8JmjgWMbXK41ghfiSlYiCOpOVOleod3R-jjzsGI3nEYExDqWWz3VgjsFGwHLGKoWBzhqtSL-NBTp5rE82N5eZrWF_4n8tkAmPzShQY9Rh2VxFVwAyqIezqYHYAcBBW_6vbZvA_XFVB8UkjOqJKRWSFHEOsmu7o3JYOq0WnI1iJ_Hfsi0W1HjjgaZuMhyezqNsGWib6u_g-86ekEPxXGFFlKglHg52t8iU-YE8dt7e7s890l_4_C2tRBbOuLrdnITrHzepiby6A74Qdt29j2Ffo0Vkd8qRNWx7RmWjy1X7NN0h595imLbBFWeYPYNOdG0M7CBQUox ``` -------------------------------- ### Create static QR code with successful payment Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped/testing.md Configures a static QR code creation scenario that simulates a successful payment. ```json ...."qrcType": "STATIC","paymentPurpose": "{\"createQrc\":\"OK_PAYMENT_ACCEPTED\"}".... ``` -------------------------------- ### Outgoing Payment Webhook Example Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/opisanie-metodov-vebhuki.md Example JWT payload for an outgoing payment event. Similar to incoming payments, this token requires RS256 decryption and verification against Tochka Bank's public OpenAPI key. ```json ``` -------------------------------- ### Create dynamic QR code with payment and refund Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped/testing.md Configures a dynamic QR code that simulates both a successful payment and a successful refund. ```json ..."qrcType": "DYNAMIC","paymentPurpose": "{\"createQrc\":\"OK_PAYMENT_ACCEPTED\",\"refund\":\"OK_ACCEPTED\"}"... ``` -------------------------------- ### Initialize TochkaClient with various AuthInput methods Source: https://github.com/onreza/tochka-sdk-ts/blob/main/CLAUDE.md Demonstrates the five supported authentication strategies for the TochkaClient, including JWT, sandbox, bearer tokens, OAuth, and custom providers. ```ts new TochkaClient({ auth: { jwt: "..." } }) // персональный JWT-ключ из ЛК new TochkaClient({ auth: { sandbox: true } }) // Bearer sandbox.jwt.token new TochkaClient({ auth: { bearer: "..." } }) // внешний access_token new TochkaClient({ auth: { oauth: { ...options } } }) // OAuthAuth с авто-рефрешем new TochkaClient({ auth: { custom: myProvider } }) // любой AuthProvider ``` -------------------------------- ### Create dynamic QR code with payment and subscription Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped/testing.md Configures a dynamic QR code for a payment scenario that includes account binding. ```json ...."qrcType": "DYNAMIC","paymentToken": { "tokenizationPurpose": "Тестирование сценария оплаты с привязкой счета"},"paymentPurpose": "{\"createQrc\":\"OK_PAYMENT_AND_SUBSCRIPTION_ACCEPTED\"}",.... ``` -------------------------------- ### Get Merchants List Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/opisanie-metodov-sbp-sistema-bystryh-platezhej.md Retrieve a list of all registered merchants and their information. ```APIDOC ## GET /api/get-merchants-list-sbp/v1.0/merchant/legal-entity/{legalId} ### Description Retrieves a list of all registered merchants (ТСП) associated with the provided legal entity ID. ### Method GET ### Endpoint /api/get-merchants-list-sbp/v1.0/merchant/legal-entity/{legalId} ### Parameters #### Path Parameters - **legalId** (string) - Required - The identifier of the legal entity for which to retrieve the merchant list. ### Response #### Success Response (200) - **merchants** (array) - A list of merchant objects, each containing details about a registered ТСП. - Each merchant object may include fields like `merchantId`, `brandName`, `address`, etc. (Specific fields depend on the API response structure). #### Response Example ```json { "merchants": [ { "merchantId": "merchant_abc123", "brandName": "My Store", "address": "123 Main St" }, { "merchantId": "merchant_def456", "brandName": "Another Shop", "address": "456 Oak Ave" } ] } ``` ``` -------------------------------- ### Test Environment Features Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped/testing.md Guidelines for using the test environment, specifically regarding qrcId prefixes. ```APIDOC ## Test Environment Features ### Description When creating a Cash Register QR Code (SBP), the optional `qrcId` field must be prefixed with 'TEST-' for successful execution. ### Error Simulation Passing a value without the 'TEST-' prefix can be used to simulate service errors. ``` -------------------------------- ### Activate cash register QR with payment and refund Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped/testing.md Configures an activation scenario for a cash register QR code that includes successful payment and refund simulation. ```json ..."paymentPurpose": "{\"activateCRQRC\":\"OK_PAYMENT_ACCEPTED\",\"refund\":\"OK_ACCEPTED\"}"... ``` -------------------------------- ### GET /open-banking/v1.0/accounts Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/opisanie-metodov-scheta.md Retrieves a list of all accounts associated with the authorized user. ```APIDOC ## GET /open-banking/v1.0/accounts ### Description Retrieves information for all accounts available to the authenticated user. ### Method GET ### Endpoint /open-banking/v1.0/accounts ``` -------------------------------- ### Create subscription without payment Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped/testing.md Configures a token-based scenario to reject subscription activation. ```json ...."qrcType": "TOKEN","paymentToken": { "tokenizationPurpose": "{\"createQrc\":\"OK_SUBSCRIPTION_REJECTED\"}"},.... ``` -------------------------------- ### GET /api/get-retailers Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/opisanie-metodov-platyozhnye-ssylki.md Retrieves a list of connected retail outlets for online acquiring. ```APIDOC ## GET /api/get-retailers ### Description This method returns information about connected retail outlets for online acquiring. It is necessary to have the status 'REG' and `isActive` set to `true` to work with payment links. ### Method GET ### Endpoint /api/get-retailers ### Response #### Success Response (200) - **status** (string) - The registration status of the retail outlet. Must be 'REG' to work with payment links. - **isActive** (boolean) - Indicates if the retail outlet is active and ready for use. Must be `true` to work with payment links. - **mcc** (string) - The MCC code corresponding to the business activity. - **rate** (string) - The commission rate charged for card payments. - **name** (string) - The name of the retail outlet. - **url** (string) - The URL of the retail outlet's registration site. - **merchantId** (string) - The unique identifier for the retail outlet. - **terminalId** (string) - The identifier for the online acquiring terminal. - **paymentModes** (array) - A list of available payment methods for the retail outlet. - **cashbox** (object) - Information about the connected online cash register. ``` -------------------------------- ### GET /sbp/v1.0/qr-codes/{qrcId}/payment-status Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/opisanie-metodov-sbp-sistema-bystryh-platezhej.md Retrieves the payment status of a dynamic QR code. ```APIDOC ## GET /sbp/v1.0/qr-codes/{qrcId}/payment-status ### Description Tracks the payment status of a dynamic QR code within its validity period or 24 hours after payment. ### Method GET ### Endpoint /sbp/v1.0/qr-codes/{qrcId}/payment-status ### Parameters #### Path Parameters - **qrcId** (string) - Required - Identifier of the QR code. ``` -------------------------------- ### GET /open-banking/v1.0/accounts/{account-id} Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/opisanie-metodov-scheta.md Retrieves detailed information for a specific account identified by its ID. ```APIDOC ## GET /open-banking/v1.0/accounts/{account-id} ### Description Retrieves detailed information for a single account. ### Method GET ### Endpoint /open-banking/v1.0/accounts/{account-id} ### Parameters #### Path Parameters - **account-id** (string) - Required - The unique identifier of the account. ``` -------------------------------- ### Simulate payment rejection by token Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped/testing.md Configures a payment request using SBP_TOKEN that simulates a rejection. ```json ...."paymentMethod": { "type":"SBP_TOKEN", "token": "AS1000670LSS7DN18SJQDNP4B05KLJL2",},"comment": "{\"payWithToken\":\"OK_REJECTED\"}".... ``` -------------------------------- ### Get Subscription Status Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/opisanie-metodov-podpiski-rekurrentnye-platezhi.md Retrieves the current status of a specific subscription using its operation ID. ```APIDOC ## GET /acquiring/v1.0/subscriptions/{operationId}/status ### Description Retrieves the current status of a specific subscription. ### Method GET ### Endpoint /acquiring/v1.0/subscriptions/{operationId}/status ### Path Parameters - **operationId** (string) - Required - The unique identifier of the subscription. ### Response #### Success Response (200) - **status** (string) - The current status of the subscription (e.g., "Active", "Cancelled"). #### Response Example { "status": "Active" } ``` -------------------------------- ### Request Access Token (Client Credentials) Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/algoritm-raboty-po-oauth-2.0.md Use this cURL command to obtain an access token using the client_credentials grant type. Ensure you replace 'test_app' and 'test_secret' with your actual client ID and secret. The 'scope' parameter defines the permissions your application requires. ```bash curl --request POST 'https://enter.tochka.com/connect/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'client_id=test_app' \ --data-urlencode 'client_secret=test_secret' \ --data-urlencode 'grant_type=client_credentials' \ --data-urlencode 'scope=accounts balances customers statements sbp payments' ``` -------------------------------- ### Create dynamic QR code without payment Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped/testing.md Configures a dynamic QR code creation scenario that does not trigger callbacks. ```json ...."qrcType": "DYNAMIC","paymentPurpose": "{\"createQrc\":\"OK_WITHOUT_CALLBACKS\"}".... ``` -------------------------------- ### Consent Creation Response Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/algoritm-raboty-po-oauth-2.0.md Example response after creating a consent request. The 'consentId' is crucial for subsequent authorization steps. ```json { "Data": { "status": "AwaitingAuthorisation", "creationDateTime": "2024-01-10T11:40:16.941480+00:00", "statusUpdateDateTime": "2024-01-10T11:40:16.941498+00:00", "permissions": [ "ReadAccountsBasic", "ReadAccountsDetail", "MakeAcquiringOperation", "ReadAcquiringData", "ReadBalances", "ReadStatements", "ReadCustomerData", "ReadSBPData", "EditSBPData", "CreatePaymentForSign", "CreatePaymentOrder", "ManageWebhookData", "ManageInvoiceData" ], "consentId": "705ba15f-a109-4156-bb7f-50c21413c158", "applicationName": "test_name", "clientId": "test_app" }, "Links": { "self": "https://enter.tochka.com/uapi/v1.0/consents" }, "Meta": { "totalPages": 1 } } ``` -------------------------------- ### Get Subscription List Source: https://github.com/onreza/tochka-sdk-ts/blob/main/docs/tochka/scraped-tochka-api/opisanie-metodov-podpiski-rekurrentnye-platezhi.md Retrieves a list of all created subscriptions, including both active and inactive ones. Supports pagination. ```APIDOC ## GET /acquiring/v1.0/subscriptions ### Description Retrieves a list of all created subscriptions, including active and inactive ones. Supports pagination using `page` and `perPage` query parameters. ### Method GET ### Endpoint /acquiring/v1.0/subscriptions ### Query Parameters - **page** (integer) - Optional - The page number to retrieve. - **perPage** (integer) - Optional - The number of records to display per page. ### Response #### Success Response (200) - **subscriptions** (array) - A list of subscription objects. - **operationId** (string) - The unique identifier for the subscription. - **status** (string) - The current status of the subscription. - **merchantId** (string) - The identifier of the merchant. - **customerCode** (string) - The unique customer code. - **createdAt** (string) - The timestamp when the subscription was created. - **nextPaymentDate** (string) - The date of the next payment. #### Response Example { "subscriptions": [ { "operationId": "sub_12345abc", "status": "Active", "merchantId": "merchant_xyz", "customerCode": "cust_abcde", "createdAt": "2023-10-27T10:00:00Z", "nextPaymentDate": "2023-11-27T10:00:00Z" } ] } ```