Take Stars payments in your bot: invoices, subscriptions and refunds
What it is
Digital goods and services in bots and Mini Apps sell only for Telegram Stars, currency XTR. Your bot issues an invoice, confirms the order at checkout, delivers after payment and keeps the payment ID for refunds. One parameter turns an invoice link into a 30-day subscription.
How to do it
- Use
sendInvoice, orcreateInvoiceLinkfor a link:currencyXTR, emptyprovider_token, exactly one item inprices, your order ID inpayload. - Subscription: add
subscription_period2592000 (30 days) tocreateInvoiceLink. - In a Mini App, open the link with
openInvoice;invoiceClosedreportspaid,cancelled,failedorpending. - On
pre_checkout_query, callanswerPreCheckoutQuery:oktrue, or false with anerror_messagefor the buyer. - Deliver only after
successful_payment, and save itstelegram_payment_charge_id. Subscription payments also carryis_recurring,is_first_recurringandsubscription_expiration_date. - Since July 2026, the
subscriptionupdate reportscanceled,activeorfailed. - Refund with
refundStarPayment; refunds arrive asrefunded_paymentservice messages.editUserStarSubscriptioncancels a renewal or lets the user re-enable one your bot canceled. - Reconcile with
getStarTransactionsandgetMyStarBalance.
Watch out
- Answer the pre-checkout query within 10 seconds, or the payment is cancelled.
payloadis 1–128 bytes,title1–32 characters,description1–255; tips don't work in Stars.- A subscription costs at most 10,000 Stars; one user can hold several.
getStarTransactionsreturns 1–100 records per call.- A chargeback can take Stars back after
successful_payment. - Test first in Telegram's test environment.
With Gem
Gem doesn't run invoices for your own bot: a creator's own bot isn't available yet. In a Gem project, /myprojects › Sell takes Stars for your offers through @gembot, which Gem holds.
Sources
- https://core.telegram.org/bots/payments-stars
- https://core.telegram.org/bots/api#payments
- https://core.telegram.org/bots/webapps#initializing-mini-apps
- https://core.telegram.org/bots/api-changelog#july-14-2026