Payments 2.0 - The Telegram messenger now has the ability to accept payments in any chat, including groups and channels. You can connect your store to the platform on your own, without agreement with Telegram.
Payment bots have existed on Telegram since 2017. With their help, you can safely pay for goods and services like pizza delivery without leaving the app.
From now on, merchants can accept credit card payments using 8 built-in payment systems in any chat, including groups and channels.
At the moment, payments from more than 200 countries are supported through the following payment systems:
Telegram does not process payments from users and instead relies on different payment providers around the world. It is the payment providers that process and store all confidential information, such as credit card information. Neither Telegram nor bot developers have access to it.
You can use any application for payment, including Telegram for computers. A customer can also leave a tip to support a favorite author, cafe or store.
Telegram bot is created using another bot called @BotFather. We send him the command
/ newbot, select the name that will be displayed in the contact list, and the address. For example,
Payment in Telegram bot with the address
If the address is not busy, and the name is entered correctly, BotFather will send in response a message with a token - "key" to access the created bot.
It must be preserved and not shown to anyone.
Next, let's create a new project. We create a folder.
Enter in the console:
The program asks you different questions and creates a
package.json that defines the project settings, dependencies, scripts, name, and more. For example, you can press
and add the file
index.js in which our bot will be developed.
We install telegraf.js - this is one of the popular frameworks for creating telegram bots.
We put the
dotenv library - this is a module that loads environment variables from the
.env file into
process.env., and also we put
nodemon - a tool that helps to develop applications based on node.js by automatically restarting the application
node when it detects file changes in a directory.
Add the startup script to
From the telegraf.js documentation, copy the initial bot setup into our project.
Create a file
.env where in the variable
BOT_TOKEN we put the token that was given to us earlier by @BotFather
Create a file
.env where in the variable BOT_TOKEN` we put the token that was given to us earlier by [@BotFather]
Checking the bot's work
PROVIDER_TOKEN you need to get
merchantLogin from Sberbank. To do this, you need to connect the Internet acquiring service at Sberbank.
After you have received it, go to @BotFather and call the command
/ mybots, where we select your bot.
Where we choose Sberbank
Connect Sberbank Live
After that you will be redirected to
@SberbankPaymentBot, where you need to enter your
merchantLogin, which must be entered without any
-operator prefixes. For example:
P71XXXXXXX21. Due to the fact that I did not know this, it took me a week to correspond with the technical support of Sberbank.
After @BotFather will give you a token that you need to insert into the variable
PROVIDER_TOKEN in the file
We write the following code in
Use this method to send invoices. If successful, the message sent is returned.
We launch the bot with the command
yarn start and check if the payment is completed.
Ask them in the telegram community Bots on Telegraf