Delivering digital goods after a Telegram Stars payment: files, keys and links
Delivering digital goods after a Telegram Stars payment: sending files, licence keys and access links, expiring links, re-delivery and what to do when delivery fails.
Published:

Delivering digital goods after a Telegram Stars payment works best when the item reaches the buyer in the same chat within seconds, can be sent again on request, and cannot easily be shared with people who did not pay. In practice that means three patterns: send the file directly, send a unique key or code, or grant access through a personal link. This guide explains when to use each one and how to handle re-delivery and failures.
What you need before you start
- A recorded payment for every order. Delivery should start only after your bot has stored the
successful_paymentupdate with itstelegram_payment_charge_id. How to do that safely is covered in our Stars invoice guide. - A product catalogue with delivery types. For each product, note whether it is a file, a key, an access link or a feature inside your bot.
- Storage for delivered items. Keep a record of what each buyer received, so you can send it again later.
- A support entry point. A working
/paysupportcommand for buyers who did not receive their item.
Step-by-step: a delivery flow that works
- Look up the order. Use the
invoice_payloadfrom the payment to find the product and the buyer. - Prepare the item. Pick the file, reserve a key from your pool, or create a personal access link.
- Send it in the chat. Send the file or message to the buyer from the bot. Add one line that explains what they received and how to use it.
- Record the delivery. Save what was sent, when, and the message or file identifier. Mark the order as delivered.
- Offer re-delivery. Tell the buyer how to get the item again, for example with a "My purchases" button or command.
- Watch for failures. If sending fails, retry after a short delay. If it keeps failing, alert yourself and tell the buyer that the item is delayed.
Options and settings explained
| Delivery type | How to send | Good for | Watch out for |
|---|---|---|---|
| File in the chat | sendDocument, sendAudio or sendVideo; reuse the stored file_id | E-books, templates, music, presets | Files can be forwarded; consider protected content where it fits |
| Unique key or code | A text message with a key taken from your pool | Software licences, vouchers for your own service | Never give the same key twice; mark it as used immediately |
| Personal invite link | createChatInviteLink with a member limit or expiry | Private channels and groups with paid content | Revoke unused links; check membership on renewals |
| Feature inside the bot | Update the user's record and confirm in a message | Credits, premium modes, extra limits | Show the new balance so the buyer sees the change |
| External account access | Link the Telegram user to an account on your site | Web tools and SaaS | Use a secure, one-time login link |
Expiring and personal links
When access is given through a link, make it personal and short-lived. For a private channel, an invite link with a member limit of one and an expiry date stops it from being shared widely. For downloads hosted on your own server, use signed URLs that expire after a short time, and create a new one each time the buyer asks. Keep the permanent copy in the chat, where only the buyer can see it.
Protected content
The Bot API lets bots send messages with protected content, which prevents forwarding and saving in Telegram apps. It does not make copying impossible, but it reduces casual sharing. Tell buyers in advance if files cannot be saved, so they are not surprised.
Re-delivery on request
Buyers lose files, change phones or delete chats. A simple "My purchases" command that lists past orders and sends each item again saves many support messages. Because you stored the file_id or the key, re-delivery is instant and does not need a new payment.
Common mistakes and how to avoid them
- Sending a public link. A permanent public download link will be shared. Use the chat itself or personal, expiring links.
- Reusing keys. If two buyers get the same licence key, both will complain. Reserve keys in a transaction and mark them used at once.
- No instructions. A file with no explanation leads to "how do I open this?" messages. Add one or two lines of guidance.
- Delivery only in the mini app. If your mini app shows the item but the bot does not send a copy, buyers lose it when they close the app. Send a chat message too.
- Ignoring failed sends. Users who blocked the bot or deleted the chat cannot receive messages. Detect the error and show the item the next time they open the bot.
When delivery fails completely
If you cannot deliver, for example because the product is no longer available, tell the buyer quickly and refund the payment with refundStarPayment. Do not leave a paid order without a clear answer. Buyers' rights and expectations are summarised in our refund and /paysupport guide, and the rules for selling digital goods are in this article.
Where PayStars fits
If the item you deliver is itself Telegram Stars or Premium, for example as a reward, you do not need to send files at all. The PayStars API delivers Stars or Premium directly to a public @username, checks the username before ordering, and returns a TxId for every order.
FAQ
How should a bot deliver a file after a Stars payment?
Send it in the chat with sendDocument or a similar method, and store the returned file_id so you can send it again instantly later.
How do I sell access to a private channel for Stars?
After payment, create a personal invite link with createChatInviteLink, limited to one member or with an expiry date, and send it to the buyer.
Can I stop buyers from forwarding paid files?
Bots can send protected content, which blocks forwarding and saving in Telegram apps. It reduces sharing but cannot prevent every copy.
What if a buyer loses the item?
Offer a My purchases command that lists past orders and re-sends each item from your stored records, without a new payment.
What should I do if I cannot deliver at all?
Tell the buyer promptly and refund the payment with refundStarPayment using the stored charge ID.
Sources
Buy Stars and Premium with USD (USDT)
Via API key: 0% (plain Fragment price). Via the website: 5%.
More news
Handling successful_payment reliably in a Telegram Stars botHow to handle successful_payment reliably in a Telegram Stars bot: idempotent orders, storing the charge ID, retries, crash recovery and daily reconciliation.Read →
Refunding a Telegram Stars payment as a developer: when and howRefunding a Telegram Stars payment as a developer: when to refund, how refundStarPayment works, what to log, how to tell the user and how to limit abuse.Read →
Selling SaaS access through Telegram with Stars subscriptionsHow to sell SaaS access through Telegram with Stars subscriptions: mapping plans, linking Telegram users to accounts, renewals, cancellations and common pitfalls.Read →