Link Search Menu Expand Document

Method: payments.botCancelStarsSubscription

Back to methods index

Cancel a bot subscription

Parameters:

NameTypeDescriptionRequired
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.
Optional
user_idUsername, chat ID, Update, Message or InputUserThe ID of the user whose subscription should be (un)cancelledOptional
charge_idstringThe provider_charge_id from the messageActionPaymentSentMe service message sent to the bot for the first subscription payment.Optional

Return type: Bool

Can userbots use this method: YES

Can bots use this method: NO

MadelineProto Example (now async for huge speed and parallelism!):

if (!file_exists('madeline.php')) {
    copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';

$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();

$Bool = $MadelineProto->payments->botCancelStarsSubscription(restore: $Bool, user_id: $InputUser, charge_id: 'string', );