Lanka Lanka docs

Payment in stars

The bot sends an invoice to be paid in Telegram Stars. The person pays in Telegram's window without leaving the chat.

The "Payment in stars" step in the editor

How to set it up

  • The Title and the Description show in the invoice in the chat. The title takes up to 32 characters, the description up to 255.
  • Picture in the payment window — the person sees it after tapping "Pay".
  • Amount in stars — a whole number of stars. It can come from a variable.
  • Add a "Paid" step. The bot goes to it when the person pays.

The invoice stays in the chat and can be paid any time. So after sending it the bot goes on to the "Straight on" step at once. The "Paid" branch runs only after the payment.

If the amount is not a whole number, the bot sends no invoice and goes on.

Telegram allows digital goods and services to be sold for stars only. For physical goods and services there is Payment by card.

If it is not paid in time

In the "Wait for payment" field set a time, 2 hours for example, and add a "Not paid in time" step. If the person does not pay in this time, the bot goes to it. There you can remind them of the payment or offer something else. If the person has paid, the step does not run.

"Then the invoice can no longer be paid" — once the time is up, Telegram does not let the invoice be paid. The person sees that it is no longer valid.

After the payment

The bot saves the payment into the variable in the "Save to" field, last_payment by default. The variable belongs to the person and outlives the conversation:

  • user.last_payment.amount — the number of stars;
  • user.last_payment.currency — XTR;
  • user.last_payment.paid_at — when it was paid;
  • user.last_payment.charge_id — the payment's number in Telegram.

These values go into a message as tokens, or a Condition step can check them.

For the payment to open a closed channel, put the Grant channel access step in the "Paid" branch.

Stars can be refunded to the person on the "Payments" tab.

If the step is deleted from the flow, Telegram does not let the invoice be paid. The person sees that it is no longer valid.