Hey guys,
Having trouble getting In App Purchases working before launch, and they are the entirety of our monetizaton. I have it al good up to the transaction callback, but then the transaction fails. transaction.errorType returns "invalidPayment" and transaction.errorString returns 'Cannot connect to iTunes Store.'
I am not signed into an account. My understanding is that I'm supposed to be signed out and wait until I attempt a purchase, get a pop up, and then sign in to the Test User account I set up for the game. I can use the app store itself, and when I tried to download some random app I GOT the "You need to sign in" pop up. So what's the game's problem?
Here is the file I'm using for in app purchases:
-------------------------------------------------------------------------------
-- Sun Stones in App purchase store
-- by Rodger L. Gamblin
-- mostly example and placeholder code at the moment
-------------------------------------------------------------------------------
store = require "store"
function transactionCallback( event )
local transaction = event.transaction
if transaction.state == "purchased" then
storeText = "Bought!"
elseif transaction.state == "restored" then
storeText = "Restored!"
elseif transaction.state == "cancelled" then
storeText = "Stopped!"
elseif transaction.state == "failed" then
storeText = transaction.errorType
rodgerText = transaction.errorString
else
end
-- Once we are done with a transaction, call this to tell the store
-- we are done with the transaction.
-- If you are providing downloadable content, wait to call this until
-- after the download completes.
store.finishTransaction( transaction )
end
function loadProductsCallback( event )
print("showing products", #event.products)
for i=1, #event.products do
local currentItem = event.products[i]
print(currentItem.title)
print(currentItem.description)
print(currentItem.price)
print(currentItem.productIdentifier)
end
print("showing invalidProducts", #event.invalidProducts)
for i=1, #event.invalidProducts do
print(event.invalidProducts[i])
end
end
function storeSetup(listOfProducts)
local productIDs = {}
for i=1, #listOfProducts do
productIDs[i] = listOfProducts[i].productIdentifier
end
store.loadProducts(productIDs, loadProductsCallback)
end
function productsCheckout(targetItem)
local itemTable = {}
itemTable[1] = targetItem.productIdentifier
if store.canMakePurchases then
store.purchase(itemTable)
else
print "Purchases disabled! Enable in your iOS settings."
end
end
function appStoreInit()
store.init (transactionCallback )
end
What is going wrong?
Thanks,
Rodger L. Gambin,
Intern, Sunstone Games