B2B platform for digital goods

Gift Card API for Telegram Bots

A gift card API works in a Telegram bot exactly as it does in a web store β€” the difference is only the delivery channel. The bot accepts a product selection and payment, calls the supplier's order creation endpoint, receives the code, and sends it to the user in the chat.

Gift Card API for Telegram Bots


Short Answer

A gift card API works in a Telegram bot exactly as it does in a web store β€” the difference is only the delivery channel. The bot accepts a product selection and payment, calls the supplier's order creation endpoint, receives the code, and sends it to the user in the chat. No web interface required. The key implementation steps are: product menu, payment trigger, API call, code delivery via sendMessage, and error handling.


Definition: A gift card API for Telegram bots is a supplier's REST API that the bot's backend calls to create gift card orders and receive codes, which the bot then delivers to the customer within the Telegram conversation.


Key takeaway: The gift card API is channel-agnostic. Whether you call it from a web store backend or a Telegram bot backend makes no difference to the API. The only bot-specific implementation is replacing the email/order-page delivery with a bot.sendMessage() call.


Who This Guide Is For

  • Telegram bot developers adding gift card sales to their bot
  • Bot operators who already sell top-ups and want to add gift card codes
  • Developers evaluating whether a Telegram bot is a viable gift card storefront

Gift Card vs. Top-Up in a Telegram Bot

Factor Gift Card (Code) Top-Up (Direct to Account)
Customer input needed None Player ID (mandatory)
Delivery Code string in message Account credit confirmation
Refund risk Code can be misused; moderate risk Non-reversible; low risk
Integration complexity Lower Higher (player ID validation)
Product examples Steam, PSN, Xbox, Google Play PUBG UC, Robux, ML Diamonds

For a first implementation, gift card codes are simpler. Top-up integration requires the additional player ID validation step.


Full Bot Flow for Gift Card Delivery

/start
  β†’ Bot: "Select a product category"
      [Gaming] [Retail] [Mobile]

[Gaming]
  β†’ Bot: "Select a product"
      [Steam $10] [Steam $20] [PSN $10] [Xbox $15]

[Steam $20]
  β†’ Bot: "Steam $20 (US) β€” $21.99. Pay now?"
      [Pay with Stars] [Pay with Crypto]

[Pay with Stars β€” Telegram payment]
  β†’ Telegram native payment flow
  β†’ On successful_payment event:
      Bot calls supplier API: POST /orders { sku: "steam-20-usd", qty: 1 }
      Receives: { code: "XXXXX-YYYYY-ZZZZZ" }
      Bot.sendMessage: "Your Steam code: XXXXX-YYYYY-ZZZZZ
                        Redeem at: store.steampowered.com"

Payment Integration for Gift Card Bots

Method Telegram Integration Fee Range Friction
Telegram Stars Native, via Payments API ~30% cut Very low
Crypto (TON, USDT) External wallet link or @wallet bot 1–2% Low
Stripe payment link Redirect to browser 2.5–3.5% Medium

Telegram Stars note: Telegram takes approximately 30% of Stars payments. For a $10 product, your effective revenue from a Stars payment is ~$7. This requires a higher retail price or higher wholesale discount to maintain margin. Model carefully before enabling Stars as your only payment method.


Code Delivery Message Format

When sending the code to the user, always include:

βœ… Order complete

Product: Steam Gift Card $20 (US Region)
Code: XXXXX-YYYYY-ZZZZZ

Redeem at: store.steampowered.com/account/redeemwalletcode
Region: US Steam accounts only

Need help? /support

Format the code in a monospace block so it is easy to copy:

`XXXXX-YYYYY-ZZZZZ`

Telegram renders text between backticks in monospace, which is copy-friendly on mobile.


Error Handling

Error Cause Bot Response
API call fails Network or supplier error "Order processing β€” please wait. If not delivered within 2 minutes, contact /support"
API returns failed Out of stock or supplier issue "Delivery failed. You have not been charged. Contact /support"
Code field empty Supplier-side issue Treat as failure; do not deliver
Payment confirmed but API fails Race condition Log order; retry once; alert ops if retry fails

Never send an empty code or a placeholder to the user. If the API returns an error, handle it gracefully.


Logging Orders

For every completed gift card order in your bot, log:

  • Telegram user ID (not username β€” IDs are stable; usernames can change)
  • Product SKU
  • Supplier order ID
  • Code (hashed, not plain text in your database)
  • Timestamp
  • Payment confirmation ID

This log is required for dispute resolution: if a user claims they did not receive a code, you check your log.


Checklist

  • Product catalog set up in bot (with region-explicit naming)
  • Payment method integrated and tested
  • Payment event handler: trigger API call only on confirmed payment
  • Supplier API order creation call with error handling
  • Code delivery via sendMessage with full instructions
  • Code in monospace format for easy copying
  • /support command with contact info
  • Transaction logging per order
  • Balance monitoring with alert
  • Refund policy communicated (/terms or in /start message)

Frequently asked questions

Can a Telegram bot deliver gift card codes automatically with no human involvement?
Yes. Once payment is confirmed, the API call, code parsing and message delivery all happen in code with no manual step.
What region should I sell for a global Telegram audience?
Start with US SKUs for Steam, PSN and Xbox β€” they have the highest global demand. Add regional SKUs (EU, UK) based on your audience location once you see demand patterns.
Can one bot sell both gift cards (codes) and top-ups (player ID required)?
Yes. Handle them as separate product flows in the bot. Gift cards go straight to payment; top-ups have an additional player ID input step.
How do I handle a customer who wants a refund after receiving a code?
State clearly in your bot's /terms that digital goods are non-refundable after delivery. For an unused code that the customer claims doesn't work, check with your supplier's refund policy on invalid codes.
How do I show product availability in the bot?
Call the supplier's stock check endpoint before presenting packages to the user. Hide or disable packages that are out of stock.
Get FoxReload API access

Related articles