Test User Account "Tap Review to sign in and complete information"

Ok so here we go. I really need help here. I have an awesome, amazing update for my app, and the only thing holding me back is the in-app purchase, it didnt have one before, now I am adding one. I sent 16 hours straight trying to get it to work and nothing. So, let me preface by saying I am using a Jailbroken iPhone 3g. I dont want it jailbroken but thats the way I got it, and I am just kind of scared to restore it to factory default. I am going to post the relevant code and then the problems:

local ui = require(“ui”)
local store = require(“store”)

local validProducts, invalidProducts = {}, {}
local listOfProducts =
{
“com.apphappystudios.glowtunes.soundpack1”,
}

restoreButton = ui.newButton
{
defaultSrc = “buttonRestore.png”,
defaultX = 80,
defaultY = 30,
overSrc = “buttonRestoreDown.png”,
onRelease = restoreSounds,
overX = 80,
overY = 30,
text = “”,
font = “Helvetica”,
textColor = { 255, 255, 255, 255 },
size = 16,
emboss = false
}
restoreButton.xOrigin = 330; restoreButton.yOrigin = 275

buyButton = ui.newButton
{
defaultSrc = “buttonBuy.png”,
defaultX = 80,
defaultY = 30,
overSrc = “buttonBuyDown.png”,
onRelease = buySounds,
overX = 80,
overY = 30,
text = “”,
font = “Helvetica”,
textColor = { 255, 255, 255, 255 },
size = 16,
emboss = false
}
buyButton.xOrigin = 240; buyButton.yOrigin = 275

function buySounds(event)
print(“working”)
local buyThis = function ( product )
if store.canMakePurchases then
store.purchase( {product} )
else
native.showAlert(“Store purchases are not available, please try again later”, { “OK” } )
end
end
– Enter your product id here
buyThis (“com.apphappystudios.glowtunes.soundpack1”)
end

function restoreSounds(event)

local restoreThis = function ( product )
if store.canMakePurchases then
store.restore( {product} )
else
native.showAlert(“Store purchases are not available, please try again later”, { “OK” } )
end
end
– Enter your product id here
restoreThis (“com.apphappystudios.glowtunes.soundpack1”)
end

function unpackValidProducts()
print (“Loading product list”)
if not validProducts then
native.showAlert( “In-App features not available”, “initStore() failed”, { “OK” } )
else
for i=1, #invalidProducts do
native.showAlert( “Item " … invalidProducts[i] … " is invalid.”,{ “OK” } )
end

end
end

function loadProductsCallback( event )
validProducts = event.products
invalidProducts = event.invalidProducts
unpackValidProducts ()

end

function savePurchase(extraSounds)
– Here is where I unlock the things purchased
end

function transactionCallback( event )
if event.transaction.state == “purchased” then
savePurchase(“com.apphappystudios.glowtunes.soundpack1”)
elseif event.transcation.state == “restored” then
savePurchase(“com.apphappystudios.glowtunes.soundpack1”)
elseif event.transaction.state == “cancelled” then
elseif event.transaction.state == “failed” then
infoString = "Transaction failed, type: ", event.transaction.errorType, event.transaction.errorString
local alert = native.showAlert("Failed ", infoString,{ “OK” })
else
infoString = “Unknown event”
local alert = native.showAlert("Unknown ", infoString,{ “OK” })
end
store.finishTransaction( event.transaction )
end

function setupMyStore (event)
store.loadProducts( listOfProducts, loadProductsCallback )
end

store.init ( transactionCallback )
print (“After init”)
I used the code from this thread:
http://developer.anscamobile.com/forum/2011/10/13/app-purchases-help-needed

Problem #1- When I press the buy button in the simulator, it prints “working” which suggests that the function is getting called. But when I press the buy button on device, nothing happens.

Problem #2- When I press the restore button on device, it prompts me for my username and password(which makes it wierd that the buy button doesn’t do that since it is pretty much the same code) When I enter my test user account name and password, it shows a popup:
“This Apple ID has not yet ben used before in the iTunes Store. Tap Review to sign in, then review your account information. [Cancel] [Rewiew]”
Which leads down a long road going nowhere. i am pretty sure that it shouldn’t appear.

Notes: - These are some common solutions/pitfalls I tried with no luck.

  1. I created a completely arbitrary test user using nonsense name, email, and password. (multiple time)
  2. I signed out of my iTunes account in my phone’s settings before launching the app
  3. I tried restarting my phone, no luck.
  4. I completely deleted the app from my phone before re-installing it, no luck.
  5. I added the in-app purchase to the application in iTunes connect, and submitted the new binary, then rejected the binary (as I have read you are suppose to do)

I am at my witt’s end here. Please someone help me. Any assistance will do. As of recent someone tried to create a copycat version of my app, and I got it pulled from the App Store. But this has me wanting to get the best version possible on the app store before more imitations pop up. This app had a coupe glaring issues I fixed with this update, and I added tons of cool stuff. I need to get this in-app purchase working. Post here, call me (305-484-8311), email me: chris.r.martone@gmail.com, I am desperate.

P.S. I am sorry I dont know how to add my code in that special way people do.

[import]uid: 46742 topic_id: 16405 reply_id: 316405[/import]

Also I am using build 578 [import]uid: 46742 topic_id: 16405 reply_id: 61248[/import]

Hey Chris, did you check this out: http://troybrant.net/blog/2010/01/invalid-product-ids/

You can’t use Jailbroken device to test this thing.

Aso, all you need to do is to add < lua > at the first line of code and end it with < /lua > to show the code on forum. (Remove spaces before and after “lua” and “/lua”). [import]uid: 67217 topic_id: 16405 reply_id: 61435[/import]

Thanks so much Naomi!!! I need to study for a test tonight but I will try the new code and use a different phone to test with! I really appreciate it! [import]uid: 46742 topic_id: 16405 reply_id: 61450[/import]

Hey Chris, actually, I’m not entirely sure if you need to redo your product list. I thought I could get past the loadProductsCallback only after I changed how I define the listOfProducts. However, it might just have been the timing issue (i.e., just needed the In-App Purchase product ID to propagate in iTune Connect sandbox.) I’ve edited the post above regarding the product list. Please keep me posted on your progress. I’ll do the same. Let’s hope we can do this right, and soon enough. [import]uid: 67217 topic_id: 16405 reply_id: 61452[/import]

Hey Chris, take a look at this post too:

http://developer.anscamobile.com/forum/2011/06/28/loadproducts-problem

To sum it up, here’s a possible cause of your problem:

[lua]-- In-App Purchase documentation says this is how it should be done
local listOfProducts =
{
“com.companyname.gamename.inapppurchase”,
}

– the following appears to work for some developers, but I’m not entirely convinced after all

local listOfProducts =
{
“inapppurchase”,
}[/lua] [import]uid: 67217 topic_id: 16405 reply_id: 61439[/import]

Hey Chris, a quick note to let you know that I got the valid product back from iTunes Connect.

So I believe you are okay with the listOfProducts the way you have it.

[lua]-- Keep this one. This one should be fine.
local listOfProducts =
{
“com.apphappystudios.glowtunes.soundpack1”,
}[/lua]

I have only one product available for sale through In-App Purchase, and I’ve confirmed I fetched the valid product using print statement in unpackValidProducts function:

[lua]function unpackValidProducts()
print (">>>>>>>>>>>>>>Loading product list")
if not validProducts then
print(“not validProducts”)
native.showAlert( “In-App features not available”, “initStore() failed”, { “OK” } )
else
print(“looping through the invalidProducts”)
for numLoop=1, #invalidProducts do
native.showAlert( “Item " … invalidProducts[numLoop] … " is invalid.”,{ “OK” } )
end
end
if validProducts then
print("validProducts = " … tostring(validProducts))
print("validProducts[1].title = " … tostring(validProducts[1].title))
print("validProducts[1].description = " … tostring(validProducts[1].description))
print("validProducts[1].price = " … tostring(validProducts[1].price))
print("validProducts[1].productIdentifier = " … tostring(validProducts[1].productIdentifier))
end
end[/lua] [import]uid: 67217 topic_id: 16405 reply_id: 61517[/import]

Awesome! Good for you! Hopefully I get to test it out tomorrow. I was wondering something, not sure if you would know though. Does an in-app purchase have to be on it’s own screen(like the listview style commonly seen)? Or can I have it anywhere, like say… in the options menu, the name of the product, price, a buy, and restore button?

Basically do you know of any guidelines or restrictions for the display of the in-app purchase?

Thanks again for all your assistance. It’s nice to find someone else who is working hard and willing to help! [import]uid: 46742 topic_id: 16405 reply_id: 61524[/import]

Hey Chris, I set up a front end for the store, and I completed the full cycle! YES!!!

So, one thing you might have a problem with is the store.purchase function. You can just leave it “product” in there. Instead, you need to point to the position of the table where the product reside. So, in my case, since I have only one product, this is all I had to do:

[lua]-- don’t do this:
store.purchase( {product} )

– instead, do something like this (if you have only 1 product to sell)
store.purchase( {validProducts[1]} )[/lua]

I haven’t looked at your code closely, but I think you can sail through the rest once you get to test on a device that returns valid products. [import]uid: 67217 topic_id: 16405 reply_id: 61526[/import]

Of course! I didn’t even think of that! Brilliant! I owe you one. Ill definitely have an update on my code by tomorrow night! [import]uid: 46742 topic_id: 16405 reply_id: 61529[/import]

Hey Chris, about what you wrote on post #7 above, I’m sure you can put it on any screen you want. Now that my In-App Purchase is working, I’m going to separate them into different modules to work better in my game.

Here are couple of posts I found that may be helpful to you:

http://developer.anscamobile.com/forum/2011/05/08/iap-demo-multi-tabs

http://developer.anscamobile.com/forum/2011/09/19/does-storeinit-need-global-callback-function-if-different-lua-files
[import]uid: 67217 topic_id: 16405 reply_id: 61592[/import]

Hey, Chris, did your in-app purchase go live? Is it going okay? Jeremy is haven’t some problem:

http://developer.anscamobile.com/forum/2011/10/17/invalid-app-id#comment-63044

My game app isn’t ready to go live, so I can’t share any experience, but if you can, I’m sure Jeremy would appreciate it.

Naomi [import]uid: 67217 topic_id: 16405 reply_id: 63053[/import]

Yeah mine is live! Just release last night. i was worried at first because the in-app purchase wasn’t working but I read it takes up to 24 hours for the in-app purchase to propagate through the system. Sure enough by this morning it was working perfect! Thanks so much naomi, and I would be happy to help Jeremy with any question he might have. Although you are the one who helped me get there so your the expert! =) [import]uid: 46742 topic_id: 16405 reply_id: 63377[/import]

Congrats, Chris! I’ll keep that 24-hour thingy in mind when I get to go live.

Cheers!
Naomi

P.S. Jeremy solved his problem pretty soon after he posted his grief. So, all’s well. [import]uid: 67217 topic_id: 16405 reply_id: 63380[/import]