IAP Badger: a unified approach to in-app purchases

Thanks jerejigga.

I’ll have a look at these links but I need to clarify my first question before I go any further with the store testing…

Should productNames for the products table in iapCatalogue refer to the reverse domain ProductID I set in iTunes connect or the Reference Name?

The values in the productNames table should refer to the reverse domain ProductID you set in iTunes connect.

Hi there,

jerejigga is correct - the entries for “apple” in the productNames table should refer to the reverse domain ProductID set in iTunes Connect.

getLoadProductsCatalogue returns information that maps like this:

  • title = Display Name in iTunes Connect (for the appropriate user language)
  • description = Description in iTunes Connect (for the appropriate user language)

For more info about the kind of information you get back, copy and paste the sample code from the docs page for iap.loadProducts into your app.  It will print out the product table to the console (in a human readable form) so you can see exactly what values you are receiving. You will have to insert the code to pause the app, though, whilst you are waiting for the data to be served - for debug purposes you can just insert a timer that waits 10 seconds.

Simon

Hi Greg,

I don’t know why you’re getting a warning about a restricted library (the store code).  I work on an iMac and I’ve never encountered this problem.

However… it might also be that you need to reset your account - a hangover from when users had to pay to get access to certain Corona facilities (before Corona became free for everybody).  Try deauthorising your computer using the menu option in the simulator, then upgrade your Corona to the latest daily build, then re-login to your account on the simulator.

Thanks Simon, it was exacly that, I deauthorised and then re-logged in and it was gone!

Hi Simon,

I’m trying to get IAP-Badger working with Amazon, and am getting a generic error ‘An error occured while processing your purchase’   This is happening in Amazon acceptance testiing for any product they click on.

On my end the same code is working for Google Play and these items can be purchased from the previous version of my app before I added badger.  Any idea where I could start looking?

Thanks, Greg

 [“plugin.amazon.iap”] = {publisherId = “com.amazon”,  supportedPlatforms = { [“android-kindle”]=true },},

        CMD_100 = {productNames = { apple=“com.xxx.xxx.crystals”, google=“crystals”, amazon=“com.xxx.xxx.crystals”}, productType = “consumable”, onPurchase=function() iap.setInventoryValue(“crystals100”, true) end, onRefund=function() iap.removeFromInventory(“crystals100”, true) end,},

Hi Greg,

Could you answer the following and I’ll see if I can help?

  • Do you get this error on the Amazon IAP testing sandbox?
  • Is there any other information related to IAP in the device log when you try to purchase?
  • Is your app restricted to certain territories?
  • Are you sure everything definitely set up correctly in the console?

I’ve been reading that lots of people have been having problems in general with Amazon IAP through Corona due to the age of the plug-in - so I wouldn’t discount that this may be part of the issue.  By the look of this thread, though, the folks at Corona are working on an upgrade.

Hi Simon,

  1. The error is reported back to me from Amazon themselves.

  2. This is their log, its not much to go by:

03-19 12:35:19.122: V/Corona(25820): > Class.forName: plugin.amazon.iap.LuaLoader
03-19 12:35:19.122: V/Corona(25820): < Class.forName: plugin.amazon.iap.LuaLoader
03-19 12:35:19.122: V/Corona(25820): Loading via reflection: plugin.amazon.iap.LuaLoader
03-19 12:35:19.200: I/Corona(25820): WARNING: Asset file “images/buyback@2x.jpg” does not exist.
03-19 12:35:19.215: W/PackageManager(448): com.amazon.canary is not installed for user 0
03-19 12:35:19.215: W/PackageManager(448): com.amazon.fv is not installed for user 0
03-19 12:35:22.419: E/cutils-trace(26913): Error opening trace file: Permission denied (13)
03-19 12:35:34.239: I/ActivityManager(448): Waited long enough for: ServiceRecord{42629ea8 u0 com.amazon.venezia/com.amazon.sdk.availability.AvailabilityService}
 

  1. No the app isn’t restricted.

  2. This is an update to my app.  The products existed and purchasing works with my previous version on Amazon.  The same code runs great on Google Play using iap-badger.  The only thing different is the product id’s. on Amazon. My Amazon sku’s use my revierse url… ‘com.gbeegames.stellartrek.crystals’ or whatever the product is called.

Could this have anything to do with the fact that my items don’t have a price in IAP badger?

Is there any way I can send u my buy code to take a quick look?

Thanks for having a look, Greg

Hi Greg,

This is a new one on me.  Your plug-in setup looks fine, and assuming you’ve copied and pasted your product identifiers in from the Amazon console correctly, your code should work fine (as everything is up and running in Google Play, you should only need to add the Amazon product IDs and everything should function correctly).

It doesn’t matter that you haven’t set a price in IAP badger - the hard-coded prices you include are only for debug purposes only.

I’d be interested to see if you can download a product catalogue from the server (copy and paste the code from iap.loadProducts and print out what gets output to the console).  For testing purposes, call iap.loadProducts, then set a timer for ten seconds or so, before calling iap.getLoadProductsCatalogue.

If that doesn’t work, I’m happy to look at your purchase code through a personal message.

Simon

The only thing I can think of is that currently my iap-badger product is: ‘com.gbeegames.stellartrek.crystals’

My Amazon Store SKU is : crystals

I’m pretty sure that amazon adds the reverse url to the product when it does a purchase, as this works with my older version, but that seems to be the only place for an error here!

Maybe I’ll try submitting with the reverse url taken out of iap-badger?

Thanks again, Greg

Hi again,

Yes - I’d definitely try copying  the product ID exactly as it is in the portal.  Let me know what happens.

Simon

Hi Simon,

Well that worked!  IAP Badger is now working for me in Google, Apple and Amazon Stores. Thanks for such a great product and for taking the time to walk me through my problems.

All the best, Greg

You’re welcome.  Best of luck with the app.

Hi everyone,

For those of you who use IAP Badger with Amazon:

  • I am aware that Corona now supports Amazon IAP v2.
  • I’m working on updating IAP Badger to support these changes.
  • I’ll update and release the library ASAP…
  • …and I’ll do my best to give you time to meet the 30/4 deadline.

By the look of the blog posts from Corona, this (hopefully) shouldn’t involve anything more than a rebuild at your end.

Kind regards,

Simon 

Great, I just rolled IAPBadger out to all my apps :slight_smile:

Hi all,

Can you please help me to sort mess I made  :slight_smile:

I have only one “com.removeAds” consumable IAP in my game.

  1. I uploaded my app to itunnes connect and submited it for review.

  2. Then I rejected it (developer rejected) while it was “in review”

  3. Everything was fine until I received an e-mail few days later that “Apple review team returned my in-app purchase…”

  4. I submitted my app for review again, but itunnes connect showed that something is wrong with  "com.removeAds"

  5. I could not see what is wrong, so I deleted my IAP and created new one:  "com.noAds"

Now I get Runtime error while Restoring products: "iap badger.storeTransactionCallBack: unable to find product "** com.removeAds **" in a product for the apple store.

So it is best for me to delete my app and make new one?  :lol:

Many thanks.

Ivan

Hi Ivan,

I think that the most likely cause of your problem is: even though you’ve deleted the product in iTunes Connect, your test user is still registered as owning the com.removeAds item.  So when you perform a restore, which asks the App Store which products the user has an entitlement to, its response still includes com.removeAds.  (I presuming this item is actually a non-consumable, because consumable items are never included in the restore process - and you are not allowed to remove the user’s entitlement to consumable items they have purchased in the past.)

IAP Badger is then complaining, because it’s being told to restore a product that it doesn’t know anything about (ie. it’s not in the product catalogue).

If this is the cause, you probably have two options:

  1. shrug your shoulders and say this is never going to happen to anyone in the real world (because they never had the opportunity to buy that IAP in the first place).  Then test your code with a different test user and never go back to the first one.

  2. keep an empty com.removeAds item in the product catalogue that doesn’t have any functionality attached to it - IAP Badger will find the com.removeAds item, won’t do anything with it - but won’t throw an error.

Simon

Thanks Simon.

I do know why the heck but above mentioned option 1) did not worked for testing… I kept getting Runtime errors while  other users signed in!

Option 2 works well for testing purposes.

Many thanks.

Ivan

Hi everyone,

I’ve uploaded a new version of IAP Badger for Amazon IAP v2 onto my website at http://happymongoosegames.co.uk/iap_badger2.lua.  This version of the code works with the Amazon SDK tester for my apps so far, so hopefully it will work for you too.

However: I’m currently having issues uploading my new binary due to a separate issue, so I haven’t been able to test it thoroughly in a live environment.

I’ve put this out there as soon as possible to help everyone meet the 30/4 deadline.  Obviously, if you come across any issues, get in touch through this thread.  Hopefully, your mileage  won’t vary…

When I’m happy the library is working solidly, I’ll upload it to Github and the Corona plug-in system.

Simon

PS - The only change you should need to make to your code is to your build.settings file.  Read the bottom of this page for more information, then just run and rebuild your app.

Okay, Amazon have accepted one of my apps, so the new library is working correctly out in the wild.

I’ve updated the code on Github already, and I’ll rebuild and publish the Corona plugin version shortly (I’ll put a message up here when this is complete).  The changes in the latest version of the library are:

* support added for Amazon IAP v2

* removed generateAmazonJSON() function as it is no longer required (JSON testing file can now be downloaded from Amazon’s website)

* fixed null productID passed on fake cancelled/failed restore events

* changes to loadInventory and saveInventory to add ability to load and save directly from a string instead of a device file (to allow for cloud saving etc.)

* added getLoadProductsFinished() - returns true if loadProducts has received information back from the store, false if loadProducts still waiting, nil if loadProducts never called

* re-declared two functions that were declared globally instead of locally

I’ll also update the documentation on our website when I get a few moments.

To use the new code with the new Amazon IAP library, just change your build.settings file as indicated here and rebuild your app.  There is no need for any other changes to your code, so all you need to do is rebuild your app and submit to Amazon.

Let me know if you experience any problems.

Simon