Google Play v3

With Google IAP V3, you have to consume your purchases before you can buy them again.  See:  store.consumePurchase() as part of the Google IAP V3 plugin documentation:

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

If this is something you want the people to be able to buy again immediately you can call the consumePurchase() as part of your transaction call back for the purchase.

Rob

Thx for your fast feedback Rob!

I still don’t get it. In the doc it is written

"Note that some items are designed to be purchased only once and you should not consume them. For example, if a purchase unlocks a new world within a game, it should be ineligible for future consumption. In the Google IAP portal, these type of purchases are set up as managed products"

That’s the type of item I have in my app and I still get the message:

“Transaction failed:    7    Unable to buy item (response: 7:Item Already Owned)”

I just tested the restore function and it is restoring the item.

I’m sure I didn’t get the item before, but this is not possible, right? Is there a way to test if I somehow got the item or when I have done a possible purchase before?

Any help welcome!

There are basically two types of items that can be purchased.  Consumable and Non-Consumable.  Non-Consumable (or Managed in Google Lingo) you buy once.  You can never buy them again.   This is for things like “Unlock levels 21-40”, “Get upgraded powers”, “turn of ads”.   Consumable’s are for things like coins, gems, potions, energy, etc.  For Apple, Amazon and Google V2, you can just buy these whenever.  They are never “restored” when store.restore() is called, etc.  For Google V3, they changed the rules and even non-Consumables are now considered “Managed” and you have to consume them before you can buy them again.

If it shows up during a restore and you get this error when trying to purchases it, you have at some point in the past purchased it.

Rob

Okay, then I guess someone missed to refund this non-consumable in the past and the purchase is still ‘active’.

In this case I will search it and doing a refund (in Google Wallet) for the purchase.

What exactly is happening after I did a refund for the purchased item with the new V3? Will Google then automatically allow buying this item again and deactivate the “restore” possibility for this item (by deleting stored data for the item)?

UPDATE: I just noticed you wrote "non-Consumables are now considered “Managed” … but they were before considered “Managed”, right?

I mis wrote…  consumables are now considered managed.

When you issue a refund, the next time that user runs the app and store.restore() is called (I think) you will get a transaction with a “refunded” state.  At this point you should undo whatever purchasing did (lock the levels, take away the power, etc.)

Rob

I just tested code for a non-consumable WITHOUT store.consumePurchase and the refund was not detected.

So I think it will work like this:

I always have to use store.consumePurchase! With consumables AND with non-consumables.

With a “refunded” state I will lock everything the non-consumable purchase has unlocked.

A “restore” state can still be detected by Google… even with store.consumePurchase used.

Is this right?

UPDATE:

I now have tested the new V3 with a Non-consumable and it worked. But after deleting the app from the device and reinstalling it I wanted to RESTORE it and the restore is not working. How is a restore with the new V3 and the store.consumePurchase handled correctly?

V2 should still work, however Google will likely cut off V2 at some point.

Rob

Did you figure this out?

I have managed products (non-consumable products) for sale in my game. I have not yet been able to get a refund state from the transaction callback listener. I have been able to get the product to restore after the game is uninstalled and then reinstalled. I refunded the item and waited a few minnutes, uninstalled the game and then reinstalled, and the item was restored after calling store.restore()… I waited 24 hours. Now after calling the store.restore() I am getting nothing back from the transaction listener. (At this point I expected to see a refunded state returned)

You have confirmed that the non-consumable products also need to be run through store.consumePurchase in order to properly get a refund? Have you figured out why you were not getting it to restore using this method?

I don’t know that consumables can be refunded.  In the normal game model, if you buy 10 gems, use them then go to Google Play and request a refund, what happens if your gem total is 0?  How does your game handle -10 gems?  How do you know what things they bought with those specific gems to take away from them?

Rob

I don’t know anything about consumables, because I only have one non-consumable to unlock a full version of the app.

I did the following so far:

I purchased the full version which worked fine. Then I deinstalled the app and installed it again to test the restore, which worked fine.

I deinstalled it again and then cancelled the purchase in Google Wallet. I waited some hours and tested the restore again, which still worked!

I deinstalled the app again, installed the locked version again and tested a purchase which didn’t work, because I still got the message the product already was bought before and I own it already. The restore still worked!

I had to wait for over 24 hours until a normal purchase of the product was possible again. I haven’t tested the restore after this point, but I guess it isn’t working because Google had got the info about the cancelled Google Wallet money transaction.

I don’t know about the refunded state so far. I think you have to test in a full unlocked version for an already purchased non-consumable if this non-consumable is still ‘owned’… which means you have to use the store code even in a full unlocked game from time to time to test for the refunded state. Is this correct?

I wish you all a Happy New Year! :slight_smile:

Best,

Daniela

So are you using store.consumePurchase() on your non-consumable items?

I run a restore everytime the game is loaded… I have not yet been able to get a refunded state… Actually what happens is I cancel the purchase by requesting a refund through my test account, which cancels the order in my google wallet merchant account… wait around 24 hours (Ive read you have may have to wait between 24-48 hours before google will send a refund notification). After 24 hours I no longer recieve a purchased state (or restore)… I dont recieve anything from the transaction listener after google refunds (Im assuming) the item. 

Is it possible to test for a refund with an app that is side loaded with a gmail account with license testing?

No. I’m not using it.

Hi, Rob

I think there is a problem in Google Play v3 plugins.

I test the same code, with different parts

store = require(“store”)   vs.

store = require(“plugin.google.iap.v3”)

then

store.init( “google”, transactionCallback )

works fine on the old one, but fail (just hang there) on v3 plugins.

I do have the build.setting plugins right, I am pretty sure about that.

BOB

@bobyeh

I have the same problem. Google IAP v3 is causing hanging on my Android game.

I posted about it on another thread, but got no response:

http://forums.coronalabs.com/topic/52201-increase-in-anrs-on-google-play-with-iap-v3/

I think this is the same issue that I responded to here:

http://forums.coronalabs.com/topic/50156-storeavailablestores-returning-bill-with-google-yap-v3/?p=268421

Can you post your build.settings?

Are you seeing any error’s from the device’s console log (adb logcat)?

Rob

In david’s linked thread, there are a couple of issues mentioned. The first is a crash, which was resolved by david.

The other issue looks like the same ANR problem I had/have. 

st.tosi believes they fixed the problem by making themselves an alpha tester and doing a few other things, but I think it’s probably just random. I could only recreate my ANR issue on one of my Android devices (HTC One) so it’s not unreasonable that the problem can come and go depending on other factors. 

My guess for what happened is just that the main thread is hanging while waiting for IAP v3 module if there is too much other stuff going on. That’s why adding a delay before loading IAP v3 helped. I wrote a bit more at the other thread.

Also, the common factor between the two issues is this appearing in logcat:

V/Corona  (27335): > Class.forName: plugin.google.iap.v3.LuaLoader
V/Corona  (27335): < Class.forName: plugin.google.iap.v3.LuaLoader

Is there any update about fixes coming for the IAP V3 plugin? It seems like there are still issues with crashes and purchases getting called multiple times. I’m using build 2482.

The IAP V3 is a plugin so it’s not tied to a specific build.  Is there a filed bug report?

Rob

There isn’t. 

Here are some of the issues. Everything listed below works perfectly on iOS.

The listener doesn’t get called when you do store.loadProducts.

When you try to buy a non-consumable/managed IAP you already own, it crashes. In the logs:

In-app billing error: Unable to buy item, Error response: 7:Item Already Owned