Skip to main content

payments.upgradeStarGift

Upgrade a gift to a collectible gift: can only be used if the upgrade was already paid by the gift sender; see here » for more info on the full flow (including the different flow to use in case the upgrade was not paid by the gift sender).

func (c *Client) PaymentsUpgradeStarGift(ctx context.Context, request *PaymentsUpgradeStarGiftRequest) (UpdatesClass, error)

Calling this method

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

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

Parameters

NameTypeRequiredDescription
KeepOriginalDetailsboolSet this flag to keep the original gift text, sender and receiver in the upgraded gift as a starGiftAttributeOriginalDetails attribute.
StargiftInputSavedStarGiftClassyesThe gift to upgrade

Returns

UpdatesClass

Possible errors

CodeTypeDescription
400BUSINESS_CONNECTION_INVALIDThe connection_id passed to the wrapping invokeWithBusinessConnection call is invalid.
400MESSAGE_ID_INVALIDThe provided message id is invalid.
400PAYMENT_REQUIREDPayment is required for this action, see here » for more info.
400SAVED_ID_EMPTYThe passed inputSavedStarGiftChat.saved_id is empty.
400STARGIFT_ALREADY_CONVERTEDThe specified star gift was already converted to Stars.
400STARGIFT_ALREADY_UPGRADEDThe specified gift was already upgraded to a collectible gift.
400STARGIFT_UPGRADE_UNAVAILABLEA received gift can only be upgraded to a collectible gift if the messageActionStarGift/savedStarGift.can_upgrade flag is set.

References