IAP Cannot Connect to iTunes

I have recently implemented IAP, but for some reason the transaction keeps failing, and I keep getting the error “Cannot Connect to iTunes”. Is there something wrong wit my code?
PS: my IAP product id is “ChowDownDeleteAds”
[lua]–Initialize in app purchases
local function popUpDismiss (event)
if “clicked” == event.action then
local i = event.index
if 1 == i then
end
end
end

store = require(“store”)
function transactionCallback( event )
local transaction = event.transaction
if transaction.state == “purchased” then
saveFile(“adsHidden.txt”, 0)
print(“Transaction succuessful!”)
local alert = native.showAlert( “Purchase Completed!”, “All ads were hidden!”, { “OK”}, popUpDismiss )
elseif transaction.state == “restored” then
print(“Transaction restored (from previous session)”)
print(“productIdentifier”, transaction.productIdentifier)
print(“receipt”, transaction.receipt)
print(“transactionIdentifier”, transaction.identifier)
print(“date”, transaction.date)
print(“originalReceipt”, transaction.originalReceipt)
print(“originalTransactionIdentifier”, transaction.originalIdentifier)
print(“originalDate”, transaction.originalDate)

elseif transaction.state == “cancelled” then
local alert = native.showAlert( “Purchase Cancelled!”, “Purchase was cancelled by the user.”, { “OK”}, popUpDismiss )

elseif transaction.state == “failed” then
local alert = native.showAlert(“Purchase Failed!” , transaction.errorType… ": " …transaction.errorString, { “OK”}, popUpDismiss )
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

store.init( transactionCallback )
local hideAdsTitle
local hideAdsPrice
local function loadHideAdsInfo( event )
local hideAds = event.products
hideAdsTitle = hideAds.title
hideAdsPrice = hideAds.price

end
print(hideAdsTitle)
local hideAdsID =
{
“ChowDownDeleteAds”
}
store.loadProducts(hideAdsID,loadHideAdsInfo)

local function popUpResponse(event)
if “clicked” == event.action then
local i = event.index
if 1 == i then

elseif 2 == i then
store.purchase( hideAdsID )
end
end
end
print(adsHidden)
if adsHidden == “0” then
local hideAdsBtn = display.newImage(“troll.jpg”, true)
localGroup:insert(hideAdsBtn)
local function touchHideAdsBtn (event)
if adsHidden == “0” then
if event.phase == “began” then
local alert = native.showAlert( “Hide Ads”, “Would you like to hid all ads for only $0.99?”, { “Cancel”, “OK” }, popUpResponse )
end
end
end
hideAdsBtn:addEventListener (“touch”, touchHideAdsBtn)
end[/lua] [import]uid: 130035 topic_id: 23489 reply_id: 323489[/import]

I did not look at your code, but did you take a look at these forum posts?

http://developer.anscamobile.com/forum/2011/11/22/im-completely-failing-iap

http://developer.anscamobile.com/forum/2012/01/13/iap-cannot-connect-itunes-store [import]uid: 94868 topic_id: 23489 reply_id: 94274[/import]

Well I found one thing that helped me. I deleted the app and reinstalled it. Now Im getting the error “invalidPayment: Cannot con net to iTunes Store” [import]uid: 130035 topic_id: 23489 reply_id: 94285[/import]

I am by no means certain on this but saw your tweet and thought I’d comment with my (very limited) knowledge on IAP.

What is your app’s status in iTC? I believe this can make a huge difference.

By status, I mean - waiting for upload, waiting for review, binary rejected by developer, etc. [import]uid: 52491 topic_id: 23489 reply_id: 94419[/import]

Waiting for upload [import]uid: 130035 topic_id: 23489 reply_id: 94480[/import]

I believe if you review the other posts on this same subject they suggest you may need the app to be waiting for review. (Even if you reject it after that.)

Please try a forum search for this info :slight_smile: [import]uid: 52491 topic_id: 23489 reply_id: 94680[/import]

I think I figured out what the problem is:

I signed the paid apps contract, but have not submitted the billing/ tax info.

Could that be it? [import]uid: 130035 topic_id: 23489 reply_id: 94689[/import]

Uhm, I’m not sure - I’ve only seen users post about what I mentioned above. I assume you have read those threads too and tried what is suggested? [import]uid: 52491 topic_id: 23489 reply_id: 94728[/import]

Turns out I was correct. After I uploaded all the tax and bank info for paid apps the IAP started working.

Now I am facing another problem. Apple rejected my IAP for some reason. I am assuming that it is okay to make an IAP that removes ads. So why might be the problem? [import]uid: 130035 topic_id: 23489 reply_id: 96227[/import]

That’s interesting, good to know :slight_smile:

RE ads, did they provide you with a reason? I have heard one or two people say they were rejected for this reason however I’ve seen a number approved as well. (You’ll read mixed things if you Google this, too.)

One of those most common reasons for rejection is not providing a good description of what the IAP is for, or using the wrong kind of IAP. (Consumable, sub, etc.) [import]uid: 52491 topic_id: 23489 reply_id: 96244[/import]

They did not provide me with a reason ( or at least I didn’t see anything). My description is something like " removes all ads from the app". And my type is non-consumable.

Should I lOok for the reason somewhere? [import]uid: 130035 topic_id: 23489 reply_id: 96247[/import]

I haven’t had any problems with Apple regarding approvals of my IAP products.
It’s a bit weird that they didn’t give you a reason for rejection though…

A couple of thoughts:

Did you submit the IAP for approval *before* you had submitted your tax/bank info? Maybe that could have been a factor.

Your IAP Product ID is very short. I would recommend that the ID should follow the format: com.company.appname.productname

When you submit an IAP for review, a screenshot is required of the IAP in action.
What I do is provide a screenshot of the app’s IAP screen. This screen has a short description of what the user is buying together with a purchase button with localized price info, and a cancel button.

A quick note if you’re planning on using Google IAP in the future:
Google doesn’t allow capital letters in the product ID, so I’d recommend only using lower case letters. This way you can use the same product ID for both Apple and Google. [import]uid: 70847 topic_id: 23489 reply_id: 96274[/import]