Selling Gift Cards Inside Telegram: The Mini App Blueprint
Telegram has more than 900 million monthly active users, and a growing share of them make in-app purchases, fund games, and trade digital goods without ever leaving the app. Telegram Mini Apps are full web applications that run inside a Telegram chat — no external browser tab, no redirect, no friction. For gift card resellers who already run Telegram channels or communities, a Mini App is a direct sales surface your customers open every day.
This guide walks through building a working gift card Mini App backed by the FazerCards API, from bot setup to live code delivery, using a lightweight Node.js backend you can deploy on any HTTPS host.
Prerequisites
Before you start, have the following ready:
- A FazerCards account with an API key — the 5-day Gold trial gives full API access, no card required
- A Telegram bot token (created via @BotFather inside Telegram)
- A Node.js hosting environment with an HTTPS domain — Vercel, Railway, and Render all work; Telegram requires HTTPS for Mini Apps
- Basic familiarity with HTML/JavaScript and REST APIs; no mobile SDK experience needed
If you want a lighter, text-only experience without a visual catalog UI, the Telegram bot approach is a faster starting point — though far less suited to browsing a large gift card catalog.
Step 1: Create a Bot and Register the Mini App
Open Telegram and message @BotFather. Send /newbot, follow the prompts, and save the bot token. Next, send /newapp to BotFather: it asks for a title, a description, a cover image, the URL where your Mini App will be hosted and a short name. Point it at your deployment domain and BotFather returns a direct link in the form t.me/yourbotname/shortname that opens the store anywhere Telegram runs.
Finally, use /setmenubutton to put a store button next to the message field in every chat with your bot. Users who message you once see the button on every return visit — a permanent re-entry point that costs nothing to maintain.
Step 2: Set Up a Backend to Proxy API Calls
Your server has two jobs: serve the Mini App’s HTML page over HTTPS, and forward catalog and order requests to FazerCards while keeping your API key off the client.
Create a Node project and install the fazercards SDK (npm install fazercards). Store your FazerCards API key in an environment variable. Expose two routes:
- GET /api/catalog — calls FazerCards GET /giftcards to list categories, then GET /giftcards/cards?category_id=… for each one, returning a trimmed list of offers with card_id, price_usd, and stock status.
- POST /api/order — validates the Telegram user identity passed from the frontend, then calls POST /giftcards/order with the chosen category_id, card_id, and quantity.
Keep catalog responses lean. Twenty to thirty products per category load fast on mobile and give users a clear choice without overwhelming them.
Step 3: Build the Frontend with the Telegram Web App SDK
Your Mini App is an ordinary HTML page displayed inside Telegram’s built-in browser. Load the Telegram Web App SDK from Telegram’s official CDN in your page head. This exposes window.Telegram.WebApp, which gives you three key handles:
- initData — a signed string that proves the user’s identity; always validate server-side before creating any order
- MainButton — the large bottom bar you control; set its text and call .show() when a product is selected
- themeParams — color tokens that let your page match the user’s Telegram theme automatically, so the store feels native
Structure the UI around category tabs, a card grid, and a product detail panel. When the user selects a card, update the MainButton label to show the product name and price, then trigger the purchase flow on tap.
Step 4: Validate Identity and Place Orders
When the user taps the MainButton, your frontend posts the selected category_id and card_id and the raw initData string to your backend /api/order endpoint.
On the server, verify initData using HMAC-SHA256 with a key derived from your bot token — Telegram’s developer documentation explains the exact algorithm. Reject any request with an invalid signature; this prevents order creation outside a genuine Telegram session.
Once validated, take payment first: inside a Mini App, digital goods are paid in Telegram Stars through an invoice (see the FAQ below), and you place the FazerCards order only after Telegram confirms the payment. Then call POST /giftcards/order with the X-Api-Key header and an Idempotency-Key header. Generate that key once per purchase — for example from the Telegram user ID and the payment ID — and reuse it on every retry of the same purchase. If the user double-taps or the connection drops mid-request, FazerCards returns the original order instead of billing twice. For a deeper treatment of idempotency and retry patterns, see our guide to fault-tolerant API orders; the gift card API integration guide covers the basics.
Step 5: Deliver Codes and Confirm Orders
Many gift cards come back with status: completed immediately, with the codes in the order's cards field; top-ups and some cards start as processing and finish a little later. Display the code inside the Mini App UI — and also push it to the Telegram chat via the Bot API’s sendMessage method. Customers expect their codes in chat history, not buried inside a web screen they may close.
For products that start as processing, set up a FazerCards webhook pointing at a route on your server. When the order.status_changed event arrives with status completed, fetch the codes with GET /orders/:orderId and send them via sendMessage. FazerCards retries failed deliveries after 1, 5, and 30 minutes — enough resilience for brief server restarts.
If a code fails to redeem, contact FazerCards support with the order ID; verified faulty codes receive a replacement or a balance credit.
Step 6: Launch and Distribute the Mini App
Deploy to your HTTPS host and update the Mini App URL in BotFather. Test end-to-end with a handful of small real orders on the production API — there is no sandbox, so fund a small balance for the test. Once the flow is solid, distribute through:
- Channel buttons — attach a Mini App button to your Telegram channel so every post carries a purchase path
- Inline keyboard buttons — send product spotlights with a button that opens the Mini App pre-scrolled to that item
- Direct link — share the t.me/yourbotname/shortname link in group chats, social bios, or partner channels
Start with a focused selection of two or three high-demand gift card families and expand as you see what your audience buys. The full FazerCards catalog — over 10,000 products across 700+ games — is reachable through the same API. Check pricing to find the plan tier that fits your margin targets.
What You Have at the End
A live Telegram Mini App that presents a gift card catalog, creates orders through FazerCards, and delivers codes directly in the chat — all without your customers leaving Telegram. Combined with an existing channel or community audience, this is one of the lowest-friction digital storefronts you can build in an afternoon.
Browse the full catalog, review the API and webhook docs, and kick off with the 5-day Gold trial — no card, no KYC, full API access from day one.
FAQ
How do customers pay inside a Mini App?
With Telegram Stars. Telegram's rules require digital goods and services sold inside bots and Mini Apps to be paid in Stars through the Bot Payments API; third-party payment providers are meant for physical goods. Check Telegram's current Mini App terms before launch and factor the Stars conversion into your retail prices. Your own procurement is separate: you fund your FazerCards balance with Binance Pay or USDT (TRC20, BEP20, TON, Aptos), which keeps that side free of card chargebacks.
Can I sell game top-ups in addition to gift cards?
Yes. The FazerCards API has dedicated endpoints for game top-ups (GET /topups, POST /topups/order) and game keys (GET /gamekeys). Add a Top-ups tab to your Mini App and wire each to the relevant endpoint. See platform top-ups for what’s available in the catalog.
How do I handle orders that aren’t instant?
Register a FazerCards webhook pointing at a route on your server. When order.status_changed fires with status: completed, fetch the codes with GET /orders/:orderId and deliver them via sendMessage. The webhooks reference covers every event, payload structure, and retry schedule.
What if a customer says their code doesn’t work?
Ask for the order ID — visible in the Mini App after purchase — and file a support request with FazerCards. Confirmed faulty codes receive a replacement or a credit to your balance. FazerCards’ sourcing standards are published at /suppliers if customers ask about code provenance.