How to accept Stars payments in a bot
If your Telegram bot or Mini App sells digital goods or services, payments inside Telegram have to be in Telegram Stars. Here's a short walk through how Stars payments work in the Bot API, what to watch out for and how you withdraw the earnings.
Why it has to be Stars
Under Telegram's rules, digital goods and services — courses, subscriptions, in-game items, access to content — are sold for Stars only. Other currencies, third-party payment providers and cryptocurrency aren't allowed for digital goods. The documentation says Telegram cannot show a bot or Mini App to users of its mobile apps if it sells digital goods any other way. For physical goods and services, regular payment providers keep working as before.
How a payment works
- Send an invoice (sendInvoice) or create an invoice link (createInvoiceLink) with the currency "XTR", leaving provider_token empty for digital goods.
- The user confirms paying with Stars in the payment window.
- Your bot gets a pre_checkout_query — answer it with answerPreCheckoutQuery within 10 seconds, or the transaction is cancelled.
- Once paid, a successful_payment message arrives. Deliver only after that: answering the pre-checkout query doesn't mean the payment went through.
- Store the telegram_payment_charge_id from successful_payment — you'll need it for a refund.
Refunds and /paysupport
You refund a Stars payment with the refundStarPayment method, using that same telegram_payment_charge_id. Telegram's terms say that if you can't fulfil an order, returning the Stars in full carries no penalty.
Every bot and Mini App must respond to the /paysupport command and handle payment requests from users. Disputes are the developer's responsibility: Telegram isn't obliged to mediate. If a developer refuses a legitimate refund, the user can report them.
What happens to the Stars you earn
- the bot's balance is shown separately and can be withdrawn as a reward through Fragment — about $0.013 per Star;
- or spent promoting that same bot on Telegram Ads — about $0.02 per Star;
- Stars may not become available for rewards or ads for up to 21 days after they're received;
- if a buyer got Stars through Apple or Google and has the store refund them, Telegram may take those Stars back from the bot's balance.
Telegram sets these values itself and can change them; the current one is shown in the app. More in the guide on withdrawing earned Stars.
Practical tips
- set the price in Stars and say clearly, before payment, what the user gets;
- process each successful_payment exactly once: a repeated update or a restart must never deliver twice;
- keep a payment log: user, amount, charge_id and delivery status;
- answer /paysupport quickly — good support means fewer complaints and refunds.
Testing payments in your own bot
To run the whole payment flow in your live bot, your account needs Stars. A small package is enough: send yourself an invoice, pay it, then refund the Stars to yourself with refundStarPayment, which also tests your refund path. At Qulay Star you buy Stars with an Uzcard or Humo card through Payme or Click, and they usually reach the account within a few minutes.
Read next
- 🤖 Paying with Stars in bots and Mini Apps
How paying with Stars in Telegram bots and Mini Apps works: what the payment window shows, what to check before you pay and how refunds are handled.
- 📤 How to withdraw the Stars you've earned
How to withdraw Telegram Stars earned by a channel, a bot or paid messages: Fragment, the 21-day wait, what a Star is worth, and spending Stars on ads instead.
- ✨ How to turn a gift into a collectible
Upgrading a Telegram gift: what a collectible is, its model, backdrop and symbol, wearing it, transferring it, moving it to the blockchain and crafting new ones.