Code provided anyway;
The workflow is;
func_init -> func_checkCon -> func_login2 -> func_viewUser -> func_initStore -> func_loadProducts -> func_buyStore
debugText = display.newText(sceneGroup, "", width \* 0.01, height \* 0.01, system.nativeFont, 10) debugText.anchorX, debugText.anchorY = 0, 0 debugText:setFillColor(0.5,0.5,0.5) local gpgs = require( "plugin.gpgs" ) function gpgsListener(event) debugText.text = debugText.text .. "\nGPGS LISTENER;\n".."E.name:"..tostring(event.name).."\nE.isError:"..tostring(event.isError).."\nE.errorMessage:"..tostring(event.errorMessage).."\nE.errorCode:"..tostring(event.errorCode) end function getaccListener(event) debugText.text = debugText.text .. "\nACC LISTENER;\n".."E.name:"..tostring(event.name).."\nE.isError:"..tostring(event.isError).."\nE.errorMessage:"..tostring(event.errorMessage).."\nE.errorCode:"..tostring(event.errorCode).."\nE.accountName"..tostring(event.accountName) end function func\_init(event) if event.phase == "ended" then debugText.text = debugText.text .. "\nAttempting to INIT" gpgs.init( gpgsListener ) end end function func\_checkCon(event) if event.phase == "ended" then connectedToGPGS = gpgs.isConnected() debugText.text = debugText.text .. "\nConnection Status:"..tostring(connectedToGPGS) end end -- function func\_login(event) -- if event.phase == "ended" then -- debugText.text = debugText.text .. "\nLogin with NO params" -- gpgs.login() -- end -- end function func\_login2(event) if event.phase == "ended" then debugText.text = debugText.text .. "\nLogin WITH params" params = { userInitiated = true, listener = gpgsListener, } gpgs.login( params ) end end function func\_logout(event) if event.phase == "ended" then debugText.text = debugText.text .. "\nLogging Out" gpgs.logout() end end function func\_viewUser(event) if event.phase == "ended" then debugText.text = debugText.text .. "\nGetting Acc Name" gpgs.getAccountName( getaccListener ) end end function func\_clear(event) if event.phase == "ended" then debugText.text = "" end end initText = display.newText(sceneGroup, "Init", width \* 0.7, height \* 0.05, system.nativeFont, 18) initText:addEventListener("touch", func\_init) isConnectedText = display.newText(sceneGroup, "Check Con", width \* 0.75, height \* 0.125, system.nativeFont, 18) isConnectedText:addEventListener("touch", func\_checkCon) -- loginText = display.newText(sceneGroup, "Log in no param", width \* 0.8, height \* 0.2, system.nativeFont, 18) -- loginText:addEventListener("touch", func\_login) login2Text = display.newText(sceneGroup, "Log in", width \* 0.8, height \* 0.05, system.nativeFont, 18) login2Text:addEventListener("touch", func\_login2) logoutText = display.newText(sceneGroup, "Log out", width \* 0.75, height \* 0.2, system.nativeFont, 18) logoutText:addEventListener("touch", func\_logout) getAccText = display.newText(sceneGroup, "Get Acc", width \* 0.75, height \* 0.275, system.nativeFont, 18) getAccText:addEventListener("touch", func\_viewUser) clearLogText = display.newText(sceneGroup, "Clear", width \* 0.25, height \* 0.3, system.nativeFont, 18) clearLogText:addEventListener("touch", func\_clear) -- ///////////////////////////////IAP\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ local store = require( "plugin.google.iap.v3" ) local json = require( "json" ) -- Transaction listener function function transactionListener( event ) -- newText.text = "" if not ( event.transaction.state == "failed" ) then -- Successful transaction print( json.prettify( event ) ) print( "event.transaction: " .. json.prettify( event.transaction ) ) debugText.text = debugText.text.."\nJSON:"..tostring(json.prettify(event.transaction)) else -- Unsuccessful transaction; output error details print( event.transaction.errorType ) print( event.transaction.errorString ) debugText.text = debugText.text.."\nError Type:"..tostring(event.transaction.errorType).."\nErrorString:"..tostring(event.transaction.errorString) end end function func\_initStore(event) if event.phase == "ended" then store.init( transactionListener ) debugText.text = debugText.text.."\nStore Active:"..(tostring(store.isActive)) debugText.text = debugText.text.."\nCan Load:"..(tostring(store.canLoadProducts)) end end function func\_loadProducts(event) if event.phase == "ended" then debugText.text = debugText.text.."\nLoading Products" productIdentifiers = {} table.insert(productIdentifiers, "nerdy\_pack") table.insert(productIdentifiers, "hen\_do\_pack") table.insert(productIdentifiers, "stag\_do\_pack") store.loadProducts( productIdentifiers, func\_loadProducts ) end end function func\_buyStore(event) if event.phase == "ended" then debugText.text = debugText.text.."\nPurchasing Hen Do Pack" -- store.purchase( productIdentifiers[i] ) store.purchase( "hen\_do\_pack" ) end end -- Initialize Google IAP storeInitText = display.newText(sceneGroup, "Init Store", width \* 0.2, height \* 0.05, system.nativeFont, 18) storeInitText:addEventListener("touch", func\_initStore) storeLoadProductsText = display.newText(sceneGroup, "Load Product", width \* 0.2, height \* 0.125, system.nativeFont, 18) storeLoadProductsText:addEventListener("touch", func\_loadProducts) storeBuyText = display.newText(sceneGroup, "Buy", width \* 0.2, height \* 0.2, system.nativeFont, 18) storeBuyText:addEventListener("touch", func\_buyStore)