Project: Telegram bot with paid access (Stripe + automatic access issuance)
Project Brief
A developer is required to complete and stabilize the Telegram bot project with paid access to a closed channel/group.
The main task of the system is to automate the sale of access to the Telegram community:
the user selects a tariff in the bot
pays through Stripe
receives access to the closed channel
is automatically removed after the subscription ends
The project is already partially implemented.
Some functionality was developed using ChatGPT and Cursor, so the codebase already exists. However, the architecture turned out to be heterogeneous, and in several places, the system works unstably.
At the moment:
The main task of the developer is to bring the project to a working state and complete the system.
Project Goal
Create a stable system for paid Telegram subscriptions that:
accepts payments through Stripe
automatically issues access to the Telegram channel
automatically removes users after the subscription ends
correctly handles refunds and chargebacks
works reliably during server restarts
Main User Scenario
The user opens the Telegram bot
Clicks Start
Sees the tariffs
Clicks Buy
The bot opens Stripe Checkout
The user makes a payment
Stripe sends a webhook
The system activates the subscription
The user receives an invite link to the closed channel
After the access period ends, the user is automatically removed from the channel.
Current State of the Project
The project already contains:
However:
the architecture is not structured in places
the processing of Stripe webhooks is not fully implemented
the automatic issuance/removal of access works unstably
code reorganization and logic stabilization are required
The developer's task is to analyze the current code and bring the system to a stable state.
Required Architecture
The system should consist of the following components.
1. Telegram Bot
Functions:
The bot performs only interface functions and should not contain complex payment logic.
2. Stripe Checkout
Used for accepting payments.
Planned tariffs:
Support:
3. Webhook Service
A separate endpoint for processing Stripe events.
Functions:
receiving Stripe webhook events
verifying Stripe signature
recording payment information in the database
Main events:
The webhook should not directly perform actions in Telegram.
4. Database
It is recommended to use:
Supabase or PostgreSQL.
Minimum structure:
users
tg_user_id
created_at
subscriptions
tg_user_id
plan
status
access_until
stripe_customer_id
stripe_subscription_id
created_at
Statuses:
pending
active
expired
canceled
refunded
chargeback
payments
stripe_event_id (unique)
amount
currency
type
created_at
5. Access Worker
A separate service or script that runs periodically.
Functions:
Find users with an active subscription
If access is not granted — send invite link
Find users with expired access — remove from the Telegram channel
Process refunds or chargebacks — remove access
The worker must be safe during repeated runs.
Resilience Requirements
The system must work correctly during:
server restarts
repeated Stripe webhook events
temporary Telegram API errors
temporary unavailability of Stripe
All operations must be repeatable and not lead to data loss.
Deployment
It is assumed to run on a Linux VPS.
Main services:
bot.service
worker.service
Scheduler:
cron or systemd timer.
Technologies Used
Preferably:
Python
or
Node.js
Additionally:
Telegram Bot Functions
Main commands:
/start — start the bot
/status — check subscription status
/buy — select tariffs
Button menu:
7 days
1 month
3 months
Check status
Security Requirements
Mandatory:
verification of Stripe webhook signature
protection against replaying events
use of environment variables for keys
handling Telegram API errors
Expected Outcome
The developer must provide:
a fully functional Telegram bot
webhook service for Stripe
worker for access management
configured database
instructions for launching and deploying
Expected Result
After the work is completed, the system should fully automate the process:
the user pays for access
automatically receives access to the Telegram channel
is automatically removed after the subscription ends
the administrator does not perform any manual actions.