Skip to main content

payments.transferStarGift

Transfer a collectible gift to another user or channel: can only be used if transfer is free (i.e. messageActionStarGiftUnique.transfer_stars is not set); see here » for more info on the full flow (including the different flow to use in case the transfer isn't free).

func (c *Client) PaymentsTransferStarGift(ctx context.Context, request *PaymentsTransferStarGiftRequest) (UpdatesClass, error)

Calling this method

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

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

Parameters

NameTypeRequiredDescription
StargiftInputSavedStarGiftClassyesThe gift to transfer.
ToIDInputPeerClassyesDestination peer.

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.
400PEER_ID_INVALIDThe provided peer id is invalid.
400SAVED_ID_EMPTYThe passed inputSavedStarGiftChat.saved_id is empty.
400STARGIFT_NOT_FOUNDThe specified gift was not found.
400STARGIFT_NOT_OWNER
400STARGIFT_NOT_UNIQUE
400STARGIFT_OWNER_INVALIDYou cannot transfer or sell a gift owned by another user.
400STARGIFT_PEER_INVALIDThe specified inputSavedStarGiftChat.peer is invalid.

References