In-app purchase - getting nowhere please help!

Ok - I have read almost every topic, tutorial and documentation I can find and I can’t see what I’m doing wrong :-/

I have:

  • Set up my app on ITC, submitted a binary and rejected it.
  • Set up my IAP on ITC, currently at ‘waiting for screenshot’ status
  • Built and installed to device using an adhoc provisioning profile

Here is my code. The loadProducts function doesn’t seem to be firing at all - I have debug text fields that aren’t getting up updated. How do I know if store.init() is being called or not?

I’m aware the IAP can take a while to filter through the system, but surely I should be getting some dialog boxes telling me I have invalid products?
[lua]store = require(“store”)

local listOfProducts = {
“KP0001”,
}

local price = {“£0.69”}
local desc = {“Test Description”}

local validProducts, invalidProducts = {}, {}

function unpackValidProducts()
myText[9].text = “Unpack fired”
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
price[1] = validProducts[1].price
desc[1] = validProducts[1].description

myText[5].text = price[1]
myText[6].text = desc[1]
myText[7].text = “Load products fired”

invalidProducts = event.invalidProducts
unpackValidProducts ()

end

function savePurchase(product)
–function on what should be save when user buy a product
end

function transactionCallback( event )
if event.transaction.state == “purchased” then
savePurchase(“product”) --you should enter here the product being purchased
elseif event.transcation.state == “restored” then
savePurchase(“product”) --you should enter here the product being purchased
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)
timer.performWithDelay (1000, setupMyStore)[/lua]
[import]uid: 93133 topic_id: 21375 reply_id: 321375[/import]

Just tried building the InAppDemo example…it just hangs on the title screen, building with both 591 and 732.

In the xCode console, it says ‘waiting for callback’.

[import]uid: 93133 topic_id: 21375 reply_id: 84639[/import]

Hey, @nick_sherman, I’m wondering if your listOfProducts matches with what you have created in iTunes Connect. Mine looks more like: “com.mycompany.mygamename.myproductforsale” (This may not be your problem at all, but I thought I’d mention.)

You might also want to add bunch of print statements. When I was debugging my IAP, I added print statements everywhere. Almost every line of code had print statement in front of it for me to see how far my code executes. In my case, my code simply didn’t execute far enough to even receive invalid product warning. It turned out that all I needed to do was to build the app using AdHoc certificate. All went smooth once I build my app with a valid AdHoc certificate.

If you have products properly made in iTunes Connect, building your app using AdHoc certificate and testing on a device (which is not a jail broken device), you should be able to see some lines of print statements (on Xcode console) to let you know which line of code is causing you grief.

I hope you’ll make a good progress soon. Gook luck!

Naomi

[import]uid: 67217 topic_id: 21375 reply_id: 84665[/import]

@nick_sherman: The InAppDemo works great for me and I’m also using build 732–did you try replacing the product IDs with yours? My suggestion is to use something like “com.companyname.itemname” like what Naomi suggested. [import]uid: 44127 topic_id: 21375 reply_id: 84707[/import]

thanks for the replies.

Today it has just started working - I am now stuck further down the line, the purchase won’t complete after the dialog box “You have already purchased this but it hasn’t been downloaded. Tap OK to download it now.”

Back to google! [import]uid: 93133 topic_id: 21375 reply_id: 84753[/import]

I suspect you have to submit your screen shots to get to the next step. They don’t have to be final. It’s just something for the iap reviewers to look at to make sure your serious about setting up iap.

NOTE: Pure speculation, I got to where you are and started building a demo screen for them to review then got pulled off on other projects.

[import]uid: 19626 topic_id: 21375 reply_id: 84758[/import]

My transactions won’t complete as well but I didn’t run into any of the problems you mentioned. I just added my in-app items on iTunes Connect and didn’t upload any screenshots or binary at all. They just appeared in my app. Not sure if its related but I’m only using “consumable” items.

I’m still figuring out why my transactionCallback isn’t working though. Having a hard time making it work when I have multiple LUA files. :S [import]uid: 44127 topic_id: 21375 reply_id: 84883[/import]

I have a question.

I see that you have your list of product ID’s do you have to hard code the ID’s in the app?

Is there not an API call that you can make to get a list of ID’s to purchase for your app?

I have an App that is about 90% complete and starting the process of adding the In-App Purchases.

But we have many many items that we will be adding and will not require a new build by the app.
So is there an apple / corona API call to get the list of IN-App items to build the listOfProducts table for me or do i need to add a call to my server to download this information?

-- Current example above ----  
local listOfProducts = {   
 "KP0001",  
}  
  
-- What I would to be able to do.  
local listOfProducts = GetMyInAppList(something goes here maybe)  

Thanks
Larry
www.doubleslashdesign.com
[import]uid: 11860 topic_id: 21375 reply_id: 114965[/import]