IAP Badger: a unified approach to in-app purchases

Hi,

First of all, thank you for a great plugin!

We are experiencing some issues on simulator while testing IAPs. To me it looks like the commit made a couple of days ago causes this. 

This is what’s going on

  1. I’m trying to restore on simulator.

  2. IAP Badger set the productIdentifier to debugProductIdentifier. This is old code. 

  3. Since a few days, IAP Badger now throws an error if it couldn’t lookup the product using the product identifier (starting on line 1039). 

Can you please help resolve this?

You’re absolutely right - the new code will trip if you cancel or restore in debug mode using the latest version.

I introduced this error fixing another one :slight_smile:

I’ll put in place a fix.

Simon

Cool, thanks!

Should be fixed now.

Simon

Yeah it works, but still an issue for successful restore. 

Feels like an issue here:

 for i=1, #productList do --Get the product local productID = getAppStoreID(productList[i]) --If this product isn't consumable... local processItem=true; if (catalogue.products[productList[i]].productType~="consumable") then processItem=false end if (catalogue.products[productList[i]].allowRestore) then procesItem=true end if (processItem) then --Create a fake event for this product local fakeEvent={ transaction={  

I’ve updated the code - try it again and see what happens…

Simon

Works better now, thanks! 

Brilliant - glad it’s working for you.

Simon :slight_smile:

Hi Simon,

I use IAP Badger as a plugin, and two days ago I published an app update to iTunes (the first in about a year) . Now, in my error-server I am finding several crashes which appear to be in IAP Badger:

:0: attempt to concatenate field productIdentifier (a nil value)

stack traceback:
    : in function :966

There is not much info to go on since this is presumably in a plugin - I have no field called “productIdentifier”, and IAP Badger does (although not on line 966, as far as I can tell from github: https://github.com/happymongoose/iap_badger/blob/master/iap_badger.lua))

The build was made with Corona 2017.3158, on October 30th.

I’m not sure what the issue is. The app has two Product IDs in ITC, one current and one that looks like a mistake, but it was a long time since I set them up and I don’t recall if the second one was ever in use.

I’m thinking that perhaps I should do the following to debug:

  1. include iap_badger.lua in my project

  2. set handleInvalidProductIDs

Thoughts?

Hi there,

This sounds like it may be related to your second product - I have been changing how unknown product IDs are handled by the system.

The first thing I’d try is setting handleInvalidProductIDs - if this makes the problem go away, then it was related to your user attempting to restore a product you haven’t told IAP Badger about.

If that doesn’t work, try setting  verboseDebugOutput to true in iap.init() and capture the (relevant) console output in Xcode and share it here - that should help us track down the issue (hopefully down to the exact section of code in IAP Badger throwing the error).

Simon

PS - You shouldn’t need to change from the plug in version for the time being - Github and the plug in are identical at the moment.

Hi @happymongoose - any chance of implementing subscription products in IAP Badger?

I’ve never developed the subscription side of things because I’ve never needed a subscription product for my own apps - as ever, though, I’m happy to collaborate with someone if they’re willing to share their code (if anyone wants to do this, don’t forget IAP Badger is open source).

I think part of the problem with this is that subscriptions really require some server side code for confirmation, and then everything starts to depend on individual server setups - which goes beyond the scope of a simple lua plugin.

(I may be wrong on this).

Simon

OK thx - will have a look at the code

Hi @happymongoose the repository only seems to contain Lua? Was expecting to see the native stuff so we could look at extending for subscriptions.

Corona allows you make pure lua plugins. Which is what this plugin is.

That correct beernathan - it’s a pure lua plug-in.

It’s just a wrapper class for the three different store classes in Corona (they all work slightly differently, so it offers a unified interface for managing IAP).

Simon

Ahh - makes sense now. We’re looking to go beyond what Corona offer in order to access subscription products. Will probably proceed with the Native development.

Just to let everyone know I’ve updated the library to  version 14 on the plug-in and Github:

Changes:

* Fixed bug introduced in version 12 on Android devices that mishandled failed/cancelled events

* Better handling (and improved consistency between devices) of transaction receipts

Simon

Hi Simon,

Going back to my issue about iOS crashes (November 1).

I used a local copy and narrowed it down, it turns out it crashes when restoring purchases on devices that are either not logged in properly to iTunes or simply just not online.

In both cases it is crashing in the print statement on line 1069 :

print (“ERROR: iap badger.storeTransactionCallback: unable to find product '” … transaction.productIdentifier … “’ in a product for the " … targetStore … " store.”)

productIdentifier is nil, and hence cannot be concatenated, causing the crash.

With verboseDebugOutput, it also crashes earlier, line 1037, for the same reasons