Home / Blog & Tutorials / Monetization

How to Accept UPI, Cards & Crypto Payments Inside Telegram Bots with Razorpay

Telegram is one of the highest-converting platforms for selling digital subscriptions, premium courses, trading signals, and software tools. In India, enabling instant UPI payments (Google Pay, PhonePe, Paytm) increases conversion rates by up to 300%.

Generating Razorpay Payment Links in Python

import os
import razorpay
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import ApplicationBuilder, CommandHandler, ContextTypes

client = razorpay.Client(auth=(os.getenv("RAZORPAY_KEY_ID"), os.getenv("RAZORPAY_KEY_SECRET")))

async def buy_vip(update: Update, context: ContextTypes.DEFAULT_TYPE):
    user = update.effective_user
    
    # Create dynamic payment link
    payment_data = {
        "amount": 19900,  # 199.00 INR in paise
        "currency": "INR",
        "accept_partial": False,
        "description": "BotifyHost VIP Subscription (1 Month)",
        "customer": {
            "name": user.first_name,
            "email": f"user_{user.id}@botifyhost.app"
        },
        "notify": {"sms": False, "email": False},
        "reminder_enable": True,
        "notes": {"telegram_user_id": str(user.id)}
    }
    
    payment_link = client.payment_link.create(payment_data)
    link_url = payment_link["short_url"]
    
    keyboard = [[InlineKeyboardButton("💳 Pay ₹199 via UPI / Card", url=link_url)]]
    reply_markup = InlineKeyboardMarkup(keyboard)
    
    await update.message.reply_text(
        "Click below to complete your payment securely via UPI or Card. Once paid, you will instantly receive your VIP invite link!",
        reply_markup=reply_markup
    )

Automating Channel Invite Generation

Once your webhook receives confirmation that the payment status is paid, your bot can call Telegram's create_chat_invite_link API with member_limit=1 to deliver a one-time single-use link automatically!

BotifyHost

Written by Alex Johnson

Specialist at BotifyHost Cloud Infrastructure. Passionate about Telegram MTProto protocol, Python asynchronous concurrency, and building high-performance hosting clusters for developers worldwide.

Host Your Telegram Bot 24/7 on BotifyHost

Say goodbye to laptops running overnight and sleeping web dynos. Deploy your bot in 30 seconds with 99.99% uptime, built-in code editor, and live logs.

Need Help? Chat on Telegram