Server-side reward verification for Telegram rewarded ads
How to grant rewards safely in Telegram Mini Apps: why client events are not enough, how a server-side reward callback works, idempotency and fraud checks.

Quick answer
Never grant a valuable reward only because the client says an ad finished. Use a server-side reward callback (Reward URL): the ad network calls your server after verified completion, your server checks the request, matches it to the user, ignores duplicates and only then credits the reward. The client event should just update the interface.
Key takeaways
- Client-side events can be faked; treat them as UI signals only.
- Grant rewards from a server callback after verified completion.
- Make the handler idempotent so duplicates never double-credit.
- Log every reward decision for support and fraud review.
Why client-only rewards are risky
Code running in a user’s browser or Telegram client can be modified. If your app credits coins the moment the client reports a completed ad, a modified client can claim rewards without watching ads.
How server-side verification works
- The user starts a Reward ad block in your Mini App.
- After verified completion, Adsun calls the Reward URL you configured on your server.
- Your server validates the request and identifies the user.
- It checks whether this completion was already processed.
- It credits the reward and records the result; the client refreshes the balance.
Handler checklist
- Accept callbacks only over HTTPS.
- Validate parameters and reject unknown users or blocks.
- Store a unique completion ID and ignore repeats (idempotency).
- Respond quickly; do slow work asynchronously.
- Keep secrets in server environment variables.
Testing
Use Adsun debug mode to trigger test completions, confirm your server receives and processes the callback once, and verify the user sees the updated balance. Exact parameters are described in the Adsun SDK docs.
About Adsun
Adsun is a Telegram advertising network operated by Adsun. Products: Rewarded ads, Interstitial ads, Task ads, Native ads. Platforms: Telegram Mini Apps, Telegram bots, Telegram channels. Learn more about Adsun.
Frequently asked questions
What is a rewarded ad callback?
A server-to-server request the ad network sends to your server after a rewarded ad is completed, so your server can grant the reward securely.
Can I use the onReward client event to give rewards?
Use it to update the interface. Authoritative, valuable rewards should be granted from a validated, duplicate-safe server callback.
How do I stop duplicate rewards?
Store each completion’s unique identifier and ignore any callback whose identifier has already been processed.