It's possible to rewrite the expiration date of Telegram Premium subscription. Race condition with payment transactions.
Steps to reproduce
Activate 1 monthly subscription via App Store.
Wait for the next bill and fail the transaction (for example by "not enough funds").
Telegram will immediately terminate the premium status. The subscription is still alive in App Store and will be retried after fixing of payment details.
Use this delay between retries. Buy or receive the subscription. For example, someone will gift you Telegram Premium for 12 months.
Wait till App Store subscription renewal.
The expiration date of the premium is next month instead of next year from the gift.
After the end of App Store subscription, the premium is gone forever. The server doesn't restore the gifted one for 12 months.
Possible solutions
Don't be greedy
Many premium subscriptions like Spotify Premium, YouTube premium and so on are polite. They give a time to fix payment details and give you a few retries for payments. They don't stop immediately access to features and it saves from state desync between payments aggregators.
Prevent new transactions while others exist
This check already exists, but it doesn't pay attention to the status of already activated subscriptions. In the App Store it's possible to have an expired-like subscription and active at the same time.
Store multiple active subscriptions per account
It looks like the server stores only one active instance of subscription per user. And there is only one "expired at" field. If the races between platforms are difficult to be fixed, the solution with many "expired at" fields and sorting for the user's UI will be nicer than losing premium at all.
Notes
For already broken accounts it looks fine to add the "issues resolving" functionality to "restore purchahes" button instead of some kind of migrations in DB. I mean restore subscription by searching for gifts and transactions in other DB nodes.
I expect more issues with the same behaviors from other platforms like Google Play.
From the database perspective, you can investigate the issue by looking at my account. I'm one of the affected users.
I received a gift of Telegram Premium for 12 months and activated it while my monthly Premium subscription was still active. Telegram confirmed that the gift had been successfully activated.
However, when my monthly subscription expired, my Premium subscription disappeared completely. I no longer have any Premium features, and my account does not show an active subscription or any remaining gifted Premium period.
Unfortunately, I deleted the original chat with the person who gifted me the subscription, but I have screenshots showing the purchase of the gift and its delivery to my account.
I have already contacted Telegram Support, but I have not received a response yet.
Could you please help me restore my gifted 12-month Premium subscription? I would really appreciate it if you could investigate this issue.
In my case, the issue occurs only in the Android version of Telegram. However, in Telegram Desktop for Windows and Telegram Web, the Premium expiration date is displayed correctly, and the duration of the new gift has been added to the expiration date.
It is worth noting that my original one-year subscription was gifted to me through Fragment, while the second, three-month subscription was sent to me as a gift directly through the Telegram app.
In my case, the day after receiving the gift, the Premium expiration date is also displayed correctly in the Android version of Telegram, and there are no issues.
I received a gift of Telegram Premium for 12 months and activated it while my monthly Premium subscription was still active. Telegram confirmed that the gift had been successfully activated.
However, when my monthly subscription expired, my Premium subscription disappeared completely. I no longer have any Premium features, and my account does not show an active subscription or any remaining gifted Premium period.
Unfortunately, I deleted the original chat with the person who gifted me the subscription, but I have screenshots showing the purchase of the gift and its delivery to my account.
I have already contacted Telegram Support, but I have not received a response yet.
Could you please help me restore my gifted 12-month Premium subscription? I would really appreciate it if you could investigate this issue.
It is worth noting that my original one-year subscription was gifted to me through Fragment, while the second, three-month subscription was sent to me as a gift directly through the Telegram app.