Crypto Payment Gateway for Telegram Bots: Rules and Setup
A crypto payment gateway for a Telegram bot lets the bot send a customer a payment link, take USDT or USDC on a hosted payment page, and confirm the order in the chat. The code is short. The rules matter more: Telegram requires Telegram Stars for digital goods and services sold in bots, and TON for Mini Apps that use crypto.
This guide explains what Telegram allows (we checked its rules on 15 November 2026), when a crypto payment gateway fits, and how to build the flow with the OrcaRail Node.js SDK and the Telegram Bot API.
What Telegram allows: Stars, TON and third-party providers
Telegram's Bot Developer Terms treat payments differently depending on what you sell:
- Digital goods and services must be paid with Telegram Stars (currency
XTR). Section 6.2 says these payments "cannot be processed through third-party payment providers." Telegram's Stars page answers the question "Can I accept payment in cryptocurrency instead of Telegram Stars?" with "No." - Physical goods and services: section 6.1 says "you can choose a third-party payment provider at your discretion."
- Mini Apps with crypto features must be "based exclusively on The Open Network (TON) blockchain" (section 7). Telegram's blockchain guidelines add: "Regular Telegram bots that do not have a Mini App component are exempt."
What that means for a crypto payment gateway:
| What you build | Can it use a crypto payment gateway such as OrcaRail? |
|---|---|
| A bot that sells digital goods or services, such as e-books, software or in-bot features | No. Telegram requires Stars. |
| A regular bot that sells physical goods or in-person services | Yes. The bot sends a link to the gateway's payment page. |
| A Mini App with crypto payments | Not with OrcaRail. Telegram requires TON, and OrcaRail doesn't support TON. |
| A bot for your own team that creates payment links and posts payment alerts | Yes. Nothing is sold inside Telegram. |
Telegram's terms don't mention crypto checkout links by name, and Telegram can change its rules. Read the linked pages for your case before you launch.
When a crypto payment gateway fits a Telegram bot
- A shop bot for physical products. Customers order in the chat, pay in USDT or USDC on a hosted page, and you ship the order.
- Orders and bookings for real-world services, such as deliveries, repairs or appointments.
- A team bot. Your staff send
/invoice 120to get a payment link for a client, and the bot posts a message when the client pays. - No bot at all. To bill one customer, create a crypto payment link in the dashboard and send it in a private chat.
If you sell digital goods or services inside Telegram, use Telegram Stars.
How the payment flow works
- The customer sends
/buyor taps a button in your bot. - Your server creates and confirms an OrcaRail payment intent, with the Telegram chat ID in
metadata. - The bot sends a message with a Pay button. In the Bot API, an inline keyboard button's
urlis an "HTTP or tg:// URL to be opened when the button is pressed" (Bot API). - The customer pays on the hosted pay page, with the token and network they choose.
- The pay page sends the customer to your
return_url. Your server completes the payment intent, which is a required step, and sends the customer back to the bot. - OrcaRail sends a signed
payment_intent.completedwebhook. Your server verifies it, marks the order paid, and the bot confirms in the chat.
Your API secret stays on your server. The bot only sends the customer a link to the payment page.
Build it with Node.js
You need:
- A bot token from @BotFather.
- A free OrcaRail sandbox organization with an
ak_test_API key and its secret. The same secret signs your webhooks. - The
tokenIdandnetworkIdyou want to receive, for example USDT on Arbitrum, fromGET /payments/networksandGET /payments/networks/:id/tokens. - A server with HTTPS and Node.js 18 or later, plus
npm install express @orcarail/node.
One file, bot.js, handles Telegram updates, the return URL and the OrcaRail webhook:
const express = require('express')
const OrcaRail = require('@orcarail/node').default
const env = process.env
for (const name of [
'ORCARAIL_API_KEY', // ak_test_… in the sandbox
'ORCARAIL_API_SECRET', // also signs your webhooks
'TELEGRAM_BOT_TOKEN',
'TELEGRAM_SECRET_TOKEN', // any random string, also passed to setWebhook
'BOT_USERNAME', // without the @
'BASE_URL', // e.g. https://bot.example.com
'TOKEN_ID', // e.g. USDT
'NETWORK_ID', // e.g. Arbitrum
]) {
if (!env[name]) throw new Error(`${name} is not set`)
}
const orcarail = new OrcaRail(env.ORCARAIL_API_KEY, env.ORCARAIL_API_SECRET)
const returnUrl = `${env.BASE_URL}/orcarail/return`
// Call a Telegram Bot API method (Node.js 18+ has fetch built in)
async function telegram(method, body) {
const res = await fetch(
`https://api.telegram.org/bot${env.TELEGRAM_BOT_TOKEN}/${method}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(body),
}
)
return res.json()
}
// Create a payment for this chat and send a Pay button
async function sendPayButton(chatId) {
const intent = await orcarail.paymentIntents.create({
amount: '25.00',
currency: 'usd',
payment_method_types: ['crypto'],
tokenId: env.TOKEN_ID,
networkId: env.NETWORK_ID,
return_url: returnUrl,
description: 'Coffee beans, 1 kg',
metadata: { chat_id: String(chatId) },
})
const confirmed = await orcarail.paymentIntents.confirm(intent.id, {
client_secret: intent.client_secret,
return_url: returnUrl,
})
await telegram('sendMessage', {
chat_id: chatId,
text: 'Coffee beans, 1 kg: 25 USD. Pay with USDT or USDC:',
reply_markup: {
inline_keyboard: [[{ text: 'Pay with crypto', url: confirmed.pay_url }]],
},
})
}
const app = express()
// 1. Telegram sends bot updates here
app.post('/telegram', express.json(), (req, res) => {
if (req.get('X-Telegram-Bot-Api-Secret-Token') !== env.TELEGRAM_SECRET_TOKEN) {
return res.sendStatus(401)
}
res.sendStatus(200)
const msg = req.body.message
if (msg?.text === '/buy') sendPayButton(msg.chat.id).catch(console.error)
})
// 2. The pay page sends the customer here: complete the payment, then go back to the bot
app.get('/orcarail/return', async (req, res) => {
const id = req.query.payment_intent
// Required. While the payment is not yet confirmed on-chain, this returns
// `processing`: call complete again later, for example from a retry job.
if (id) await orcarail.paymentIntents.complete(String(id)).catch(console.error)
res.redirect(`https://t.me/${env.BOT_USERNAME}`)
})
// 3. OrcaRail sends signed payment events here
app.post(
'/webhooks/orcarail',
express.raw({ type: 'application/json' }),
(req, res) => {
let event
try {
// Checks the timestamped signature and rejects old (replayed) deliveries
event = orcarail.webhooks.constructEventFromHeaders(
req.body,
req.headers,
env.ORCARAIL_API_SECRET
)
} catch (err) {
return res.status(400).send('Invalid signature')
}
res.status(200).json({ received: true })
if (event.type === 'payment_intent.completed') {
const intent = event.data.object
// With live keys, ignore events where event.livemode is false.
// Webhooks can arrive more than once: mark each order paid only once.
telegram('sendMessage', {
chat_id: intent.metadata.chat_id,
text: `Payment received: ${intent.amount} ${intent.currency.toUpperCase()}. Thank you!`,
}).catch(console.error)
}
}
)
app.listen(3000)
Then tell Telegram where to send updates, with the same secret token:
curl "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/setWebhook" \
-d "url=$BASE_URL/telegram" \
-d "secret_token=$TELEGRAM_SECRET_TOKEN"
Telegram then sends the X-Telegram-Bot-Api-Secret-Token header with every update, so your server can reject requests that don't come from Telegram. Last, set your API key's webhook URL to https://<your-server>/webhooks/orcarail (webhook configuration). The Node.js SDK guide covers every method used above.
Test it in the sandbox
- Sandbox keys (
ak_test_) use testnets only, with no real money. - To finish a payment without a wallet, click Simulate payment on the sandbox pay page, or call
orcarail.paymentIntents.simulate(id). See Simulate payments. - Use a second bot from @BotFather for testing, so your live bot never shows test payments.
- Sandbox events carry
livemode: false. With live keys, never fulfill an order from them. - When everything works, switch to a live organization,
ak_live_keys, and mainnet token and network IDs. See Going live.
Security checklist
- Keep secrets on the server. The bot token and the API secret never go into messages, Mini Apps or client code.
- Check Telegram's secret token on every update.
- Verify every OrcaRail webhook with
constructEventFromHeadersand the raw request body. It checks the signature and rejects deliveries older than 5 minutes, so a captured webhook can't be replayed (webhook signatures). - Trust the webhook, not the chat. A customer's "I paid" message or screenshot proves nothing.
- Fulfill each order once. Webhooks can arrive more than once.
- Put
pay_urlin the button. It is the pay page URL without the client secret.
Which coins and networks customers can pay with
When we checked the live API on 15 November 2026, OrcaRail supported 70 mainnet networks: 68 EVM chains, Solana and Bitcoin. USDT and USDC were both listed on Ethereum, Base, Arbitrum, Optimism, Polygon, BNB Chain, Avalanche and Solana. Customers choose the token and network on the pay page. If they pay with a token or network other than the one you receive, the quote adds a bridge fee that the customer pays (Fees).
OrcaRail doesn't support Tron yet, and it doesn't support TON. A customer who holds USDT on Tron or TON can move it to a supported network, for example through an exchange, and pay from there. See Networks and tokens for the current list.
FAQ
Can a Telegram bot accept crypto payments?
For physical goods and services, Telegram's terms let you choose a third-party payment provider, and your bot can send a link to a crypto payment gateway's payment page. For digital goods and services sold in the bot, no: Telegram requires Telegram Stars.
Can I use OrcaRail in a Telegram Mini App?
Not for crypto payments. Telegram requires Mini Apps with crypto features to use only the TON blockchain, and OrcaRail doesn't support TON. For physical goods, use a regular bot that sends a payment link instead.
Do I need Telegram's Payments API?
No. Telegram's Payments API connects a bot to the payment providers you choose in @BotFather. A crypto payment gateway has its own hosted payment page: the bot only sends the link and the confirmation.
What does it cost?
OrcaRail charges 0.5% per completed transaction, with the first 100 transactions free and no fixed fee. The customer pays the network fee for their transfer. See pricing and crypto payment gateway fees compared.
Do I need a website?
You need a small server with HTTPS for the Telegram webhook, the return URL and the OrcaRail webhook, but no online store. Without any code, you can send a crypto payment link in a private chat instead.
