Skip to main content

payments.convertStarGift

Convert a received gift » into Telegram Stars: this will permanently destroy the gift, converting it into starGift.convert_stars Telegram Stars, added to the user's balance. Note that starGift.convert_stars will be less than the buying price (starGift stars) of the gift if it was originally bought using Telegram Stars bought a long time ago.

func (c *Client) PaymentsConvertStarGift(ctx context.Context, stargift InputSavedStarGiftClass) (bool, error)

Calling this method

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

res, err := api.PaymentsConvertStarGift(ctx, stargift)
if err != nil {
return err
}
_ = res // bool
return nil
})

Parameters

NameTypeRequiredDescription
StargiftInputSavedStarGiftClassyesThe gift to convert.

Returns

bool

Possible errors

CodeTypeDescription
400BUSINESS_CONNECTION_INVALIDThe connection_id passed to the wrapping invokeWithBusinessConnection call is invalid.
400MESSAGE_ID_INVALIDThe provided message id is invalid.
400SAVED_ID_EMPTYThe passed inputSavedStarGiftChat.saved_id is empty.
400STARGIFT_PEER_INVALIDThe specified inputSavedStarGiftChat.peer is invalid.
400USER_ID_INVALIDThe provided user ID is invalid.

References