You can accept payment using Telegram Stars for di

Accept payment withTelegram Starsfor digital goods or services, there are two main ways: through the code (Bot API) or using ready-made chatbot constructors.

The main feature of Stars is youno need to connect third-party payment gateways(like Stripe or YuKassa). Telegram itself acts as a merchant, and the fieldprovider_tokenremains empty in the code.

Below we will analyze how this process works from the inside.

1. Integration scheme via API (for developers)

If you write the bot yourself (for example, in Python withaiogramor Node.js withtelegraf), the whole process is tied to the standard Bot Payments API.

Step 1: Billing (sendInvoiceorcreateInvoiceLink)

In order for the user to see the payment window, the bot must generate an invoice.

  • currency— be sure to passXTR(this is the international code of Telegram Stars).

  • provider_token— leaveempty string ("").

  • PRICES— indicate the cost in whole Stars (1 unit = 1 Star).

Example of parameters in Python (aiogram):

Python
awaitbot.send_invoice(
    chat_id=message.chat.idTitle="Intermission 5"Buy vipDescription"Access to the closed functionality of the bot for 1 month",
    payload="user_id_12345_premium",  # Your internal verification dataprovider_token="",                # Stars is always empty!currencyXTR,
    prices=[LabeledPrice(label="Premium"amount50)] # 50 Stars
)

Step 2: Pre-Sales Verification (pre_checkout_query)

When the user clicks "Pay", Telegram sends a request to your botpre_checkout_query.

Critically importantYou have exactly10 Secondsto answer the methodanswerPreCheckoutQuery(true). If the server freezes or does not respond in time, the payment will be canceled. Here it is checked whether the product is in stock and whether the price has changed.

Step 3: Fix the payment (successful_payment)

After the successful write-off of Stars, the bot receives a regular message, but with a special fieldsuccessful_payment. At this moment, you give the user their digital product, save the transaction in the database and send "Thank you for the purchase!".

2. Via bot builders (no code)

If you use platforms likeLeadTex, PuzzleBot, SendPulse, Zeneduetc.

  1. Go to the integration/payment acceptance settings inside the builder.

  2. Select payment gatewayTelegram Stars.

  3. In the scenario (nodes), select the "Wait for payment" or "Issue an invoice" block, specify the amount in Stars and link the action for successful payment (for example, sending a file or opening a link).

3. How to accept Stars in Telegram channels?

If we are not talking about a bot, but about monetizing the channel, the code is not needed at all:

  • Paid Posts (Paid Media):When creating a post with a photo or video, hold down the Publish button (in the mobile app) and select"Make Content Paid"by specifying the price in Stars. Content will be washed out for those who have not paid.

  • Paid Reactions:In the channel settings, go toReactions -> Enable paid reactions. Users will be able to send Stars as reactions to the author.

  • Paid referral links:Through channel management, you can create an invoice link that automatically charges Stars (for example, monthly) for being in a private channel.

Where do the Stars come from and how to bring them out?

All received Stars are accumulated on the balance of your bot or channel.

  1. Where to view the balance:Open your bot profile (or channel settings) -> tabBalance(orStatistics -> Balance) A detailed history of all transactions will be visible.

  2. Telegram rules:According to the rules of the platform, for legal work in the bot, three commands for users must be implemented:/paysupport(payment support),./support(general support) and/termsUser Agreement

  3. Money withdrawalAccumulated Stars can be deducedafter 21 daysafter receiving them. Withdrawal is carried out in cryptocurrencyToncoin (TON)through the official platform. From there, they can be transferred to any crypto wallet or exchange.