I have a game in development for Telegram, using Unity3D, and I want to integrate IAP (Telegram Stars) into the game,
The flow is as following:
The above flow worked on Telegram Desktop, but on Telegram Android, there is no prompt, instead "Share" menu is opened.
Have anyone encountered this issue? do you have a solution?
Here is my javascript code:
OpenTelegramInvoice : function(params) {
if (!window.Telegram || !window.Telegram.WebApp) {
window.GameInstance.SendMessage('APIOperator', 'OnTelegramInvoiceFailed', 'Cannot find Telegram');
return;
}
var link = UTF8ToString(params);
window.Telegram.WebApp.openInvoice(link, (status) => {
if (status == "paid") {
window.GameInstance.SendMessage('APIOperator', 'OnTelegramInvoiceSuccess');
} else {
window.GameInstance.SendMessage('APIOperator', 'OnTelegramInvoiceFailed', status);
}
});
}
I got it solved somehow,
I think the issue is from Telegram's side, it's how the "game" (created with /newgame) behaves,
Instead of using "game", I publish my game as "mini-app" (created with /newapp) then the issue went away (I can process IAP with both PC and Android Telegram)