StaticGramBot API

editUserStarSubscriptionПоддерживается

Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success.

Параметры

user_idIntegerобязательный
Identifier of the user whose subscription will be edited
telegram_payment_charge_idStringобязательный
Telegram payment identifier for the subscription
is_canceledBooleanобязательный
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
}

Описания методов и типов взяты из официальной документации Telegram Bot API (Bot API 10.3). Адрес API: https://api.staticgram.top