IAP Badger

A simple, unified, IAP library for Corona SDK

iap_badger.getStoreName()

 
Type function
Library iap_badger.*
Return value String.
Keywords store, name, text, string
See also iap_badger.init()

Overview

This function returns the name of the store as a user readable string that is relevant for the current device.

This is useful for when you are sending the user messages about contacting the app store. For example, on iOS, you may wish to ask the user, 'Buy 50 coins from the App Store?" But on Android, you would want the string to read, 'Buy 50 coins from Google Play?'

When in debug mode, or on the simulator, IAP Badger will pretend to be the app store specified in the debug settings for iap_badger.init().

Syntax

iap_badger.getStoreName()

Examples


--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",

        },

    },

    --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
    catalogue=catalogue,
    --The filename in which to save the inventory
    filename="inventory.txt",
    debugStore="apple",
}

--Initialise IAP badger
iap.init(iapOptions)

--The store name that gets printed depends on the user's device.
print ("Would you like to buy 50 coins from the " .. iap.getStoreName() .. "?")


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