Google IAP V3: Item already owned (state failed)

Hello everyone,

I have implemented store in my app, using Google IAP V3.

I purchased one item, and then i uninstalled the app.

I have Non Consumable Product.

I get the state failed, the next time i install the app and try to buy the same item from store.

I get the following log in my console log.

What shall i change to resolve  this issue.

[lua]

I/Corona  (25049): **** In transactionCallback function ****
I/Corona  (25049): transactionCallback: Received event storeTransaction
I/Corona  (25049): state: failed
I/Corona  (25049): errorType: 7
I/Corona  (25049): errorString: Unable to buy item (response: 7:Item Already Own
ed)
I/Corona  (25049): Transaction failed, type: 7 Unable to buy item (response: 7:I
tem Already Owned)

[/lua]

~Thanks & Regards

  Rohan K

Hi Rohan,

In v3, you still need to “consume” products before they can be purchased again. See the documentation here:

http://docs.coronalabs.com/plugin/google-iap-v3/consumePurchase.html

Take care,

Brent

Hi @Brent,

I tried with the consume store.consumePurchase.

when i uninstall and install the app and select the item from store.

It is returning failed state from transactionCallBack and then it is entering consumed state, anyway the item is getting unlocked.

First time i can purchase everything, but after installing app again it returns fail state and then returns consumed.

Actually it should return only consumed state.

Please suggest where i am going wrong.

Here is my transactionCallBack function

[lua]

function transactionCallback( event )

local infoString

if event.transaction.state == “purchased” then

infoString = “--------Transaction successful!---------”

unlockFeature(event);

elseif event.transaction.state == “consumed” then

     print( “---------Transaction consumed! ----------” )

     unlockFeature(event);

elseif  event.transaction.state == “restored” then

elseif  event.transaction.state == “refunded” then

elseif event.transaction.state == “cancelled” then

elseif event.transaction.state == “failed” then   

else

end

store.finishTransaction( event.transaction )

end

 

store.init(“google”, transactionCallback)

store.consumePurchase(purchaseItem,transactionCallback)

[/lua]

~Thanks

Hi @rohit.r,

There is no “restored” state for Google IAP v3. Please see this page for details:

http://docs.coronalabs.com/plugin/google-iap-v3/restore.html

Take care,

Brent

HI Brent,

Thanks for your co operation.

Actually i don’t have any issue with restore , its working fine (the code for restore was previous IAP code)

i just need to call managed products to be tracked and it should entered into consumed state but before entering into consume state its going into failed state. So please help me with this.

Thanks ,

Rohit.

Hi Rohit,

Can you please give me a detailed step-by-step outline of your process? Meaning, exactly which order you perform IAP calls in, and what happens on each. I just want to be perfectly clear on this point before we continue.

Thanks,

Brent

Hi Rohan,

In v3, you still need to “consume” products before they can be purchased again. See the documentation here:

http://docs.coronalabs.com/plugin/google-iap-v3/consumePurchase.html

Take care,

Brent

Hi @Brent,

I tried with the consume store.consumePurchase.

when i uninstall and install the app and select the item from store.

It is returning failed state from transactionCallBack and then it is entering consumed state, anyway the item is getting unlocked.

First time i can purchase everything, but after installing app again it returns fail state and then returns consumed.

Actually it should return only consumed state.

Please suggest where i am going wrong.

Here is my transactionCallBack function

[lua]

function transactionCallback( event )

local infoString

if event.transaction.state == “purchased” then

infoString = “--------Transaction successful!---------”

unlockFeature(event);

elseif event.transaction.state == “consumed” then

     print( “---------Transaction consumed! ----------” )

     unlockFeature(event);

elseif  event.transaction.state == “restored” then

elseif  event.transaction.state == “refunded” then

elseif event.transaction.state == “cancelled” then

elseif event.transaction.state == “failed” then   

else

end

store.finishTransaction( event.transaction )

end

 

store.init(“google”, transactionCallback)

store.consumePurchase(purchaseItem,transactionCallback)

[/lua]

~Thanks

Hi @rohit.r,

There is no “restored” state for Google IAP v3. Please see this page for details:

http://docs.coronalabs.com/plugin/google-iap-v3/restore.html

Take care,

Brent

HI Brent,

Thanks for your co operation.

Actually i don’t have any issue with restore , its working fine (the code for restore was previous IAP code)

i just need to call managed products to be tracked and it should entered into consumed state but before entering into consume state its going into failed state. So please help me with this.

Thanks ,

Rohit.

Hi Rohit,

Can you please give me a detailed step-by-step outline of your process? Meaning, exactly which order you perform IAP calls in, and what happens on each. I just want to be perfectly clear on this point before we continue.

Thanks,

Brent