Alright so using @Rob Miracle nice tutorial here:
https://coronalabs.com/blog/2013/09/03/tutorial-understanding-in-app-purchases/
I understand most of the code and what’s it doing- but some reason I can’t get this to remove ads. I know I’m missing something obvious as I’m new. What do I need to change to make a purchase that removes ads.
I made the iAP in iTunes… and everything in iTunes is setup right, this is my fourth app.
The question is in the code, I’ve changed this part:
local function removeAds( event ) if event.phase == "began" then event.target:setFillColor(224) elseif event.phase == "ended" then event.target:setFillColor(255) if system.getInfo("targetAppStore") == "amazon" or system.getInfo("targetAppStore") == "google" then store.purchase( "com.acme.superrunner.upgrade" ) else store.purchase( { "com.acme.superrunner.upgrade" } ) end end return true end
To resemble my ‘removeAds’ in-app product ID for my game:
local function removeAds( event ) if event.phase == "ended" then if system.getInfo("targetAppStore") == "amazon" or system.getInfo("targetAppStore") == "google" then store.purchase( "com.my.address.myiap" ) else store.purchase( { "com.my.address.myiap" } ) end end return true end
local noAds = display.newImageRect("noAds.png", 125, 125)noAds.x, noAds.y = display.contentWidth/2 + noAds.width\*1.25, display.contentHeight - 81 noAds:addEventListener( "touch", removeAds )
Everything else in the other bits of example code above that is the same as example - actually I think there’s one more place to put just my Product ID (without the iAP id) …
Then where I normally call the interstitial advertisements, I have a small chunk of code that goes:
if randomBanner \<= 25 and (mySettings.isPaid == false or mySettings.isPaid == nil) then ads.show( "interstitial" ) end
What am I missing? :ph34r: Nothing comes up when I press my button, nothing about iAP and the interstitials keep showing. It does recognize I’ve touched button as I’ve used Print commands to confirm.