Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 DevPort Telegram Payment Bot

Automated Paytm & BharatPe Payment Verification & Instant Telegram Channel Access Bot.

Python PyPI Package DevPort API License

An automated solution for Telegram channel/group monetization. Generates dynamic UPI QR codes, verifies Paytm and BharatPe transactions in real time via the DevPort API, and sends single-use channel invite links automatically.


⚡ Quick Navigation


👤 For Users & Store Owners (Quick Start)

How it Works (User Flow)

  1. User runs /start in Telegram and picks Paytm or BharatPe.
  2. Bot generates a custom QR code pre-filled with the exact product price and order reference.
  3. User pays via any UPI app (PhonePe, Google Pay, Paytm, BHIM, etc.).
  4. Instant Verification:
    • Paytm: User runs /verify [Order_ID].
    • BharatPe: User runs /verify [UTR] OR the bot automatically detects the payment via background reconciliation.
  5. Access Delivered: The bot generates and sends a single-use invite link to your private Telegram channel/group.

💻 For Developers

Tech Stack

  • Framework: Pyrogram (Pyrofork 2.3+)
  • API SDK: DevPort API (devport on PyPI)
  • Database & ODM: MongoDB 7+ with Motor & Beanie ODM
  • Scheduler: APScheduler (AsyncIO)
  • Containerization: Docker & Docker Compose

🚀 Setup & Installation

Option 1: Docker Compose (Recommended)

# 1. Clone repository
git clone https://github.com/ilambit/devport-telegram-paybot.git
cd devport-telegram-paybot

# 2. Configure environment
cp .env.example .env
# Edit .env with your credentials

# 3. Build & Run
docker compose up -d --build

# View logs
docker compose logs -f bot

Option 2: Native Python Run

# 1. Install dependencies
pip install -r requirements.txt

# 2. Run MongoDB locally or set MONGODB_URI to Atlas in .env

# 3. Start bot
python -m bot

🤖 Bot Commands Reference

👥 User Commands

Command Example Description
/start /start Welcome menu, price display, & payment method selector
/verify /verify ORDER_12345 Verify payment by Paytm Order ID or BharatPe UTR

🛠️ Admin Commands (Restricted to ADMIN_IDS)

Command Example Description
/stats /stats Order status counts, revenue total, & API credit balance
/pending /pending List pending orders older than 5 minutes
/approve /approve ORDER_123 Manually approve order & issue invite link
/reject /reject ORDER_123 Invalid UTR Reject order & notify user with custom reason
/lookup /lookup 432112345678 Query live transaction status directly from DevPort API

⚙️ Configuration (.env Reference)

Variable Required Default Description
API_ID Yes Telegram API ID from my.telegram.org
API_HASH Yes Telegram API Hash
BOT_TOKEN Yes Telegram Bot Token from @BotFather
ADMIN_IDS Yes Telegram user IDs of bot admins (e.g. 123456,789012)
DEVPORT_API_KEY Yes DevPort Live API Key (ilm_live_...)
PRODUCT_PRICE Yes 499.00 Price in INR (e.g. 499.00)
PRODUCT_NAME Yes Premium Access Product name displayed to users
DELIVERY_CHANNEL_ID Yes Channel/Group ID (e.g. -1001234567890)
PAYTM_UPI_ID Yes Paytm merchant VPA (name@paytm)
BHARATPE_UPI_ID Yes BharatPe merchant VPA (name@bharatpe)
MERCHANT_NAME Yes My Store Store name displayed inside UPI app
BHARATPE_POLL_INTERVAL_SECONDS No 90 BharatPe auto-polling frequency (sec)
MONGODB_URI No mongodb://localhost:27017 MongoDB connection string
MONGODB_DB_NAME No telegram_payment_bot Database name

🧪 Automated Testing

The project includes unit & integration tests built with pytest and mongomock-motor:

pytest tests/ -v

📁 Project Architecture

devport-telegram-paybot/
├── bot/
│   ├── __main__.py          # Bot entrypoint & lifecycle manager
│   ├── config.py            # Pydantic Settings configuration
│   ├── keyboards.py         # Dynamic Telegram inline keyboards
│   ├── db/
│   │   ├── models.py        # Beanie document models (Order, RedeemedReference, etc.)
│   │   └── session.py       # MongoDB Motor & Beanie bootstrap
│   ├── services/
│   │   ├── devport_client.py   # DevPort API wrapper (httpx + tenacity retries)
│   │   ├── verification.py     # Verification logic & single-use invite delivery
│   │   ├── alerting.py         # Debounced admin DM alerts
│   │   ├── qr_generator.py     # In-memory UPI QR generator
│   │   └── reconciliation.py  # Background job for BharatPe auto-matching
│   └── handlers/
│       ├── start.py         # /start UI & callback queries
│       ├── verify.py        # /verify user command handler
│       ├── admin.py         # Admin management suite
│       └── errors.py        # Global error handler
├── tests/                   # Automated pytest suite
├── Dockerfile               # Container build script
├── docker-compose.yml       # Production multi-container setup
├── requirements.txt         # Pinned python packages
└── README.md                # Documentation

📞 Support & API Registration


📄 License

This project is licensed under the MIT License.


© 2026 Ilambit DevPort. All rights reserved. Built by Ilambit Technologies

About

Telegram bot for automated Paytm & BharatPe payment verification using Ilambit DevPort API. Features dynamic UPI QRs, background auto-reconciliation, double-spend protection, and single-use channel invite delivery. Built with Pyrogram & MongoDB.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages