Skip to main content

Telegram payment block

The Telegram payment block allows receiving payments from Telegram users via the built-in Telegram Bot Payments service. This service is integrated with various payment providers.

To use Telegram payment block:

  1. Create a script.
  2. Register your bot in Telegram and connect it to Aimylogic.
  3. Get a payment provider token.
  4. Add the block to the script.

Get a payment provider token

After you register your bot in Telegram, you need to get a token of your payment provider. You will need it when adding the Telegram payment block to the script.

  1. Open Telegram and type BotFather in the search bar.
  2. Send the /mybots command to BotFather.
  3. Choose your bot and select Payments.
  4. Choose a payment provider from the list of providers Telegram supports.
  5. Choose one of the options:
    • If you want to receive payments from clients, select Live.
    • If you only want to test payments, select Test. The chat with the bot for the selected payment provider will open.
  6. Select Start to launch the bot.
  7. Follow all the steps the bot asks for.
  8. Open the dialog with BotFather again. In the last message from BotFather, you will see the list of connected payment methods. Copy the token for your payment provider:

Add the block

Open your script in Aimylogic and select the Telegram payment block from the block menu.

Configure the following parameters:

  • Payment system token — insert the token you have copied in the dialog with BotFather.
  • Allow clients to forward payment links — enable this option if you want multiple Telegram users to pay via this invoice. If the client forwards the message with the invoice to another Telegram user, the forwarded message will include the payment link. In this case, another Telegram user can follow it and pay. ? > If you disable this option, the client will be able to follow the link and pay only within the dialog with the bot. If the client forwards the message, it will not include the link and no one else will be able to make a payment. In this case, if the other user selects the button for payment, they will be redirected to the bot.
  • Check the goods availability before checkout — enable this option to allow the client make a payment only in case the item is available. If you enable this option, you need to add a URL to the service which is configured to return the information about item availability. The bot will send requests to this URL. ? > If the service returns 200 OK as a response, the bot will follow the Payment successful branch. Otherwise, it will follow Form validation failed.
  • Title — specify a title for the item or service to be paid.
  • Description — describe the item or service in detail.
  • Image URL — specify an image URL if you want to attach an image to the invoice.
  • Price — specify the price in dollars, euro, or Russian roubles. Select the currency next to the price field. ! > According to the Telegram restrictions, the price should correspond to the limit of 1–10,000 USD. If you choose another currency, you should specify the price that corresponds to the same limit according to the current dollar exchange rate.
  • Invoice details — specify any bot-defined invoice payload. These invoice details will not be displayed to the client.

Example of filling this block

Click Save and publish the bot.

Now, when the bot moves to the screen with this block in the script, the client will receive the invoice:

Transitions from the block

The Telegram payment block has three transitions:

  • Payment successful.
  • Form validation failed will work if you configure the block parameters incorrectly, e.g., specify an invalid token.
  • Payment failed will work if the client fails to make a payment.
caution
If the client fails to make a payment, the bot will not move to the next screen until the client sends any message to the bot.