giftPremiumSubscription
Telegram Premium aboneliği hediye eder.
Dönüş değeri: Başarılı olduğunda True döndürür.
Parametreler
| Parametre | Tür | Zorunlu | Açıklama |
|---|---|---|---|
user_id | Integer | Evet | Kullanıcı ID'si |
month_count | Integer | Evet | Ay sayısı (1, 3, 6 veya 12) |
star_count | Integer | Evet | Stars cinsinden fiyat: 3 ay için 1000, 6 ay için 1500, 12 ay için 2500 |
text | String | İsteğe bağlı | Mesaj metni (0-255) |
text_parse_mode | String | İsteğe bağlı | Metin biçimlendirme modu |
text_entities | Array of MessageEntity | İsteğe bağlı | JSON MessageEntity dizisi |
Örnek istek
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/giftPremiumSubscription" \
-H "Content-Type: application/json" \
-d '{"user_id":123456789,"month_count":3,"star_count":100}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/giftPremiumSubscription",
json={
"user_id": 123456789,
"month_count": 3,
"star_count": 100
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/giftPremiumSubscription`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"user_id": 123456789,
"month_count": 3,
"star_count": 100
}),
});
console.log(await res.json());
Adım adım rehber: Telegram bot nasıl yapılır? BotFather ile adım adım bot oluşturma
İlgili metotlar
sendInvoiceÖdeme için fatura gönderir.createInvoiceLinkÖdeme bağlantısı oluşturur.refundStarPaymentTelegram Stars ödemesini iade eder.sendGiftKullanıcıya veya sohbete hediye gönderir.getMyStarBalanceBotun Telegram Stars bakiyesini döndürür.getStarTransactionsBotun Telegram Stars işlemlerini döndürür.editUserStarSubscriptionTelegram Stars aboneliğini iptal eder veya yeniler.answerShippingQueryTeslimat sorgusunu yanıtlar.answerPreCheckoutQueryÖdeme öncesi sorguyu yanıtlar.getAvailableGiftsBotun gönderebileceği hediyeleri döndürür.getUserGiftsKullanıcının hediyelerini döndürür.getChatGiftsSohbetin hediyelerini döndürür.