Telegram released a new payment-enabled API last summer. Since then, the messenger has become a sales channel, which allows companies not only to communicate with the client, but also to accept payment for their goods and services directly in the dialog box. Yandex.Cassa was the first among Russian payment services to support this feature. Individual entrepreneurs and small organizations immediately began to accept payments to Telegram through the Cashier: florists, tea and coffee shops, coaches, organizers of training courses, charitable foundations and many others ( here you can read reviews and examples). But for larger companies with a stream of orders was one stopper.
The fact is that until recently, Telegram-sales had one feature that did not take into account purely Russian specifics of electronic commerce — the mandatory sending of online checks (the 54- requirement, known as the law on online cash registers ). Yandex.Cash immediately appeared a special protocol that supported the work with the new cash equipment and automated transfer of checks. But in Telegram such automation was not technically supported, and sellers had to set up the transfer of checks themselves (consider dancing with a tambourine). And recently, the messenger went to meet the Russian e-commerce market and implemented a joint project with Yandex.Money, adding an important element to its protocol - a special field appeared for additional information to the payment provider. Now selling via Telegram has become convenient from the point of view of not only the client service, but also the automation of the transfer of online checks (that is, compliance with 54-FZ). Under the cut, I'll tell you what to do to launch sales in a Telegram, accepting payments through Yandex.Cass.
If you have not had to buy anything via the messenger, the sales scenario may not be obvious. In some cases, the sale begins on the site, and ends in the Telegram. In others, all customer service goes through Telegram-bot. Here is how it will look step by step:
Needless to say that the speed of implementation of paragraphs. 1-2 depends on the client (product selection, payment information input), and the processes from paragraphs. 3-6 occur almost instantly?
An example of using a payment bot in the Russian language service “You can do it!” (@UchenyjBot)
The average check when paying in the messenger through Yandex.Cash is 700 rubles - comparable to the average check when paying on the site. Each business has its own absolute indicator. For example, the average check in a music school that accepts payment through a cashier in a Telegram is 4,000 rubles. A subscription to the consultation service on the Russian language, the payment process of which is shown above, costs 149 rubles.
When Telegram just released an API with payment support, it seemed that this sales channel would be in demand among medium and large merchants, who could write their own bot, which takes into account all the scenarios of the store’s communication with the user. But in fact, a large retail did not go on sale in Telegram, but small service companies and small shops came.
To set up sales in Telegram via Yandex.Cash, you need to do three main things:
In response to a request, your bot will send an invoice to the client. The invoice must contain the cost, the name, the description of the goods, the payload parameter and the provider_token parameter - this is the same token that issued @BotFather.
If you need to get a shipping address from the buyer, implement the Shipping Query method. When the user specifies an address, this request must be answered using the answerShippingQuery method and the delivery methods as well as their prices must be passed through it.
So, almost everything is ready, except for sending a check.
In July 2017, Law 54-FZ came into force, the essence of which is the need for an online tax report for each sale through the Internet. That is, any online store working with individuals must use a new generation of cash registers that can send electronic checks to the tax office after each payment (such cash registers (CCP) can be bought or rented). Checks are transferred to the tax and the buyer via the Internet through the operator of fiscal data - OFD (therefore, the cash must always be online). The receipt must contain the name of the product, price, quantity, VAT rate, information about the seller and the cash register itself.
Until recently, merchants had to monitor sales through the bot and conduct fiscalization on their own. What does this mean in practice? It’s all the same as if the sales went offline: the bot gave the seller a notice of sale, the seller manually entered all the goods sold into his cash desk and passed the check on the contacts that the buyer left before paying.
Beyond the Telegram, Yandex.Kassa as a service already knew how to automatically transfer data about online payments to more than 70 KKM models of all popular suppliers. But in the Cashier’s payment bot, there was no such function due to limitations on the size of the data that our bot could receive from the merchant bot. Everything worked out in February, when Telegram finalized its protocol for payment bots : a field appeared for additional information to the payment provider - Provider data, and we realized this opportunity. This field is required for the transfer of data on the composition of the check. Y. Kassa knows how to parse this field, so the merchant can only set up his bot correctly, adding data on the composition of the check.
Below is the request code without an attached check, that is, as it was until February :
{ "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, the request to Telegram to send an invoice with additional information for the Yandex.Cashy payment bot will look like this ( attention to the Receipt field is the data of the composition of the check ):
{ "chat_id":147426403, "title": "Test", "description": "Test", "payload":{}, "provider_token":"390540012:LIVE:1514", "currency": "RUB", "start_parameter":"mybot", "prices":[{"label":"-","amount": 6100}], "provider_data":{ "receipt":{ "email":"example@example.com", "items":[ { "description": " A", "quantity": "1.00", "amount": { "value": "100.00", "currency": "RUB" }, "vat_code": 1 } ] } } }
From the required data in the request:
So that after payment in Telegram, J. Kassa automatically “signaled” to your cash register that the buyer needs to send a check (he sends the check to the CRF serving your cash register), do the following:
If you have experience in creating a payment bot or have questions about how to set up payment, welcome to comments.
Source: https://habr.com/ru/post/351766/
All Articles