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
| Name | Type | Required | Description |
|---|---|---|---|
Restore | bool | — | If 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. |
UserID | InputUserClass | yes | The ID of the user whose subscription should be (un)cancelled |
ChargeID | string | yes | The provider_charge_id from the messageActionPaymentSentMe service message sent to the bot for the first subscription payment. |
Returns
bool
Possible errors
| Code | Type | Description |
|---|---|---|
| 400 | CHARGE_ID_INVALID | The specified charge_id is invalid. |
| 400 | USER_ID_INVALID | The provided user ID is invalid. |
References
- Official documentation
- Generated Go reference
- TL definition:
payments.botCancelStarsSubscription#6dfa0622