无法使用Fovea购买插件从Google Play商店中检索产品

时间:2014-12-05 18:44:37

标签: android cordova in-app-purchase cordova-plugins

我使用Fovea.cc purchase plugin作为Android Cordova应用。该插件初始化,但无法找到我的应用内购买产品 - 我得到相同的"无法找到产品"错误如果产品不存在或应用程序未发布我会想。我正在寻找更多的问题排查步骤。

这是相关代码,在应用启动时调用:

store.register({
    id: "com.ineptech.wn.unlockgame",
    alias: "unlockgame",
    type: store.NON_CONSUMABLE
});
store.ready(function() {
    console.log("\\o/ STORE READY \\o/");  // This does get called
});
store.when("unlockgame").approved(function (order) {
    UnlockContent();
    order.finish();
});
store.refresh();
var p = store.get("unlockgame");
popup("Title = " + p.title);  
// this displays "Title = null"

以下是购买按钮的代码:

store.order("unlockgame");
// Results in "The item you were attempting to purchase 
//    could not be found" error from Play Store

以下是购买尝试在logcat中显示的内容:

I/ActivityManager(424): Displayed com.android.vending/com.google.android.finsky.billing.lightpurchase.IabV3Activity: +80ms
E/Volley(22062): [1009] BasicNetwork.performRequest: Unexpected response code 500 for https://android.clients.google.com/fdfe/preparePurchase

这就是我已经仔细检查的内容:

  • " unlockgame"是正确的产品ID
  • 产品在Play控制台中定义,处于活动状态
  • 该应用已发布并处于有效状态
  • 该应用程序内置于发布模式并在真实设备上运行
  • 设备可以到Play商店
  • 我的应用的许可密钥存储在res / values / billing_key.xml

还有什么可能阻止插件获取产品?

1 个答案:

答案 0 :(得分:3)

问题很可能与您的配置有关,但首先我看到您在执行store.refresh()后立即尝试访问产品标题

store.refresh();
var p = store.get("unlockgame");

但是,store.refresh()方法是异步的,只会触发对服务器的请求。您可以通过以下方式监控产品的变更:

store.when("unlockgame").updated(function(p) {
    alert("product is " + p.state + ", title is " + p.title);
});

然后致电:

store.refresh();

同时检查播放控制台上的产品ID是com.ineptech.wn.unlockgame,而不仅仅是unlockgame,而且它的类型为Managed