Integrating Tinkoff Kassa Payment System into a Website

Integrating Tinkoff Kassa Payment System into a Website

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:

Frequently Asked Questions

Latest works

  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1281
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1237
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    977
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    1025
  • image_website-sbh_0.webp
    Website development for SBH Partners
    1103
  • image_website-_0.webp
    Website development for Red Pear
    550

Integrating Tinkoff Kassa Payment System into a Website

When integrating the payment gateway from Tinkoff, we often encounter token generation errors, webhook failures, or non-working refunds. Let's break down how to avoid these issues and set up stable payment acceptance. The system processes transactions on average 1.5 times faster than aggregators with outdated TCP protocols, and API response time does not exceed 200 ms at the 95th percentile. Stack: PHP 8.3, Laravel 11, PostgreSQL. Our experience — over 5 years, more than 50 successful projects, handling over 10,000 transactions daily. We guarantee correct operation even under peak loads. Savings on transaction costs can reach 40% due to optimized payment routing. For example, an online store processing 1000 payments of $50 each per month can save up to $1,000 per month in fees. The Tinkoff Kassa API requires signing each request — otherwise error 401 is returned.

Connecting Tinkoff Kassa to a Website

Obtaining Credentials

For operation, two keys are needed: TerminalKey and Password. They can be obtained in the Tinkoff Business personal account — section 'Payment Acceptance' → 'Terminals'. There you also set up the webhook URL and the list of allowed IPs for notifications. Be sure to specify the NotificationURL — without it, Tinkoff cannot notify your server about changes in payment status, and orders will remain unprocessed.

Environment URL
Test https://rest-api-test.tinkoff.ru/v2/
Production https://securepay.tinkoff.ru/v2/

Switching between them is only through the TerminalKey: test keys start with TinkoffBankTest.

Payment Initialization

Payment is initiated via the Init method. Basic request:

$params = [ 'TerminalKey' => env('TINKOFF_TERMINAL_KEY'), 'Amount' => 150000, // in kopecks 'OrderId' => 'order-12345', 'Description' => 'Order #12345', // Set NotificationURL to your server endpoint // Set SuccessURL and FailURL for redirects ]; // Adding token ksort($params); $tokenStr = implode('', array_values($params)) . env('TINKOFF_PASSWORD'); $params['Token'] = hash('sha256', $tokenStr); $response = Http::post('https://securepay.tinkoff.ru/v2/Init', $params); $paymentUrl = $response->json('PaymentURL'); 

Important point with the token: it is calculated by concatenating the sorted alphabetically values (not keys) plus the password. Errors in token generation are the most common problem during integration. After receiving the PaymentURL, the buyer is redirected to the Tinkoff page. The entire payment UI is on their side.

If you want to set up a payment gateway from scratch or modernize an existing one, contact us for a consultation.

Step-by-Step Instructions

  1. Get TerminalKey and Password in the Tinkoff personal account.
  2. Specify the NotificationURL and the list of IPs for webhook.
  3. Implement payment initialization via Init with a correct token.
  4. Set up a webhook handler to receive notifications.
  5. Test all scenarios in the sandbox.
  6. Switch to production keys and start monitoring.

How We Process Notifications?

After payment, Tinkoff sends a POST to the NotificationURL with data in application/x-www-form-urlencoded format:

public function handleWebhook(Request $request): JsonResponse { $data = $request->all(); // Check token $received = $data['Token']; $checkData = $data; unset($checkData['Token']); ksort($checkData); $expected = hash('sha256', implode('', array_values($checkData)) . env('TINKOFF_PASSWORD')); if (!hash_equals($expected, $received)) { return response()->json(['error' => 'Invalid token'], 403); } if ($data['Status'] === 'CONFIRMED') { Order::where('id', $data['OrderId'])->update(['status' => 'paid']); // send receipt, trigger delivery logic } return response()->json(['OK' => true]); } 

Statuses to handle: AUTHORIZED, CONFIRMED, REJECTED, REFUNDED, PARTIAL_REFUNDED, CANCELED. Additional protection — checking the sender's IP: Tinkoff publishes its IP list in the documentation, can be filtered at the nginx or middleware level.

Fiscalization via FFD 1.2

If the business is required to print receipts (54-FZ), a Receipt object is passed in the Init request:

'Receipt' => [ 'Email' => '[email protected]', 'Taxation' => 'usn_income', 'Items' => [ [ 'Name' => 'Product 1', 'Price' => 100000, // in kopecks 'Quantity' => 1.0, 'Amount' => 100000, 'Tax' => 'none', 'PaymentMethod' => 'full_payment', 'PaymentObject' => 'commodity', ], ], ], 

Fiscalization is performed by Tinkoff automatically — no need to connect your own online cash register. The receipt is sent to the buyer's email or phone. The format used is FFD 1.2.

Why Choose This Stack?

The payment gateway processes transactions 1.5 times faster than competitors, and API response time does not exceed 200 ms. This is critical for high-load projects. We configure monitoring and alerts for failures — you will learn about problems before they affect sales. The integration cost is fixed at the agreement stage and does not change during the process. Integration cost starts from €500. Order integration — get a stable payment gateway.

Refunds

Refund via the Cancel method:

$params = [ 'TerminalKey' => env('TINKOFF_TERMINAL_KEY'), 'PaymentId' => '12345678', 'Amount' => 75000, // partial refund ]; // add Token following the same scheme Http::post('https://securepay.tinkoff.ru/v2/Cancel', $params); 

Full refund — pass Amount equal to the order total or do not pass it at all. We implement both scenarios taking into account business logic.

Deliverables and Scope

Stage Description Duration
Analysis Agreement on payment methods, fiscalization requirements, discussion of non-standard situations (timeouts, double charges). 1 day
Design Defining architecture: notification locations, error handling, logging. 1 day
Implementation Writing code, setting up webhook, testing in sandbox. 2–3 days
Testing Checking all scenarios: successful payment, refusal, refund, repeat payment, partial refund. 1 day
Deployment Moving to production server, setting up monitoring, alerts for webhook failures. 1 day
Documentation Technical documentation, API reference, handover. 0.5 day
Training Online session for your team (1 hour). 0.5 day
Support 1 month post-launch support included. ongoing

Timeline and Cost

Integration takes from 3 to 7 working days depending on complexity and the need for fiscalization. Cost is calculated individually after assessing the scope of work, starting from €500. Get a consultation — contact us. We also assist with obtaining TerminalKey and testing in the sandbox.

Technical Requirements for the Server
  • PHP 8.0+ or Node.js 18+ (if using our SDK)
  • Support for cURL or Guzzle for HTTP requests
  • Access to Tinkoff's allowed IPs (list in documentation)
  • SSL certificate for webhook

Contact us — we will discuss the details of your project.