★ API
Telegram Stars API: PHP quickstart
A compact cURL helper you can drop into any PHP project or bot.
Automatic deliverymost orders in minutes
Username checkbefore you pay
Open pricessame on site, bot, API
Public ledgerevery order gets a TxId
<?php
function ps($method, $path, $body = null, $extra = []) {
$ch = curl_init("https://paystars.uz/api/v1$path");
$h = array_merge(["X-API-Key: " . getenv("PAYSTARS_API_KEY"), "Content-Type: application/json"], $extra);
curl_setopt_array($ch, [CURLOPT_CUSTOMREQUEST => $method, CURLOPT_HTTPHEADER => $h,
CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => $body ? json_encode($body) : null]);
return json_decode(curl_exec($ch), true);
}
$chk = ps("POST", "/check-username", ["username" => "durov", "kind" => "stars"]);
$order = ps("POST", "/stars/buy", ["username" => "durov", "quantity" => 50,
"verification_token" => $chk["verification_token"]], ["Idempotency-Key: " . bin2hex(random_bytes(16))]);
print_r(ps("GET", "/order/" . $order["order_id"]));- Keep the API key in an environment variable, never in code.
- Premium works the same way with /premium/buy and months: 3, 6 or 12.
Frequently asked questions
Is there a sandbox?
Use small real orders (50 Stars) while integrating; the idempotency key makes retries safe.
Which languages are supported?
Any language with HTTPS. See the Python, Node.js and PHP quickstarts.
Do API keys expire?
No. Keys stay valid until you revoke them in the dashboard.
Can I pay in USD?
Yes — top up the USD balance with USDT (TON or BEP20) and send currency=USD.
Related pages
Telegram Stars APISell Telegram Stars and Premium inside your own bot, shop or app.Telegram Stars API: Python quickstartA minimal, production-safe flow in Python with the requests library.Telegram Stars API: Node.js quickstartNode 18+ has fetch built in — no extra packages needed.A simpler alternative to the Fragment APIFragment has no public API for reselling Stars and Premium.USD pricing for the APIRun your Stars business in dollars: a USD balance funded with USDT, live quotes and a price cap on every order.Buy Telegram StarsSend Stars to yourself or anyone with a public @username.
Ready to order?
Sign in with Telegram — your StarKerak balance works on the site, in the WebApp and through the API.
