Webhook integration for the Telegram Stars API
Get order and payment status in real time via webhook: signature verification, idempotency, retry and best practices. Automatic integration with the StarsPaymee API — 18 Q&A.
A webhook is an HTTP request that the StarsPaymee API sends to your server automatically when an order or payment status changes. Thanks to it you don't poll the status constantly — instead you react as soon as a «delivered» or «failed» event arrives. The webhook is the heart of automatic integration.
What is a webhook and why is it needed?
With polling you ask «is the order ready?» every few seconds — which wastes resources and is slow. With a webhook the API notifies you as soon as an event happens. It's faster, cheaper and closer to real time.
- Event type — order.delivered, order.failed, payment.success.
- Order ID and status.
- A timestamp.
- A signature — to verify authenticity.
How do I connect a webhook?
- 1. Provide a URLIn the StarsPaymee panel provide your webhook URL (HTTPS).
- 2. Verify the signatureVerify the signature with a secret key on every incoming request.
- 3. IdempotencyStore the event ID and don't reprocess a repeat.
- 4. Respond quicklyReturn 200 OK; put heavy work in a queue.
Need webhook integration? Contact Business.
@StarsPaymee_botBest practices
- Use HTTPS only.
- Always verify the signature.
- Prevent repeats with an idempotency key.
- Account for a retry policy.
- Log and monitor events.
Related: Stars API, Click callback and connecting a payment API to a bot.
- core.telegram.org/bots/webhooks — webhook guide
- core.telegram.org/bots/payments — bot payments
Frequently asked questions
What is a webhook?
Difference between webhook and polling?
How do I connect a webhook?
Which events arrive?
Why a signature?
What is idempotency?
How fast should I respond?
Will there be retries?
Is HTTPS required?
Can I test it?
Are logs needed?
What if the webhook didn't arrive?
Can I subscribe to several events?
Is it related to the Click callback?
What else for security?
Is it in JSON?
Is documentation provided?
How do I start?
Connect the webhook
Through StarsPaymee Business, build a real‑time integration with webhooks.
Open the botRelated articles
Can a Bot Widget Take Stars Payments? Storefront, Invoice and TON Requests
A widget can serve as a storefront, but a separate invoice is the better way to collect Stars. This article covers widget limits, steps for updating prices and how a TON wallet request affects buyer trust.
ReadRich messages and Stars payments: can a bot’s catalog include an invoice?
Yes, a rich message can be your catalog and price table, but take Stars payments with a separate invoice. The docs don’t show how to attach one. Inside: a table of blocks and a 6-step sales flow.
ReadStop Spam Accounts Joining Your Telegram Group: AI Guardian or Stars?
The main way to stop spam at the door is to require join requests and let an AI guardian bot screen them. Stars barriers are an extra filter. Inside: a comparison table, setup steps and test examples.
Read
