It looks like you're new here. If you want to get involved, click one of these buttons!
require "iab"
iab = IAB.new("iOS")
iab:setProducts({p1 = "guessanimal", p2 = "200ss"})
iab:setConsumables({"p1", "p2"})
iab:addEventListener(Event.AVAILABLE, function(e)
--
iab:addEventListener(Event.PRODUCTS_COMPLETE, function(e)
for i = 1, #e.products do
local p = e.products[i]
print(p.productId, p.title, p.description, p.price)
end
end)
iab:addEventListener(Event.PRODUCTS_ERROR, function(e)
print(e:getType(), e.error)
end)
iab:requestProducts()
iab:addEventListener(Event.PURCHASE_ERROR, function(e)
print(e:getType(), e.error)
end)
iab:addEventListener(Event.PURCHASE_COMPLETE, function(e)
if (e.productId == "p1") then
coins=coins+100
dataSaver.saveValue("coins", coins)
local alertDialog = AlertDialog.new("You have that much coins now ", coins, "OK")
alertDialog:show()
end
if (e.productId == "p2") then
coins=coins+200
dataSaver.saveValue("coins", coins)
local alertDialog = AlertDialog.new("You have that much coins now ", coins, "OK")
alertDialog:show()
end
end)
end)
--
iab:isAvailable()