IAP Badger

A simple, unified, IAP library for Corona SDK


Type function
Library iap_badger.*
Return value Table
Keywords load, read, inventory
See also iap_badger.saveInventory()


Attempts to load the inventory from the filename specified in iap_badger.init(). If the file does not exist, an empty inventory is returned. If the hash on the inventory file does not correspond to its contents, then an empty inventory will also be applied.

If a string is passed to the loadInventory, then IAP Badger will attempt to load the inventory from the hashed JSON string provided rather than from a device file. A valid string can be generated from the iap_badger.saveInventory() function. This allows IAP Badger to load an inventory recovered from a location other than the user's device (the cloud, for instance).

Note: the inventory file is automatically loaded from the users device when IAP Badger is initialized through the iap_badger.init() function call.


product (optional)

Table. An optional string to load the inventory from.


Load and print the loadProducts catalogue.

--Include the plugin
local iap = require 'plugin.iap_badger'

--Create the product catalogue
local catalogue = {

    --Information about the product on the app stores
    products = {    

    --Information about how to handle the inventory item
    inventoryItems = {
        hat = { productType="consumable" },

--This table contains all of the options we need to specify in this example program.
local iapOptions = {
    --The catalogue generated above
    --The filename in which to save the inventory

--Initialise IAP badger

--Load inventory file - on a first run, this will be empty.

This website uses cookies. Click here to see our privacy policy. Created using the Responsive Grid System.