What paid access includes besides the payment
A payment proves the person paid. After that the bot has to deliver what was paid for: let them into a private channel or chat, send materials, unlock features. When the term ends, it has to take all of that back. In production it is the subscription lifecycle, not the payment itself, that usually breaks.
Accepting payments, invoices and confirmation are covered in Telegram bot payments. This article is about what happens after a successful payment and a month later.
- Payment and a subscription record: who, until when, which plan.
- Granting access: an invite link, a join request, or unlocking features inside the bot.
- Reminders before the term ends.
- Renewal: automatic or by a button.
- Removing access on expiry and handling failures.
- Manual admin actions: grant access, extend, refund.
A subscription as a set of states in your database
The source of truth for whether access is paid is your database, not the member list of the channel. For each user you store the plan, start date, end date and status. The bot works from that data: whether to let someone in, whom to remind, whom to remove.
It helps to model a subscription as a small set of states: awaiting payment, active, expiring soon, expired, cancelled. Transitions happen on events: a payment arrived, a date passed, an admin intervened. That makes the logic easy to test and keeps edge cases from piling up. The same approach for dialogs is described in bot conversation state.
- The end date is stored explicitly, not recomputed from the last payment.
- Every payment is its own row with the payment system's identifier.
- Status changes are kept as history, which helps in disputes with a customer.
- A renewal extends from the current end date while the subscription is still active, not from the payment date, so the customer does not lose paid days.
Two ways to sell a subscription
Telegram has its own paid channel subscriptions in Stars: the bot creates a special invite link with a price, and Telegram charges the member on a schedule. According to the Bot API documentation, the period of such a subscription is currently always 30 days, and the price is set in Stars (1 to 10000). That is the simplest path for a channel, but it is tied to Stars and to a single 30-day cycle.
The second path is your own logic on top of ordinary payments: you decide plans, terms (a week, a quarter, a year), promo codes and trials, and keep the term and reminders in your database. It is more flexible and fits fiat payment providers or unusual terms, but you do all the renewal and access revocation work yourself. Which providers are available depends on the country and their terms, so this is checked before development.
- Native Telegram subscription: simpler, 30-day cycle, paid in Stars, channels only.
- Your own plans on ordinary payments: any terms, but your own renewal and reminder logic.
- The two can be combined: Stars for digital access, a provider for everything else.
How to grant access to a private channel or chat
The bot has to be an administrator of the channel or chat with the right to invite users. Then there are two main approaches. The first is a single-use invite link: the bot creates a link with an expiry time and a member limit of one, and sends it to the person who paid. That way the link cannot be passed around.
The second is a link that requires a join request: the person applies, and the bot checks its database to see whether access is paid, then approves or declines. This is more robust because the decision is made at the moment of joining, using current data. Note that a join-request link cannot also carry a member limit.
- The bot is an administrator with the right to invite users.
- A single-use link: an expiry time and a limit of one member.
- Or a join request checked against your database.
- Revoke a link after use so it does not circulate.
How to remove access when the term ends
Telegram does not know about your subscription, so the bot has to remove people on a schedule. A background job periodically finds subscriptions that have expired and removes those users from the channel or chat. Background jobs and queues are a good fit, so that one failed call does not stop the rest.
The methods differ in an important way. Banning a member keeps them from rejoining through a link until they are unbanned. Unbanning a user who is currently in the chat removes them from it but lets them join again through a new link. For a subscription you usually want the second: removed on expiry, free to return after renewal. Permanent bans are for rule breakers.
- A background job regularly looks for expired subscriptions.
- Removal is safe to repeat: a second call must not break the flow.
- The person is warned before expiry and told after access is removed.
- To see members joining and leaving, the bot must explicitly request chat member updates; they are off by default.
Payment failures and renewal
Payments can fail: insufficient funds, a blocked card, an interrupted checkout. With your own logic, decide on a grace period in advance: how long after the end date the person keeps access while the bot reminds them to renew. It cuts down on upset customers and manual support.
Native Stars subscriptions have their own behaviour: the bot receives an update when the subscription state changes (cancelled, re-enabled or failed) and has to react to it rather than assume the subscription lasts forever. A user can cancel renewal, and access stays until the paid period ends. Handling redelivered updates and duplicate payments is covered in idempotency and retries.
- A grace period after the end date: yes or no, and how long.
- A repeated payment event does not extend the subscription twice.
- Cancelling renewal does not take away days already paid for.
- Refunds and manual extensions by an admin are recorded in the history.
What to decide before development
Most of the cost and timeline goes into the details of the rules, not into the payment code. Agree on them with the client up front so the data model does not have to change after launch.
If you are weighing a custom build against something ready-made, see ordering a Telegram bot or building it yourself. We build such bots as part of Telegram bot development.
- What is sold: access to a channel, a chat, materials or bot features.
- Plans and terms, trial period, promo codes.
- Whether auto-renewal is needed and how to remind about expiry.
- Grace period and refund rules.
- Who manages subscriptions manually and where: an admin panel or bot commands.
- Which payment system suits your audience and country.