Skip to main content

payments.sendStarGiftOffer

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

func (c *Client) PaymentsSendStarGiftOffer(ctx context.Context, request *PaymentsSendStarGiftOfferRequest) (UpdatesClass, error)

Calling this method

client.Run(ctx, func(ctx context.Context) error {
api := client.API()

res, err := api.PaymentsSendStarGiftOffer(ctx, &tg.PaymentsSendStarGiftOfferRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // UpdatesClass
return nil
})

Parameters

NameTypeRequiredDescription
PeerInputPeerClassyesOwner of the collectible gift: equal to starGiftUnique.owner_id.
SlugstringyesIdentifier of the collectible gift: equal to starGiftUnique.slug.
PriceStarsAmountClassyesOffer price, in stars or TON.
DurationintyesDuration of the offer, in seconds: must be one of 21600, 43200, 86400, 129600, 172800, or 259200; can also be 120 in test mode.
RandomIDint64yesRandom 64-bit identifier used to avoid sending the same offer twice in case of network issues.
AllowPaidStarsint64If 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

UpdatesClass

Possible errors

CodeTypeDescription
400INPUT_STARS_AMOUNT_INVALID
400INPUT_STARS_NANOS_INVALID
400INVOICE_INVALIDThe specified invoice is invalid.
400PEER_ID_INVALIDThe provided peer id is invalid.
400RESELL_STARS_TOO_FEW
400RESELL_STARS_TOO_MUCH
400STARGIFT_OFFER_INVALID
400STARGIFT_OFFER_NOT_ALLOWED
400STARGIFT_SLUG_INVALIDThe specified gift slug is invalid.

References