Version 0.1.3 · Registry installation commands use exact versions.
Buy Telegram Stars for a username with an API
Buy and send 50–1,000,000 Telegram Stars to a username from a server backend using TON or USDT, with recipient checks and safe timeout handling.
Purchase requests transmit your wallet mnemonic and Fragment session/cookie to the API operator.
This guide covers programmatic Telegram Stars purchases for a recipient username. It is intended for a trusted server backend, not browser code, and it is separate from accepting Stars payments inside a Telegram bot.
Validate the username before spending, then choose one integer amount from 50 to 1,000,000 and one payment method: TON or USDT on TON. Check the wallet balance and create one durable purchase intent before calling the buy-stars endpoint.
Keep the wallet mnemonic and Fragment session cookie in server-side secrets. Submit the purchase exactly once. A timeout or unconfirmed response can mean the transfer already progressed, so reconcile the wallet and recipient before any new purchase.
Use the Python, Node.js/TypeScript, PHP, .NET, Go, Rust, or Ruby SDK for typed errors and consistent response handling. This independent project is not an official Telegram, Fragment, or TON product.
Example
GET /get-user-info/?username=durov
GET /wallet-balance/
POST /buy-stars/
username=durov&amount=100&payment_method=usdt_tonContinue reading
Telegram Stars API: send Stars to a username · How to send Telegram Stars to a username · Payment timeout: prevent duplicate Telegram Stars purchases