Receiving payments in the Telegram bot in 30 minutes, YooKassa, Stripe
Next step
Open the bot or continue inside this section.
Article -> plan in AI
Paste this article URL into any AI and get an implementation plan for your project.
Read this article: https://vibecode.morecil.ru/en/oplaty-i-podpiski/priem-platejei-telegram-bot/
Work in my current project context.
Create an implementation plan for this stack:
1) what to change
2) which files to edit
3) risks and typical mistakes
4) how to verify everything works
If there are options, provide "quick" and "production-ready". How to use
- Copy this prompt and send it to your AI chat.
- Attach your project or open the repository folder in the AI tool.
- Ask for file-level changes, risks, and a quick verification checklist.
You already have a Telegram bot (or you just launched it). Now the most important thing is monetization.
With the help of native payments Telegram (sendInvoice method), you add the button "Pay" directly to the chat. The user pays by card without leaving Telegram. No external links, no redirects.
Today we will analyze two real providers (for February 2026):
| Провайдер | Лучше для кого | Комиссия (примерно) | Поддерживаемые методы в Telegram | Подписки (recurring) |
|---|---|---|---|---|
| YooKassa (ЮKassa) | RU / СНГ / Литва | от 2,8 % + НДС (карты РФ) | Карты РФ, YooMoney, SberPay | Через полный API |
| Stripe | Международная аудитория | 2,9 % + 0,30 $ (US/EU) + доп. за иностранные карты | Visa, MC, Apple Pay, Google Pay | Через Stripe Billing (отлично) |
Telegram Payments is a free wrapper from Telegram. Neither Telegram nor you store card data. Everything is handled by the provider.
1. What it takes to start (10 minutes)
Bot (already have or create using
@BotFather→/newbot).** Provider account**:
- YooKassa: yookassa.ru/joinups - register as an IP/self-employed/LLC. The store is activated in 1-2 days.
- Stripe: stripe.com - for Lithuania/EU/international. Verification is faster, but RU cards can be limited.
Connect the provider to BotFather (the most important step!):
Open @BotFather → /mybots → select your bot → Payments
- YooKassa: Select "YooMoney: payments" (or "YooMoney: test" for the test) → log in to chat with YooMoney bot → return to BotFather → copy provider token.
- Stripe: Select "Stripe LIVE MODE" (or TEST) → connect your Stripe account.
The token looks something like this:
381764678:TEST:1234567890abcdef (test)
381764678:LIVE:XXXXXXXXXXXXXXXX (combat)
Done! You have provider_token.
2. Architecture (how everything works)
User: /buy
Bot → sendInvoice (with provider token)
User → clicks “Pay” → enters card data in the secure Telegram window
Telegram → pre checkout query (bot must respond in 10 seconds)
Telegram: Successful payment
Bot → gives access / sends a file / activates a subscription
Key updates that required handle bot:
pre_checkout_query– order confirmationsuccessful_payment- successful paymentshipping_query(if you need a delivery address)
3. Ready-made prompts for Claude / Cursor / Grok (copy-paste)
Prompt #1: Full bot in Python + aiogram 3.x (YooKassa + Stripe)
Write a full Telegram bot on aiogram 3.13+ (async), which accepts payments via YooKassa or Stripe.
Requirements:
The /buy command sends invoice to RUB 990 (YooKassa) and USD 15 (Stripe) depending on the user’s choice
- provider token stored in .env (two tokens: YOOKASSA TOKEN and STRIPE TOKEN)
Processors: pre checkout query (always ok=True), successful payment (write to the user database, give access)
SQLite (user table: id, paid until, payment id)
- After successful payment, send a message "Access is open!" buttons
Complete error processing, logging
The code must be ready to run on Railway/Render/VPS
Prompt No. 2: Node.js + Telegraf
Generate a ready-made Telegram bot on Node.js + Telegraf 4.x + dotenv.
Functional: /pay command, inline buttons "Pay 990п (YooKassa)" and "Pay $15 (Stripe)".
Use sendInvoice with the correct provider token.
Pre checkout query and successful payment.
After payment, save to JSON file or Supabase.
The code must be run by one npm start command.
Prompt No. 3: For subscriptions (recurring)
The user wants a monthly subscription. Telegram Payments does not support recurring natively. Generate architecture:
1. First payment via sendInvoice (YooKassa)
2. After successful payment, create recurring payment in YooKassa API / Stripe Billing
3. Webhook by YooKassa/Stripe on /webhook for automatic renewal
4. In case of unsuccessful write-off, disable access
Write ready-made code + prompts to create a webhook.
4. Step by step implementation in 30 minutes
Step 1 (5 min) Register with YooKassa/Stripe and connect to BotFather.
Step 2 (10 min) Copy Prompt No. 1 or No. 2 in Claude/Cursor → get the finished bot.
Step 3 (5 min)
Create .env and insert tokens.
Step 4 (5 min)
Launch a bot (python main.py or node index.js).
Step 5 (5 min) Test:
- YooKassa test: cards 4111 1111 1111 1111, CVC any, term any future
- Stripe test: 4242 4242 4242 4242 4242
5. Webhooks and production
For production required configure webhook (not long polling):
# aiogram пример
await bot.set_webhook("https://your-domain.com/webhook")
YooKassa and Stripe also send their webhooks (for returns, recurring). Add the endpoint /yookassa_webhook and /stripe_webhook.
Example of processing successful payment (aiogram):
@dp.message(F.successful payment)
async def got payment(message: Message):
payment = message.successful payment
#payment.provider payment charge id - transaction ID for YooKassa/Stripe
Message.answer(f) Thank you! Payment passed. ID: {payment.provider payment charge id}}
# here activate the subscription / issue the file
6. How to maintain and scale
- Returns: in your YooKassa/Stripe account (or via the
refundAPI). - Stripe automatically, YooKassa via support.
- **Analytics: Add a successful payment to Google Sheets/Supabase.
- Multiple products: Use
payload- JSON with product ID. - Subscriptions: After the first payment, switch to the full YooKassa API or Stripe Subscriptions (Prompt #3).
- ** Taxes 54-FZ**: YooKassa automatically generates checks if you add
provider_datawith receipt.
7. Frequent Questions (FAQ)
Is it possible to accept payments from Russia without a VPN? ** YooKassa works perfectly.
Does it work on iOS for digital goods? ** For digital goods, use Telegram Stars (provider token=') - Apple has allowed since 2025.
How long does it take to get the store approved? ** YooKassa - 1-3 days, Stripe (Lithuania) - up to 7 days.
Do you need SSL for webhook? ** Yeah. Use Railway, Render or Cloudflare Tunnel.