Skip to main content

payments.botCancelStarsSubscription

Cancel a bot subscription

func (c *Client) PaymentsBotCancelStarsSubscription(ctx context.Context, request *PaymentsBotCancelStarsSubscriptionRequest) (bool, error)

Calling this method

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

res, err := api.PaymentsBotCancelStarsSubscription(ctx, &tg.PaymentsBotCancelStarsSubscriptionRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // bool
return nil
})

Parameters

NameTypeRequiredDescription
RestoreboolIf not set, disables autorenewal of the subscriptions, and prevents the user from reactivating the subscription once the current period expires: a subscription cancelled by the bot will have the starsSubscription.bot_canceled flag set. The bot can can partially undo this operation by setting this flag: this will allow the user to reactivate the subscription.
UserIDInputUserClassyesThe ID of the user whose subscription should be (un)cancelled
ChargeIDstringyesThe provider_charge_id from the messageActionPaymentSentMe service message sent to the bot for the first subscription payment.

Returns

bool

Possible errors

CodeTypeDescription
400CHARGE_ID_INVALIDThe specified charge_id is invalid.
400USER_ID_INVALIDThe provided user ID is invalid.

References