IAP Badger

A simple, unified, IAP library for Corona SDK


Type function
Library iap_badger.*
Return value
Keywords version
See also iap_badger.getLoadProductsCatalogue(), iap_badger.printLoadProductsCatalogue(), iap_badger.loadProducts()


Following a call to iap_badger.loadProducts(), this function returns true if the product catalogue has been completely downloaded by the relevant app store. The download product catalogue contains information about IAPs that are available for purchase, as well as their description and price.




Querying the library version currently in use:

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

--Create the product catalogue
local catalogue = {

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

        --buy50coins is the product identifier.
        --Always use this identifier to talk to IAP Badger about the purchase.
        buy50coins = {
                --A list of product names or identifiers specific to apple's App Store or Google Play.
                productNames = { apple="buy50coins", google="50_coins", amazon="COINSx50"},
                --The product type
                productType = "consumable",
                --This function is called when a purchase is complete.
                onPurchase=function() iap.addToInventory("coins", 50) end,
                --The function is called when a refund is made
                onRefund=function() iap.removeFromInventory("coins", 50) end,

                --Simulator / debug information about app store pricing etc.
                simulatorPrice = "£0.79",
                simulatorDescription = "A packy of 50 shiny coins.  Spend them wisely.",
                simulatorTitle = "50 coins",



    --Information about how to handle the inventory item
    inventoryItems = {
        coins = { 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

local function loadProductsListener()

    --This will return true - the listener is called once the product catalogue is ready
    if (iap.getLoadProductsFinished()) then print "Product catalogue ready" else print "Product catalogue still being downloaded" end


--Initialise IAP badger

--Load the product catalogue from the relevant app store - when this is complete, print out a sample message

--This will return false - there will be a delay between calling loadProducts and the process of downloading the IAP data being completed
if (iap.getLoadProductsFinished()) then print "Product catalogue ready" else print "Product catalogue still being downloaded" end

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