Hello, I’ve been getting this error when trying to test purchasing in sandbox mode:
“You’ve already purchased this item but it hasn’t been downloaded.”
No matter what I try, this seems to be the only response I ever get back when testing IAP. What would be the cause of it, and how could I “reset” it to get rid of that error, as restore() doesn’t seem to help? Below I have a pop up that should appear when it is successful, but it never comes up, and the state is always “cancelled”.
Code example:
local function transactionCallback( event ) local transaction = event.transaction if transaction.state == "purchased" then print("Transaction successful!") print("productIdentifier", transaction.productIdentifier) print("receipt", transaction.receipt) print("transactionIdentifier", transaction.identifier) print("date", transaction.date) native.showAlert("Complete", "Purchase Successful", {"Okay"}); awardPurchase(transaction.productIdentifier); 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) --refunds only available in google play elseif ( transaction.state == "refunded" ) then print("refunded"); 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