2014-12-05 32 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

相關問題