I’ve just uploaded my code for a unified approach to in-app purchases in Corona on Github.
- a unified approach to calling store and IAP whether you’re on the App Store, Google Play or Amazon
- simplified calling and testing of IAP functions - just provide IAP Badger with a list of products and some simple callbacks for when items are purchased / restored or refunded
- a testing mode, so your IAP functions can be tested on the simulator or a real device without having to contact an actual app store.
- simplified product maintenance (adding/removing products from the inventory)
- handling of loading / saving of items that have been purchased
- products can have different names across the range of stores (so an upgrade called ‘COIN_UPGRADE’ in iTunes Connect could be called ‘coins_purchased’ in Google Play) without the need for additional code
- different product types available (consumable or non-consumable)
Inventory / security features:
- customise the filename used to save the contents of the inventory
- inventory file contents can be hashed to prevent unauthorised changes (specify a ‘salt’ in the init() function).
- a customisable ‘salt’ can be applied to the contents so no two Corona apps produce the same hash for the same inventory contents. (Empty inventories are saved without a hash, to make it more difficult to reverse engineer the salt.)
- product names can be refactored (renamed) in the save file to disguise their true function
- quantities / values can also be disguised / obfuscated
- fake items can be added to the inventory, whose values change randomly with each save, to help disguise the function of other quantities being saved at the same time.
- IAP badger can generate a Amazon test JSON file for you, to help with testing on Amazon hardware
It’s called IAP Badger because - well, you know.
Hope this makes using IAP’s simpler for some of you - you can find the repository at https://github.com/happymongoose/iap_badger.