You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Unity3D开发Telegram游戏集成IAP(Telegram Stars)Android端异常求助

Unity3D开发Telegram游戏集成Stars IAP,Android端调用openInvoice弹出分享菜单而非支付确认

我正在用Unity3D开发一款Telegram游戏,需要集成Telegram Stars的IAP功能,当前设定的流程如下:

  • 用户点击游戏内道具
  • 游戏调用Telegram API的createInvoiceLink获取账单链接
  • 游戏通过Javascript调用window.Telegram.WebApp.openInvoice传入上述链接
  • 弹出Telegram确认提示(Android端在此步骤出现异常)
  • 等待回调
  • 根据回调状态在游戏内显示弹窗

该流程在Telegram桌面端可正常运行,但在Telegram Android端未弹出支付确认提示,而是打开了分享菜单。

请问是否有人遇到过此类问题?是否有解决方案?

我的Javascript代码

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);
        }
    });
}

手机端问题截图

Telegram Android端异常截图

内容的提问来源于stack exchange,提问作者Tom Kazansky

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 23:09:52