Type Boolean Revision 2017.3060 Keywords Apple, IAP, in-app purchases, canLoadProducts See also store.loadProducts() store.*
This property will be true if the store supports the loading of products. Following confirmation, the store.loadProducts() function can be used to retrieve information about items available for sale.
store.canLoadProducts
local store = require( "store" )
-- Transaction listener function
local function transactionListener( event )
local transaction = event.transaction
end
-- Product listener function
local function productListener( event )
print( "Valid products:", #event.products )
print( "Invalid products:", #event.invalidProducts )
end
-- Initialize Apple IAP
store.init( transactionListener )
-- Sometime later, load products
if ( store.canLoadProducts ) then
local productIdentifiers = {
"com.coronalabs.ExampleInAppPurchase.Consumable",
"com.coronalabs.ExampleInAppPurchase.NonConsumable"
}
store.loadProducts( productIdentifiers, productListener )
end