Hi there. I’m here, asking for help for the implementation of in app purchase. When i push the purchase button (when i active store.purchase). It asks me an account. Then it says that it’s a test account and the following error comes up: “Cannot connect to Itunes Store”.
Reading online on the forum and googling a bit, it seems like i have to initialize the device on which i’m testing. Is it like that?
I’ve alse tried the (CFBundleVersion), just as said in Apple official documents (here the link https://developer.apple.com/library/ios/technotes/tn2413/_index.html ). On the forum someone told me to not do that. Even though i tried that too, but, of course, it didn’t work.
I have also thought that the error may be coused by a wrong Id Product input. Which one have i to choose?
Case 1:
Case 2:
also, is this the ID product?
anyway, i tried’em both, but, of course, nothing seems to work. So, why is this happening? How could i solve that? Has someone went trought the same error? I leave you the code i’m using to implement the in-app buy. I’m using Corona SDK 2794 version. Tested on iPad 3 with iOS 9.2 and my system is OSX Yosemite 10.10.5. Thank you for the help and sorry for my english.
function transactionCallback( event ) local transaction = event.transaction if ( transaction.state == "purchased" ) then local Ricevuta = display.newText("COMPRATO!!!", display.contentCenterX, Testo.y + 50, native.newFont, 16) elseif ( transaction.state == "restored" ) then local Ricevuta = display.newText("RESTAURATO", display.contentCenterX, Testo.y + 50, native.newFont, 16) elseif ( transaction.state == "refunded" ) then -- VALIDO SOLO PER GOOGLE local Ricevuta = display.newText("RIMBORSATO", display.contentCenterX, Testo.y + 50, native.newFont, 16) elseif ( transaction.state == "cancelled" ) then local Ricevuta = display.newText("CANCELLATO", display.contentCenterX, Testo.y + 50, native.newFont, 16) elseif ( transaction.state == "failed" ) then local Ricevuta = display.newText("FALLITO", display.contentCenterX, Testo.y + 50, native.newFont, 16) local Ricevuta02 = display.newText(transaction.errorType, display.contentCenterX, Testo.y + 100, native.newFont, 16) local Ricevuta03 = display.newText(transaction.errorString, display.contentCenterX, Testo.y + 150, native.newFont, 16) else local Ricevuta = display.newText("BOH", display.contentCenterX, Testo.y + 50, native.newFont, 16) end -- CONCLUDO LA TRANSIZIONE, CODICE DA INSERIRE SEMPRE store.finishTransaction( transaction ) end -- INIZIALIZZAZIONE DELLO STORE E INDICAZIONE DEI PRODOTTI ----------------------------------------------------------------------------------------------------- local store local ListaProdotti = nil ProdottiApple = { "Progetto\_upgrade" } ProdottiGoogle = { "Progetto\_upgrade" } if ( system.getInfo( "platformName" ) == "Android" ) then store = require( "plugin.google.iap.v3" ) ListaProdotti = ProdottiGoogle store.init( "google", transactionCallback) elseif ( system.getInfo( "platformName" ) == "iPhone OS" ) then store = require( "store" ) ListaProdotti = ProdottiApple store.init( "apple", transactionCallback ) else native.showAlert( "Notice", "In-app purchases are not supported in the Corona Simulator.", { "OK" } ) end ----------------------------------------------------------------------------------------------------- function AvvioAcquisto() store.purchase( ListaProdotti ) -- Avvio l'acquisto end Testo = display.newText("COMPRA", display.contentCenterX, display.contentCenterY, native.newFont, 16) Testo:addEventListener( "tap", AvvioAcquisto )