DEV Community

Steve Jefferson
Steve Jefferson

Posted on

How to charge for your Telegram bot in Python (license keys + auto-cancel with Whop)

You built a useful Telegram bot. People use it. You'd like a few of them to pay. That's usually where it stops, because billing is the boring, risky part.

Here's the flow I ended up with:

  1. A customer buys on Whop, which issues a license key (you need Whop's Software Licensing app on the product).
  2. They send /activate YOUR-KEY to the bot.
  3. The bot checks the key against the Whop API and locks it to their Telegram ID, so one key means one account.
  4. The bot stores paid users in a small local database and gates premium commands behind it.
  5. When someone cancels or a payment fails, Whop sends a webhook (membership.deactivated) to a small FastAPI server, which removes their access.

Two things that trip people up:

  • No Software Licensing app on the product means no keys are ever issued, and every activation fails.
  • Your Whop API key needs member:basic:read and member:manage, the second one so the bot can lock a key to a user.

Run the bot, the webhook server and background jobs as one process, and it deploys cleanly to Railway, Render or a VPS behind a reverse proxy.

I packaged all of this, plus three ready-to-run templates (crypto tracker, group concierge, WhatsApp Cloud starter) and a 5-module guide, into a kit: https://whop.com/the-python-bot-monetization-kit/the-python-bot-monetization-kit-1f/ ($49 one-time).

Questions welcome in the comments.

Top comments (0)