Android 计费 V3 订阅问题 - 订阅卡在无法取消的状态

Android Billing V3 Subscriptions Issue - A subscription stuck in a state that it cannot be cancelled

更新

随着时间的推移,更多的故障排除表明我有一个特定的订阅,它处于卡住状态,这意味着我无法取消它,这不知何故导致了所有问题。尝试在浏览器或手机或平板电脑上取消它会出现相同的以下错误:

我尝试了三个帐户。没有这个旧订阅的两个新帐户对我的调试工作正常。在我用来订阅该项目的主帐户上,问题就出现了。所以如果我能以某种方式取消订阅,我会很好。

我一共有三个订阅项目。我可以轻松地订阅和取消另外两个,无论是在测试账户还是普通账户上都没有问题。但是,这个超过一年的特别的,我不能取消。这是 IabHelper 查询中的所有错误的结果。

如何取消?不幸的是,由于一些神秘的原因,Google 也不允许删除订阅项目。


我的单次购买效果很好,但订阅效果不佳。在过去的很多天里,我一直被这个问题所困扰,我无法获得我的应用程序的订阅信息,并且失败了:

if (result.isFailure()) {
            Log.v(Constants.TAG, "Failed to query inventory: " + result);
            return;
        }

我到处都阅读了所有与应用内结算相关的帖子,并尝试了所有可以在多个设备、Alpha 版和生产版、我的应用的多个版本上完成的所有操作,但无法摆脱此错误:

Failed to query inventory: IabResult: Error refreshing inventory (querying owned subscriptions). (response: -1003:Purchase signature verification failed)

我了解空白签名的问题,但现在该应用程序已发布到生产环境中,当我在我的设备上安装它时,我的日志中仍然出现同样的错误。所以我现在在 Play 商店中有一个生产应用程序订阅不起作用。这是我为了得到签名值而走的最后一步。非常不幸的是,没有真正简单的方法来调试应用内代码。

在 verifyPurchases in:

中,代码在 Security.java 中失败(这似乎是许多人失败的常见地方)
if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) ||
            TextUtils.isEmpty(signature)) {
        Log.e(TAG, "Purchase verification failed: missing data.");
        return false;
    }

遗憾的是,订阅的在线帮助很少 none。我尝试了人们提出的其他代码,但无济于事。也没有专门针对订阅的教程或示例。我能找到的所有答案都是关于单次购买的。

我的 base64 密钥没问题。新的 IabHelper 初始化没有问题。但是当它进入订阅查询时,它悲惨地失败了。这是日志:

Querying owned items, item type: subs
10-25 13:52:16.957 7850-7915/com.lifelog24.main D/IabHelper: Package name: com.lifelog24.main
10-25 13:52:16.957 7850-7915/com.lifelog24.main D/IabHelper: Calling getPurchases with continuation token: null
10-25 13:52:16.962 7850-7915/com.lifelog24.main D/IabHelper: Owned items response: 0
10-25 13:52:16.965 7850-7915/com.lifelog24.main E/IABUtil/Security: Purchase verification failed: missing data.
10-25 13:52:16.966 7850-7915/com.lifelog24.main W/IabHelper: In-app billing warning: Purchase signature verification **FAILED**. Not adding item.
10-25 13:52:16.966 7850-7915/com.lifelog24.main D/IabHelper:    Purchase data: 
10-25 13:52:16.966 7850-7915/com.lifelog24.main D/IabHelper:    Signature: 
10-25 13:52:16.984 7850-7915/com.lifelog24.main D/IabHelper: Sku is owned: bus04
10-25 13:52:16.985 7850-7915/com.lifelog24.main D/IabHelper: Continuation token: null
10-25 13:52:16.985 7850-7915/com.lifelog24.main D/IabHelper: Ending async operation: refresh inventory
10-25 13:52:16.993 7850-7850/com.lifelog24.main D/LL24: Query inventory finished.
10-25 13:52:16.993 7850-7850/com.lifelog24.main V/LL24: Failed to query inventory: IabResult: Error refreshing inventory (querying owned subscriptions). (response: -1003:Purchase signature verification failed)

此时我别无选择,非常感谢任何可以解决此问题的帮助。

2016 年 5 月 23 日更新

我用 Google 开了一张故障单。有几周来回的电子邮件,从一个代表跳到另一个代表,但这个问题无法得到解决。我的一个帐户卡在无法从订阅中删除的状态。最后一位代表承认了这一点,并在 round about 中提到 Google 应用内结算是一个复杂的系统,此类问题很难解决。稍后我会尝试联系他们,我猜是一两年后。我的开发受到这个问题的严重影响,因为我没有从他们那里得到正确的 JSON 消息来进行我的测试和调试。

我在这里找到了这个答案In App billing not working after update - Google Store

它说新的 verifyPurchase() 代码有问题,我相信。也许使用他们正在使用的旧代码会对您有所帮助。

public static boolean verifyPurchase(String base64PublicKey,
        String signedData, String signature) {

if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey)
            || TextUtils.isEmpty(signature)) {
    Log.e(TAG, "Purchase verification failed: missing data.");
        return false;
}

PublicKey key = Security.generatePublicKey(base64PublicKey);
return Security.verify(key, signedData, signature);}

回答我自己的问题时,我发现我的主帐户 Google 端出现问题。一年多前,我以测试人员的身份订阅了自己的订阅,不知何故,这个订阅卡在了我无法取消订阅的状态。这造成了所有的麻烦。从任何其他帐户登录都可以正常工作,我的代码的行为完全符合我的要求。

在这种情况下,唯一的解决办法是卸载该应用程序,然后从其他帐户安装它。等到 Google 修复其损坏的应用内订阅功能。