Layer 227
PaymentsSendStarGiftOffer
Send an offer to purchase a collectible gift, see here for the full flow.
method
Users
payments.sendStarGiftOffer#8fb86b41 flags:# peer:InputPeer slug:string price:StarsAmount duration:int random_id:long allow_paid_stars:flags.0?long = Updates;
Parameters
| Name | Type | Description |
|---|---|---|
| Peer | InputPeer | Owner of the collectible gift: equal to star Gift Unique. owner_id. |
| Slug | string | Identifier of the collectible gift: equal to star Gift Unique. slug. |
| Price | StarsAmount | Offer price, in stars or TON. |
| Duration | int | Duration of the offer, in seconds: must be one of 21600, 43200, 86400, 129600, 172800, or 259200; can also be 120 in test mode. |
| RandomId | long | Random 64-bit identifier used to avoid sending the same offer twice in case of network issues. |
| AllowPaidStars | flags .0? long | If 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 ). |
Returns
UpdatesGogram Example
// PaymentsSendStarGiftOffer - using Params struct result, err := client.PaymentsSendStarGiftOffer(&tg.PaymentsSendStarGiftOfferParams{ Peer: &tg.InputPeerUser{UserID: int64(777000)}, Slug: "Hello, World!", Price: &tg.StarsAmount{}, Duration: 42, RandomId: int64(1234567890), AllowPaidStars: nil, }) if err != nil { // handle error } // result is *tg.Updates
Possible Errors
| Code | Type | Description |
|---|---|---|
| 400 | INPUT_STARS_AMOUNT_INVALID | The specified offer amount in stars is invalid, see here for the allowed range. |
| 400 | INPUT_STARS_NANOS_INVALID | The specified offer amount in nanotons is invalid, see here for the allowed range. |
| 400 | INVOICE_INVALID | The specified invoice is invalid. |
| 400 | PEER_ID_INVALID | The provided peer id is invalid. |
| 400 | RESELL_STARS_TOO_FEW | The offered price is too low. |
| 400 | RESELL_STARS_TOO_MUCH | The offered price is too high. |
| 400 | STARGIFT_OFFER_INVALID | The specified offer amount is invalid. |
| 400 | STARGIFT_OFFER_NOT_ALLOWED | You can't send a purchase offer for this gift. |
| 400 | STARGIFT_SLUG_INVALID | The specified gift slug is invalid. |