New Google IAP Plugin and IAP Badger

Does anybody know if the new Play Store IAP plugin ( works with IAP Badger? The docs say the new plugin will load with store=require(""), so IAP Badger should “just work” without including the library locally and updating the code to require the new plugin, but there are a couple of changes, and I haven’t gone deep enough into IAP Badger to know if they will cause a problem.
Does anyone has a live app using the “out of the box” version of IAP Badger and the new Google billing plugin?

1 Like

After some testing, I’m now about to publish a new version with (using IAP Badger as plugin).

1 Like

Fingers crossed, indeed! Please let us know how it goes.

ok, I confirm that purchases and restores work perfectly :+1:


I finally got around to doing a build with, and when I did a test purchase on device, the listener fired off nine times. That is to say, there were nine native.showAlert windows acknowledging the purchase, and a purchase of 20 hints resulted in 180 hints being awarded. I had been using the old, cached version of IAP Badger, so I changed to the one from and tried again but got the same result.

I switched back to, rebuilt and tried again and purchasing worked as expected. (Mostly, I initially got a message that the transaction couldn’t be concluded because I already owned the item, indicating that it hadn’t been “consumed” properly as part of the previous purchase, but then it figured it out and finished the transaction as expected.)

Watching all this play out in logcat, I saw the following messages repeated eight times:
Purchase already being finished (acknowledged)[my IAP's product ID]. It is safe to ignore this message
Product already being consumed, skipping it: [my IAP's product ID]. It is safe to ignore this message

I went through every print statement in the IAP Badger library, and there’s nothing with that syntax, and the print statements that print an event are all behind if (verboseDebugOutput) then. Since I don’t have debugging output turned on, my presumption is that these messages are coming from

My implementation of IAP Badger is as close to vanilla as possible, and it’s been working fine for years. Anybody have any guesses as to what’s going on?

OK- turns out the problem was that I made a silly mistake a few years ago and it only showed up when I switched to

Owing to a misreading of the IAP Badger docs, I thought it was necessary to initialize IAP Badger every time it was going to be called, so I was initializing it all over the place. Previously, this wasn’t a problem, because the various stores were ignoring what it seems were multiple purchase calls every time someone made an in-app purchase. However, something about the new version of Google’s IAP billing plugin and asynchronous calls was giving a callback to every initialized instance of IAP Badger, so even though the test card was only being billed once, the purchase-complete listener was being pinged once for every time I’d initialized IAP Badger.

Once I pared my init call down to one time in main.lua, everything went back to normal- problem solved. So, if you’re having weird problems with and IAP Badger, make sure you’re only calling the init one time. :rofl:

@colinmorgan, @stefano.mazzotta - I’m not using IAP Badger, yet, but in configuring my own code to use the new, there is one BIG and IMPORTANT thing that IAP Badger must do, and that’s to check if event.transaction.state = “finished”, and if it does, be sure to call store.finishTransaction(event.transaction). The reason is because, rarely, the purchase doesn’t always ‘finish’ itself. When this happens, the user can’t make a second purchase, because the first one hasn’t been completed. Once I got this working, I never saw this problem with a second purchase again. It works great. Also, the only other change I had to make was to REMOVE “” from my build.settings, since that was required to support the old IAP.

@troylyndon Thanks for the tips!

As part of diagnosing this whole debacle, I switched from the plugin to running IAP Badger as a local library, and had, at Alan Thomson’s advice, added a check for if event.transaction.state = “finished”, but I wasn’t calling store.finishTransaction(event.transaction), so I’ll stick that in there with a if (debugMode~=true) wrapper in keeping with how it’s called the rest of the time in IAP Badger.

Quick followup question: Is it going to cause problems if store.finishTransaction(event.transaction) is called twice? My reading of the docs is that a successful transaction will return both "purchased" and "finished", and "purchased" is already calling store.finishTransaction(event.transaction).

If the purchase successfully does a finishTransaction, you won’t receive a “finished” callback.

Great- thanks!