It looks like you're new here. If you want to get involved, click one of these buttons!
Here is my code...
--[[ RESTORING PURCHASES ]]--
-- we can either provide button to restore purchases or launch it on every app start
-- this will simply launch purchase event for every unconsumable item
-- in app purchasing if DEBUGGING then iab = {} iab.addEventListener = function() print('IAB addEventListener') end iab.setUp = function() print('IAB setup') end iab.isAvailable = function() print('IAB isAvailable') end iab.requestProducts = function() print('IAB requestProducts') end iab.restore = function() print('IAB restore') end iab.purchase = function() print('IAB purchase') end iab.setConsumables = function() print('IAB setConsumables') end iab.setProducts = function() print('IAB setProducts') end else require 'iab' iab = IAB.new('google') end iab:setUp(IAB_KEY) iab:setProducts({remove_adverts = "remove_adverts"}) iab:addEventListener(Event.AVAILABLE, function(e) print("IAB_AVAILABLE") SHOP_READY = true iab:addEventListener(Event.PRODUCTS_COMPLETE, function(e) for i = 1, #e.products do local p = e.products[i] print("IAB_PRODUCTS_COMPLETE") print(p.productId..", "..p.title..", "..p.description..", "..p.price) end end) iab:addEventListener(Event.PRODUCTS_ERROR, function(e) print("IAB_PRODUCTS_ERROR") print(e:getType()..", "..e.error) end) iab:requestProducts() iab:addEventListener(Event.PURCHASE_COMPLETE, function(e) local prefs = PREFS local game = GAME game.purchaseInProgress = false print("IAB PURCHASE_COMPLETE. " .. e.productId .. ', '.. e.receiptId) local product = e.productId if product == 'remove_adverts' then prefs.noAds = true prefs:savePrefs() admob:hideAdd('banner') end end) iab:addEventListener(Event.PURCHASE_ERROR, function(e) local game = GAME game.purchaseInProgress = false print("IAB PURCHASE_ERROR. " .. e.error) end) iab:addEventListener(Event.RESTORE_COMPLETE, function(e) print('IAB_RESTORE_COMPLETE. ' .. e:getType()) end) --[[ RESTORING PURCHASES ]]-- -- we can either provide button to restore purchases or launch it on every app start -- this will simply launch purchase event for every unconsumable item iab:restore() end) iab:isAvailable() |
Comments
Has anyone else been able to restore previous purchases? And if so. how did you do that?
Likes: antix
I recommend rebooting your device frequently when installing loads of test APK files (both locally and from the play store).
Likes: snooks
Likes: antix
https://deluxepixel.com
Likes: totebo, SinisterSoft