2013-07-02 51 views
2

在我的應用程序中,我使用了應用程序purchase.it購買perfect.but當我刪除我的應用程序,並再次installed.its恢復選項返回到失敗state.how獲取恢復狀態或如何使用響應代碼恢復事務恢復。我在網上搜索他們告訴Inapp Restore for android corona sdk?

store.restore() 

這不工作在android然後如何獲得購買物品清單。

回答

2

在Google Play市場中,商品沒有「已恢復」狀態。所有購買的商品都將歸入「已購買」狀態。當您進行恢復時,您應清除保存到文件/數據庫的所有購買項目 - 消費品購買除外 - 並將退回的恢復購買項目視爲正常購買項目。

在Android上,你會得到與「購買」,而不是狀態的回調修復,比較第一,如果條件如下:

local store = require "store" 

function transactionCallback(event) 
    local transaction = event.transaction 
    if transaction.state == "purchased" then 
     print("Transaction succuessful!") 
    elseif transaction.state == "restored" then 
     print("Transaction restored (from previous session)") 
     print("productIdentifier", transaction.productIdentifier) 
     print("receipt", transaction.receipt) 
     print("transactionIdentifier", transaction.identifier) 
     print("date", transaction.date) 
     print("originalReceipt", transaction.originalReceipt) 
     print("originalTransactionIdentifier", transaction.originalIdentifier) 
     print("originalDate", transaction.originalDate) 
    elseif transaction.state == "cancelled" then 
     print("User cancelled transaction") 
    elseif transaction.state == "failed" then 
     print("Transaction failed, type:", transaction.errorType, transaction.errorString) 
    else 
     print("unknown event") 
    end 

    -- Once we are done with a transaction, call this to tell the store 
    -- we are done with the transaction. 
    -- If you are providing downloadable content, wait to call this until 
    -- after the download completes. 
    store.finishTransaction(transaction) 
end 

store.init(transactionCallback) 
store.restore()