Difference between revisions of "Iab"

From GiderosMobile
(Created page with "===== Code example: ===== local test = IAB.new("test") test:addEventListener(Event.AVAILABLE, function(e) --provide setup stuff (framework specific) test:setUp("value1", "v...")
 
Line 1: Line 1:
 
===== Code example: =====
 
===== Code example: =====
 +
<source lang="lua">
 
local test = IAB.new("test")
 
local test = IAB.new("test")
  
Line 16: Line 17:
 
test:isAvailable()
 
test:isAvailable()
 
test:restore()
 
test:restore()
 +
</source>

Revision as of 12:06, 7 March 2019

Code example:
local test = IAB.new("test")

test:addEventListener(Event.AVAILABLE, function(e)
	--provide setup stuff (framework specific)
	test:setUp("value1", "value2", "value3")
	test:purchase("product1") --purchase something
end)

test:addEventListener(Event.PURCHASE_COMPLETE, function(e)
	--unlock your purchase here
	print(e.productId, e.receiptId)
	test:confirm(e.productId)
end)

test:isAvailable()
test:restore()