To properly set up sales in Telegram via Yandex.Kassa, you need to do the following:

Data used to track, manage, and optimize resources.
Post Reply
Maksudasm
Posts: 884
Joined: Thu Jan 02, 2025 6:46 am

To properly set up sales in Telegram via Yandex.Kassa, you need to do the following:

Post by Maksudasm »

Complete all the registration steps in Yandex.Kassa. Complete the contract, sign it, and receive a store ID.

Create a Telegram bot to communicate with customers. You can use the methods described in the article above. It is recommended to create it via @Botfather, and program the behavior yourself or in some constructor. The finished bot requires activation via chat with @BotFather.

Connect the created bot to the Yandex.Kassa payment bot. To do this, in the "Payments" tab in your bot's menu, when talking to BotFather, you need to click on the "Yandex.Kassa" button and specify it as a payment provider. Then start communicating with the new bot via /start, specify the shop ID assigned to you from your Yandex.Kassa personal account (it is assigned when connecting a merchant, each has its own) and implement the sendinvoice method from the Telegram payment API. At the moment of final configuration of the bot, payment acceptance will be enabled automatically.

Upon request, this bot paytm database will send the buyer an invoice for payment. It should contain all the information, be it the price, name, description of the item, payload parameters and provider_token (the same token that @BotFather issued).

If the customer needs to specify the address to which the purchase should be delivered when placing an order, then you need to find out this information, which can be done through Shipping Query. When the buyer specifies the location, you need to respond to this request using the answerShippingQuery method, and pass through it the delivery methods, as well as the cost of each type.

Setting up payment and registering an online cash register in Telegram

The last thing is to send the customer a receipt. Previously, this required routine and difficult work. The seller had to accurately enter all the data into his cash register and then transfer it to the customer through the data left. Now this process is much simpler.

Yandex.Kassa (as a service) has long been able to automatically transfer data on online payments to more than 70 models of cash register machines from all popular suppliers. But its payment bot did not have such a function due to restrictions on the size of the data that the store owner's bot could receive from the merchant. In the winter of this year, Telegram developers improved their protocol for payment bots by creating a field of additional information for the payment provider - Provider data. This is what is needed to transfer data on the composition of the check. Yandex.Kassa can automatically parse this field. This means that the merchant only needs to correctly configure his bot, supplementing it with this data.

Below is the request code without the receipt attached. In other words, this is what it looked like before:

{

"chat_id":147426403,

"title": "Test",

"description": "Test",

"payload":{},

"provider_token":"390540012:LIVE:1514",

"currency": "RUB",

"start_parameter":"mybot",

"prices":[{"label":"Ля-Ля","amount": 6100}]

}

If you add information about the composition of the check for further processing and fiscalization, then the request to Telegram to send an invoice with additional information for the Yandex.Kassa payment bot will be drawn up and presented in the following form (special attention should be paid to the Receipt field - this is the same data specified in the composition of the check):
Post Reply