payments.sendStarGiftOffer #

Send an offer to purchase a collectible gift », see here » for the full flow.

Layer 223

updatesTooLong#e317af7e = Updates;
updateShortMessage#313bc7f8 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int user_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
updateShortChatMessage#4d6deea5 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true id:int from_id:long chat_id:long message:string pts:int pts_count:int date:int fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?long reply_to:flags.3?MessageReplyHeader entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
updateShort#78d4dec1 update:Update date:int = Updates;
updatesCombined#725b04c3 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq_start:int seq:int = Updates;
updates#74ae4240 updates:Vector<Update> users:Vector<User> chats:Vector<Chat> date:int seq:int = Updates;
updateShortSentMessage#9015e101 flags:# out:flags.1?true id:int pts:int pts_count:int date:int media:flags.9?MessageMedia entities:flags.7?Vector<MessageEntity> ttl_period:flags.25?int = Updates;
---functions---
payments.sendStarGiftOffer#8fb86b41 flags:# peer:InputPeer slug:string price:StarsAmount duration:int random_id:long allow_paid_stars:flags.0?long = Updates;

Parameters #

NameTypeDescription
flags#Flags, see TL conditional fields
peerInputPeerOwner of the collectible gift: equal to starGiftUnique.owner_id.
slugstringIdentifier of the collectible gift: equal to starGiftUnique.slug.
priceStarsAmountOffer price, in stars or TON.
durationintDuration of the offer, in seconds: must be one of 21600, 43200, 86400, 129600, 172800, or 259200; can also be 120 in test mode.
random_idlongRandom 64-bit identifier used to avoid sending the same offer twice in case of network issues. See here » for more info on random ID deduplication and updateMessageID mapping.
allow_paid_starsflags.0?longIf the destination peer has paid messages » enabled, specifies the amount of Telegram Stars the sending user has agreed to pay in order to send the offer (in addition to the amount for the offer itself, contained in price).

Result #

Updates

Only users can use this method #

Possible errors #

CodeTypeDescription
400INPUT_STARS_AMOUNT_INVALIDThe specified offer amount in stars is invalid, see here » for the allowed range.
400INPUT_STARS_NANOS_INVALIDThe specified offer amount in nanotons is invalid, see here » for the allowed range.
400INVOICE_INVALIDThe specified invoice is invalid.
400PEER_ID_INVALIDThe provided peer id is invalid.
400RESELL_STARS_TOO_FEWThe offered price is too low.
400RESELL_STARS_TOO_MUCHThe offered price is too high.
400STARGIFT_OFFER_INVALIDThe specified offer amount is invalid.
400STARGIFT_OFFER_NOT_ALLOWEDYou can't send a purchase offer for this gift.
400STARGIFT_SLUG_INVALIDThe specified gift slug is invalid.

starGiftUnique #

Represents a collectible star gift, see here » for more info.

The sticker that represents the gift is contained in a starGiftAttributeModel object in attributes.

Working with Updates #

How to subscribe to updates and handle them properly.

Telegram Stars can be used to pay for sending messages to users, supergroups and channels that have configured paid messages, requiring a payment for every message sent to them.

Telegram Stars #

Telegram Stars are virtual items that allow users to purchase digital goods and services from bots and mini apps inside the Telegram ecosystem, send gifts to content creators on the Telegram platform, and more.

Telegram Gifts #

Users can send Gifts to their friends. The recipients of gifts can display them on their profile pages or turn them into Telegram Stars ». Telegram Stars can be used for many things, including supporting creators and buying services in mini apps.