In App purchase already purchased

Hi,
I’ve have been working on adding an in-app purchase into my app and have come across the following problem. Whenever I try to purchase an item, I receive the follow message:
You’ve already purchased this In App Purchase but it hasn’t been downloaded.

Is this because I have purchased it already, or because something isn’t getting called that downloads the content? Thanks

-David [import]uid: 10942 topic_id: 5618 reply_id: 305618[/import]

i am having the same issue. besides the fact that it would confuse my users (because no purchases are downloaded in my app), the only option to hit is “ok” and that returns transaction canceled to the callback. Thus leaving me unable to reinstate that purchase for the user if they have deleted the app and reinstalled it.

Does anyone have some advice on this subject? [import]uid: 9187 topic_id: 5618 reply_id: 19153[/import]

You must call store.finishTransaction( transaction ) which tells Apple that the In-App purchase finished successfully. Otherwise Apple assumes something went wrong and the transaction is incomplete.

http://developer.anscamobile.com/reference/index/storefinishtransaction
[import]uid: 7563 topic_id: 5618 reply_id: 19160[/import]

I have modified the ansca provided sample with 4 of my items so that we are on the same page as far as code.

At the end of transactionCallback(), [lua]store.finishTransaction(event.transaction)[/lua]
is being called.

I am having two issues, first the previously mentioned problem “You’ve already purchased this In App Purchase but it hasn’t been downloaded.” and clicking “okay” returns event.transaction.state == “cancelled”, leaving me no way to restore that items state to purchased locally.

Second is when using restore, inside transactionCallback() again
[lua]elseif event.transaction.state == “restored” then[/lua]
never gets called. Even though state clearly ==“restored” in the console print out.

I am very confused. [import]uid: 9187 topic_id: 5618 reply_id: 19174[/import]

Ansca sample,
inside
[lua]elseif event.transaction.state == “restored” then[/lua]
commented out [lua]infoString = “Restoring transaction:” …
"\n Original ID: " …event.transaction.originalTransactionIdentifier …
"\n Original date: "…event.transaction.originalDate[/lua]
Both issues resolved. Trying to purchase an item I already own auto evokes a restore, and manual restore works as well.

I’m happy now. [import]uid: 9187 topic_id: 5618 reply_id: 19183[/import]

also stuck with “You’ve already purchased this in App Purchase but it hasn’t been downloaded.” [Environment: Sandbox].
Also using modified Ansca provided example so:
store.finishTransaction( event.transaction ) is being called every time.
Also not seeing “restored” fired.
With regard to the answer above, the textBox does not seem to be updated if any of the values are nil. (So changed all text to tostring(event.transaction.originalDate) for example
(1) how can the store be notified that the transaction is complete?
(our application will add additional features internally)
(2) why doesn’t “restored” fire?(where application could at least behave like the purchase was made. (The store would still presumably be “purchased but not downloaded”)) When OK is pressed and the transaction comes back cancelled, all detail fields with which we could validate the transaction originalDate, originalReceipt… are nil.
(3) how could the above solution, commenting out text for the textBox change the behavior of the store?
(4) Where in the console (the xCode console?) are the states shown?
I don’t see any detail like that in the console.
The only console message relative to the store is:
skpaymentqueue:: Ignoring restoreCompletedTransactions because already restoring transactions
when I hit my restore button multiple times. Still the:
elseif event.transaction.state == “restored” then
doesn’t fire. Thanks
2/21
(1) by having code that executes correctly
(2) see 1 and 3
(3) code had a syntax error. In my case it was “value.save” which really is “valueSave”. Moral: check and recheck code for errors.
(4) still learning about the xCode console. During the whole process of figuring this out I didn’t see anything useful in the console. [import]uid: 12635 topic_id: 5618 reply_id: 23494[/import] </skpaymentqueue:>

A further question for you regarding this: when a store event of type “cancelled” or “failed” is triggered, should we be making a call to store.finishTransaction( transaction ), or is finishTransaction only needed to be called to respond to a “purchased” or “restored” event?

I am currently only calling ‘store.finishTransaction( transaction )’ when a “purchased” or “restored” event is detected. Is this correct?

I also noticed in my device console that when the store init is called, a large number of “cancelled” and “failed” events are generated straight away - even if I had no cancelled or failed transactions pending. What could be the reason for that?

Cheers
Cel. [import]uid: 9428 topic_id: 5618 reply_id: 28068[/import]

Yes commenting out the following worked for me too.

infoString = “Restoring transaction:” …
"\n Original ID: " …event.transaction.originalTransactionIdentifier …
"\n Original date: "…event.transaction.originalDate [import]uid: 63413 topic_id: 5618 reply_id: 41297[/import]

hi, getting the same error in Sandbox,

function transactionCallback( event )  
 if event.transaction.state == "purchased" then   
 savePurchase("remove\_ads1") --you should enter here the product being purchased  
 elseif event.transcation.state == "restored" then   
 savePurchase("remove\_ads1") --you should enter here the product being purchased  
 elseif event.transaction.state == "cancelled" then  
 elseif event.transaction.state == "failed" then   
 infoString = "Transaction failed, type: ", event.transaction.errorType, event.transaction.errorString  
 local alert = native.showAlert("Failed ", infoString,{ "OK" })  
 else  
 infoString = "Unknown event"  
 local alert = native.showAlert("Unknown ", infoString,{ "OK" })  
 end  
 store.finishTransaction( event.transaction )  
 end  

every time transaction get failed. Dont know where is my fault. Even I am not able to see the output at xcode console because I do have IOS 6. [import]uid: 171927 topic_id: 5618 reply_id: 130398[/import]

hi, getting the same error in Sandbox,

function transactionCallback( event )  
 if event.transaction.state == "purchased" then   
 savePurchase("remove\_ads1") --you should enter here the product being purchased  
 elseif event.transcation.state == "restored" then   
 savePurchase("remove\_ads1") --you should enter here the product being purchased  
 elseif event.transaction.state == "cancelled" then  
 elseif event.transaction.state == "failed" then   
 infoString = "Transaction failed, type: ", event.transaction.errorType, event.transaction.errorString  
 local alert = native.showAlert("Failed ", infoString,{ "OK" })  
 else  
 infoString = "Unknown event"  
 local alert = native.showAlert("Unknown ", infoString,{ "OK" })  
 end  
 store.finishTransaction( event.transaction )  
 end  

every time transaction get failed. Dont know where is my fault. Even I am not able to see the output at xcode console because I do have IOS 6. [import]uid: 171927 topic_id: 5618 reply_id: 130398[/import]

Hi
I wanna add my app in apple Store for sale , my app is a game have 5 level and the first two level are free and the rest its going to have a price.
My question is : Do i have to block the rest level in my own or when im ready to submit my app in apple store it will block the level automatic ?
somebody can tell me how is work putting app for sale ?
thanks [import]uid: 180288 topic_id: 5618 reply_id: 136831[/import]

Hi
I wanna add my app in apple Store for sale , my app is a game have 5 level and the first two level are free and the rest its going to have a price.
My question is : Do i have to block the rest level in my own or when im ready to submit my app in apple store it will block the level automatic ?
somebody can tell me how is work putting app for sale ?
thanks [import]uid: 180288 topic_id: 5618 reply_id: 136831[/import]