editUserStarSubscriptionПоддерживается
Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success.
Особенности StaticGram
is_canceled true/false toggles auto-renewal; refunded charge → CHARGE_ALREADY_REFUNDED, non-subscription → CHARGE_ID_INVALID
Параметры
Identifier of the user whose subscription will be edited
Telegram payment identifier for the subscription
Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by the bot.
Пример запроса
curl
curl "https://api.staticgram.top/bot$TOKEN/editUserStarSubscription" \
-H "Content-Type: application/json" \
-d '{
"user_id": 123456789,
"telegram_payment_charge_id": "<charge_id>",
"is_canceled": true
}'aiogram 3
from aiogram import Bot
from aiogram.client.session.aiohttp import AiohttpSession
from aiogram.client.telegram import TelegramAPIServer
session = AiohttpSession(api=TelegramAPIServer.from_base("https://api.staticgram.top"))
bot = Bot(TOKEN, session=session)
result = await bot.edit_user_star_subscription(
user_id=123456789,
telegram_payment_charge_id="<charge_id>",
is_canceled=True,
)JavaScript
const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/editUserStarSubscription`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"user_id": 123456789,
"telegram_payment_charge_id": "<charge_id>",
"is_canceled": true
}),
});
const data = await res.json();Ответ (True)
JSON
{
"ok": true,
"result": true
}