Google Play 마켓 플레이스에는 상품에 대한 '복원 됨'상태가 없습니다. 구매 한 모든 항목은 '구매 한'상태로 그룹화됩니다. 복원을 수행 할 때 파일/데이터베이스에 저장된 모든 구매 (소모품 구매 제외)를 지우고 반환 된 복원 된 구매를 정상 구매로 처리해야합니다. 복원의
안드로이드에
, 첫 번째 일치하는 대신 '구입'상태에 콜백을 얻을 것이다 경우 조건 아래 :
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()