【问题标题】:Inconsistent - "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console."不一致 - “用于调用 Google Play Developer API 的项目 ID 尚未在 Google Play Developer Console 中链接。”
【发布时间】:2018-09-07 01:24:33
【问题描述】:

所以事情就是这样 - 我有一个用于我的 Android 应用程序的 node.js 后端服务器。我正在使用 Google Play 计费库,并按照 google Docs 的建议使用后端来验证购买。

现在,关于此错误的所有其他答案似乎都指向一个一致的问题。

我的后端有时会进行验证,但有时会将此作为错误返回,这表明事实上,我的服务帐户已关联(如我的控制台中所示)。

我尝试了两个不同的 3rd 方库,但我遇到了同样的问题。有时一个会回复验证成功,而另一个会说我的帐户未关联。有时它们都是消极的,有时都是积极的。

似乎不一致。

var platform = 'google';
        var payment = {
            receipt: purchaseToken, // always required  ... this is google play purchaseToken
            productId: subID,  // my subscription sku id
            packageName: 'com.xxxxxx', // my package name
            keyObject: key,  // my JSON file
            subscription: true, // optional, if google play subscription

        };



   var promise2 = iap.verifyPayment(platform, payment, function (error, response) {
        /* your code */
        if (error) {
            console.log('error with iap, ' , error);
            return true;
        } else {
            console.log('success with iap, response is: ', response);
            return true;
        }
    });

我也尝试了不同的库,得到了相同的结果:

var receipt = {
            packageName: "com.xxxx",
            productId: subID,  // sku subscription id
            purchaseToken: purchaseToken // my purchase token
            };

            var promise = verifier.verifySub(receipt, function cb(err, response) {
                if (err) {
                    console.log('within err, was there a response? : ', response); 
                console.log('there was an error validating the subscription: ', err);
                //console.log(err);
                return true;
                } else {
                console.log('sucessfully validated the subscription');
                // More Subscription info available in “response”
                console.log('response is: ', response    );
                return true;
                }
               });


// return promises later.

还有其他人遇到过这个问题吗?

【问题讨论】:

  • 我想知道是否有某种 google 配额,或者这可能是某种连接问题。如果出现该错误,我正在考虑仅重试 5-10 次,但这似乎很俗气且不可靠。
  • 对此有何解决方案?
  • 是的,请参阅下面的答案。

标签: node.js google-iap


【解决方案1】:

TLDR;创建一个新的产品 ID。

我终于找到了答案。问题不在于我的代码,也不在于 Google Developer Console 或 Google Play Console 中的权限。除了一件事之外,一切都设置正确。

以前,在 Google Play 控制台中设置测试许可证帐户之前,我在我的产品 ID“X”上使用真钱进行了实际订阅购买。

然后,在添加购买订阅的同一个谷歌帐户作为测试用户后,我继续在同一个订阅产品ID“X”上测试结果。

即使我取消了真正的购买,实际的到期日期也不是一个月。

因此,我相信有时 Google 在我购买/取消购买时会感到困惑 - 将测试订阅与实际订阅混淆。

创建一个新的产品 ID,并且只使用它,解决了我的问题,并且购买得到了一致的验证。

【讨论】:

  • 谢谢,我也失去了几天。很高兴它有帮助!
  • 创建新产品成功了。又在这里浪费了一天...感谢 Google!
  • 因为这个答案只损失了 15 分钟
  • 这很有帮助,但我什至不需要创建新的产品 ID。在我的情况下,只需对产品描述进行微不足道的编辑就足以修复它。
猜你喜欢
  • 2017-11-04
  • 2021-07-13
  • 2015-04-30
  • 2015-04-30
  • 2023-01-27
  • 1970-01-01
  • 1970-01-01
  • 2023-03-31
  • 2018-09-24
相关资源
最近更新 更多