StaticGramBot API

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

Refunds a successful payment in Telegram Stars. Returns True on success.

Особенности StaticGram

CHARGE_ALREADY_REFUNDED, CHARGE_ID_INVALID, BALANCE_TOO_LOW; refunded_payment service message

Параметры

user_idIntegerобязательный
Identifier of the user whose payment will be refunded
telegram_payment_charge_idStringобязательный
Telegram payment identifier

Пример запроса

curl
curl "https://api.staticgram.top/bot$TOKEN/refundStarPayment" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": 123456789,
    "telegram_payment_charge_id": "<charge_id>"
  }'
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.refund_star_payment(user_id=123456789, telegram_payment_charge_id="<charge_id>")
JavaScript
const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/refundStarPayment`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "user_id": 123456789,
    "telegram_payment_charge_id": "<charge_id>"
  }),
});
const data = await res.json();

Ответ (True)

JSON
{
  "ok": true,
  "result": true
}

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