Problem with IAP / store

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

is it Apple, Google Play or Amazon Store?

What kind of product are you testing (volatile, non-volatile, …)?

It’s on iOS/Apple, and we’re testing consumables.

Are you sure that you are using an iTunes Test Account on the device?

Yes, absolutely sure.

Very strange.

Did you test it using another device?

Yes, we’re encountering it on our Android devices as well, and we do have a check to init either the google or apple store, as I have shown below.  

if (system.getInfo("platformName") == "Android") then storeType = "google"; else storeType = "apple"; end store.init(storeType, transactionCallback);

That is very strange. Some people said that solved that problem by using another account or by restarting the phone. 

Based on your code, it does not appear to have anything wrong.

I would double check if the products sku (both on the code and online - Apple, Google).

Some links that may be useful:

http://stackoverflow.com/questions/2474663/how-to-skip-the-alert-youve-already-purchased-this-but-it-hasnt-been-download

http://support.nimblebit.com/customer/portal/articles/672080-problem-making-in-app-purchase-ios-os-x

Thanks for trying… we still haven’t found the source of this issue.  Restarting devices does not work.  If anyone can help, we’d very much appreciate it.

Well… for whatever odd reason it started working again.  All we’ve been doing is putting prints and pop-ups to display what is happening where, and lo and behold and magical things, it started working apparently on its own.  Sorry I couldn’t be more help if anyone else is having those issues…

is it Apple, Google Play or Amazon Store?

What kind of product are you testing (volatile, non-volatile, …)?

It’s on iOS/Apple, and we’re testing consumables.

Are you sure that you are using an iTunes Test Account on the device?

Yes, absolutely sure.

Very strange.

Did you test it using another device?

Yes, we’re encountering it on our Android devices as well, and we do have a check to init either the google or apple store, as I have shown below.  

if (system.getInfo("platformName") == "Android") then storeType = "google"; else storeType = "apple"; end store.init(storeType, transactionCallback);

That is very strange. Some people said that solved that problem by using another account or by restarting the phone. 

Based on your code, it does not appear to have anything wrong.

I would double check if the products sku (both on the code and online - Apple, Google).

Some links that may be useful:

http://stackoverflow.com/questions/2474663/how-to-skip-the-alert-youve-already-purchased-this-but-it-hasnt-been-download

http://support.nimblebit.com/customer/portal/articles/672080-problem-making-in-app-purchase-ios-os-x

Thanks for trying… we still haven’t found the source of this issue.  Restarting devices does not work.  If anyone can help, we’d very much appreciate it.

Well… for whatever odd reason it started working again.  All we’ve been doing is putting prints and pop-ups to display what is happening where, and lo and behold and magical things, it started working apparently on its own.  Sorry I couldn’t be more help if anyone else is having those issues…