Telegram Stars and Premium, straight from your code
The API buys Stars, Premium and TON on fragment.com for any username. Your own wallet signs each payment, so the seed phrase stays with you.
Example order: 500 Stars for @durov, 2.84 TON, signed by your wallet and paid on the TON network.
What the API does
Stars, Premium and TON in one API. We made it for bots and shops that sell them 24/7.
-
Telegram Stars
Stars to any username, 50 or more per order.
product: "stars" -
Telegram Premium
Gift Premium for 3, 6 or 12 months.
product: "premium" -
TON to a username
Send TON to any Telegram username, starting at 1 TON.
product: "ton" -
With or without KYC
Buy with your own verified Fragment account. No account? We buy through ours.
kyc: false -
Your seed stays yours
The SDK checks each payment and signs it on your machine. The server never sees your seed phrase.
API v3 -
Batch payments
One signed transaction can pay for many orders at once. From a W5 wallet that's over a hundred.
v5r1 -
Safe retries
Send a request again with the same key and you get the same order back, not a second purchase.
idempotency_key -
TON or USDT
Pay in TON, or in USDT on TON if you buy with your own Fragment account.
payment_method
We prepare the payment, you sign it
The API handles everything on the Fragment side: it finds the recipient, gets the invoice, sends the payment and waits for it to confirm. Signing stays with you.
-
Fragment API
Creates the order
- Finds the recipient on Fragment
- Gets the invoice for the order
- Returns a ready payment request
-
Your server
Checks and signs
- Pays only Fragment's and the service's addresses
- Keeps to the fee ceiling and your limits
- Signs with your wallet, locally
-
Fragment API
Sends and confirms
- Verifies what you signed
- Sends the transaction to the TON network
- Confirms the payment on chain
Even a hacked server can't drain your wallet
No seed to log in
You log in with a TON Connect proof. Our server has nothing that can sign a transfer.
Only known addresses
The SDK pays only Fragment's addresses and the service's wallets, and both lists are built into the SDK.
Your limit per order
The SDK doesn't touch your other tokens and won't pay more for an order than the limit you set.
A first purchase takes a few lines
The official SDKs for Node.js and Python check, sign and send each payment for you.
import { FragmentAPIv3 } from "fragment-api"; const api = new FragmentAPIv3({ mnemonic: process.env.TON_SEED, // signs here, never sent walletType: "v5r1", // or "v4r2" fragmentCookies: process.env.FRAGMENT_COOKIES, // your Fragment account (KYC) trust: { maxTonPerOrder: 50 }, // refuse to sign anything bigger }); const result = await api.buy({ product: "stars", username: "durov", amount: 50 }); // no Fragment account? add kyc: false
import os from fragment_api_lib.v3 import FragmentAPIv3 api = FragmentAPIv3( mnemonic=os.environ["TON_SEED"], # signs here, never sent wallet_type="v5r1", # or "v4r2" fragment_cookies=os.environ["FRAGMENT_COOKIES"], # your Fragment account (KYC) trust={"max_ton_per_order": 50}, # refuse to sign anything bigger ) result = api.buy("stars", "durov", 50) # no Fragment account? add kyc=False
A fixed fee per order, no subscription
No sign-up and no API key. All you need to buy is a TON wallet.
Your Fragment account
KYC-verified on fragment.com
- Pay in TON or USDT on TON
- Stars, Premium and TON
- The fee goes in the same transaction as the payment
Without KYC
No Fragment account needed
- Bought through our verified account
- Stars, Premium and TON
- The fee is part of the single payment you sign
TON network fees come out of your wallet, like with any transfer. Questions about fees? Message us.
Common questions
Didn't find an answer? Write to the developer on Telegram.
Do I need my own Fragment account?
No. If you have your own KYC-verified Fragment account, the fee is 2%. If you don't, we buy through our verified account for 3%, and all you need is a TON wallet.
Is my seed phrase sent to the server?
No. In API v3 the SDK signs each payment on your side and sends only the signed message. You log in with a TON Connect proof, so the server never holds anything that can spend your money.
Which wallets are supported?
TON wallets v4r2 and W5 (v5r1). W5 is the better choice for volume: one transaction can pay over a hundred orders.
What if the result of a payment is unclear?
The order stays in processing until the result is confirmed on chain. We never mark it as failed and pay again on a guess. Sending the same signed payment again is always safe, because it can't go through twice.
How do I get support?
Write to the developer on Telegram. Every endpoint is described in the documentation.
Want to try it?
Open the docs, install the SDK and make your first purchase. It takes a few minutes.