2014-12-05 84 views
3

我正在使用Fovea.cc purchase plugin进行Android Cordova应用。该插件初始化,但无法找到我的应用程序内购买产品 - 如果该产品不存在或者该应用程序未发布,我会得到相同的“产品无法找到”错误。我正在寻找更多的故障排除步骤。使用Fovea购买插件无法从Google Play商店检索产品

下面是相关的代码,这就是所谓的应用程序启动:

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商店没关系
  • 我的应用程序的许可证密钥存储在RES /价值/ billing_key.xml

还有什么可能使插件无法获得产品?

回答

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型。

+0

产品ID只是解锁游戏 - 我是这样输入的,因为我模仿你的示例代码:“store.register({id:'cc.fovea.purchase.nonconsumable1',...”我收集我误解了你的 – DevOfZot 2014-12-09 05:09:00

+0

不幸的是,问题仍然存在,使用id:“unlockgame”,并且产品是托管的。我已经恢复使用不同的插件,但是如果您有任何其他想法,我很乐意测试他们。 – DevOfZot 2014-12-10 06:57:52

+0

我如何在单一功能中获得所有活动产品的详细信息(编号,名称,描述)? – Mohanraj 2017-04-18 11:45:10

相关问题