Who it’s for
Payments in your Telegram bot
A link to an outside website is one more step where buyers drop off. Here the payment form opens right in the chat, and the bot is notified by webhook and delivers the order at once.
- No company required
- 3% fee
- Payouts in USDT
How it works
From the “Pay” button to the delivered purchase — with no manual checking of transfers.
- 1
The buyer taps “Pay”
Your bot creates an invoice with one API request: the amount, the order number in
order_idand the chat id inmetadata. - 2
The form opens in the chat
The bot sends a button with the
mini_app_urllink — the form starts as a Telegram mini app, no website involved. - 3
Payment via SBP
On a phone — one tap to the bank app, on desktop — a QR code. No card details to type.
- 4
The bot delivers
Your server receives the
invoice.paidwebhook — the bot messages the buyer and hands over what they bought.
What your server receives
An invoice is created with one API request, and your server is notified by webhook. The sample is in Node.js.
order_idandmetadatafrom the request come back inevent.data— use them to deliver the order. The buyer never seesmetadata.- The signature is checked by
verify(token, header, body)— the docs have it in four languages. Test events are signed with the test key, live ones with the live key. "test": truemeans a test-mode payment: no money moved, deliver nothing.- The same event may arrive twice — deduplicate by
ExpressOplata-Event-Id. Respond with2xxwithin 10 seconds, or the delivery is retried. - If
mini_app_urlisnull, give the buyerpay_url— the same form opens in the browser.
{
"amount": "299.00",
"order_id": "tg-48151623-17",
"description": "Subscription, 1 mo",
"metadata": {
"chat_id": 48151623,
"plan": "month"
}
}Webhook handler · Node.js
import express from "express";
import { verify } from "./verify.js"; // the function from /en/docs/#signature
import { db, bot, plans } from "./app.js"; // your code
const app = express();
app.post("/hooks/expressoplata", express.raw({ type: "application/json" }), async (req, res) => {
const event = JSON.parse(req.body); // req.body is the raw bytes the signature covers
const token = event.test ? process.env.EO_TEST_TOKEN : process.env.EO_TOKEN;
if (!verify(token, req.get("ExpressOplata-Signature") ?? "", req.body)) return res.sendStatus(401);
if (event.type !== "invoice.paid") return res.sendStatus(200);
const eventId = req.get("ExpressOplata-Event-Id");
if (await db.isDone(eventId)) return res.sendStatus(200); // a repeat of the same event
const { order_id, metadata } = event.data;
if (event.test) {
console.log("a test payment: the path works, deliver nothing", order_id);
} else {
await plans.activate(metadata.chat_id, metadata.plan);
await bot.sendMessage(metadata.chat_id, "Payment received, access is on");
}
await db.markDone(eventId);
res.sendStatus(200);
});
app.listen(8080);Common questions
All questionsDo I need a website?
No, a bot is enough: the payment form opens right in the chat as a mini app.
Can I do without a developer?
Yes. An invoice is issued in the ExpressOplata bot: an amount and a description — and the payment link is ready to forward to the buyer. The API is for when your bot should issue invoices by itself.
How do I renew a subscription?
With a new invoice: when the period is about to end, the bot sends the buyer a link to pay for the next one. The buyer is never charged automatically.
What does the buyer see?
A form with your project’s name, the amount and the order description. After paying — a confirmation, while your bot gets the webhook and carries on the conversation.
Connect your project
Submit a request on the site or in the bot. The test key works right away, before the project is reviewed.