Full tutorial: create invoices, send payment addresses to users, handle webhooks, and deliver digital goods automatically on confirmation.
Telegram bots are a popular distribution channel for digital goods, VPN subscriptions, proxy services, and premium content. Accepting crypto payments directly in a bot eliminates friction: the user stays in Telegram, pays with their crypto wallet, and receives access automatically — no external checkout page required.
Architecture Overview
- ✓User sends /buy command to the bot
- ✓Bot calls Bekena API to create a payment invoice
- ✓Bot sends the USDT address + amount to the user in Telegram
- ✓User pays from their wallet
- ✓Bekena sends a payment.confirmed webhook to your server
- ✓Server delivers the product (sends credentials, enables access, etc.)
- ✓Bot sends a confirmation message to the user
Setting Up the Bot
Create a bot with @BotFather on Telegram, get your bot token, and set up a webhook so Telegram sends messages to your server. You'll need an HTTPS endpoint — Telegram requires SSL for webhooks.
Creating a Payment Invoice
Handling the Payment Webhook
Handling Expired Invoices
When an invoice expires without payment, Bekena sends a payment.expired webhook. Send the user a message letting them know the payment window closed and provide a /buy command to generate a new invoice. Keep your invoice expiry reasonable — 30–60 minutes gives users enough time without leaving addresses active indefinitely.
User Experience Tips
- ✓Always show the exact amount and network (never just "send USDT")
- ✓Include a QR code for the payment address — use a QR library or Bekena's hosted invoice page
- ✓Add a "Check payment" button that polls the Bekena API for status
- ✓Send a reminder message after 45 minutes if payment hasn't confirmed yet
- ✓Keep transaction records for support queries — users sometimes send to wrong address