require "iab" iab = IAB.new("google") iab:setUp("...") iab:setProducts({p1 = "com.xxx.xxx.5lives"}) iab:setConsumables({"p1"}) --[[ CHECKING IF STORE IS AVAILABLE ]]-- iab:addEventListener(Event.AVAILABLE, function(e) print("is available") AlertDialog.new("is available","", "Ok"):show() iab:addEventListener(Event.PRODUCTS_COMPLETE, function(e) AlertDialog.new("restore ok","", "Ok"):show() print(e.error) end) iab:addEventListener(Event.RESTORE_ERROR, function(e) AlertDialog.new("restore error",e.error, "Ok"):show() print(e.error) end) iab:addEventListener(Event.PRODUCTS_COMPLETE, function(e) AlertDialog.new("load product ok","","Ok"):show() end) iab:addEventListener(Event.PRODUCTS_ERROR, function(e) AlertDialog.new("load product error",e.error, "Ok"):show() print(e.error) end) iab:addEventListener(Event.PURCHASE_COMPLETE, function(e) AlertDialog.new("Acaht ok","", "Ok"):show() print(e:getType(), e.productId, e.receiptId) end) iab:addEventListener(Event.PURCHASE_ERROR, function(e) AlertDialog.new("Achat probleme",e.error, "Ok"):show() print(e:getType(), e.error) end) end)