Case study: automating subscriptions to a private Telegram channel and recurring payments via CloudPayments
Situation and purpose
It was necessary to set up paid access to a closed channel: the user pays for the subscription with a bank card, receives an invitation to the channel and remains a member upon successful renewals. All the logic is in the Telegram bot: registration, changing payment details, canceling subscriptions, recurring charges and automatic access control.

Subscription Business Logic
Decoration
charge + tokenizationsubscription_idaccount_idtokena one-time invite link
Access to a private channel
validationgetChatMemberRecurrent write-offs
reminder
recurring by tokenUpdating banking details (changing the card)
One more monthNextCancel subscription
until the end of the paid periodAn undelivered extension
the strategy of retraysreviewed

Channel access control
Extradition
Membership Verification
getChatMemberAuto-deletion