thanks for reading.
I was success with IAP before, but now, when come back on 2nd project about IAP, I always get popular "Invalid Product ID" result.
Here is what I've done:
1) Create App ID: com.tim.TestIAP
2) Create Provisioning profile, with In-App Purchase (already checked) and install this into Xcode
3) Go to iTunes connect and add app with bundleID = com.tim.TestIAP
4) Add In-App Purchase products:
a) com.tim.TestIAP.C1
b) com.tim.TestIAP.C2
c) com.tim.TestIAP.NC
5) Open XCode and create new project with ID = com.tim.TestIAP
6) Set code signing = com.tim.TestIAP provisioning profile
7) Write code handle Storekit
productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:#"com.tim.TestIAP.C1"]];
productsRequest.delegate = self;
[productsRequest start];
8) Archive project and submit to iTunes connect.
9) Wait (over 48 hour til now)
10) Now I get:
a) iTunesconnect: App status = Waiting for review, IAP status = In review
b) App installed on device via XCode (I signed out iTunes account on device)
But everytime I tried to send product request, with correct Product ID, I still get this product in
SKProductsResponse.invalidProductIdentifiers
Please tell me where I was wrong, thankyou very much
Did you try remove app from device, clean your xcode and reinstall your app again?
Its so classic answer i know but it worked for me before and you be sure if your purchase is for free or not, free purchases absolutely dont work.
Your purchase should be in ready to submit or waiting for screenshot mode if you using it with test account. Also be sure about if your test account is working (if you tried sign with it before in iphone or in site, this account will be invalid.)
Hope it can help.
One more possibility: does the bundle ID match? I have a set up where I append "Beta" automatically to the bundle ID of my debug builds, and forgot about that during testing.
I tried everything everyone is talking about. I ended up making a guest account first to see if the product ID could be found.... It was. So then I started quitting everything in activity monitor and found the problem. I had to quit the "store" processes below. All of a sudden I stopped getting the invalid product ID. Hope that helps someone out there.
Quit these and then build and run if you're getting the invalid product id null error
Are you using iTunes Connect test accounts to purchase the IAPs?
You can't use real Apple id until your application + in-app purchases are approved, until then you can create test accounts from iTunes connect -> Manage Users -> Test User and use those credentials to purchase your testing IAPs
Did you complete the paid apps agreement in 'Agreements, Tax and Banking' in iTunes connect? I have missed that and spend days on technical analysis. After completion it worked in minutes.
Screenshot of completed paid apps agreement.
Related
I’m new for IAP feature in iOS. I sent my couple of day to test IAP for learning purpose bur did not get success.
Something I’m missing to implement or whatever I don’t know exactly thats why I’m asking here. Basically I wrote code from this tutorial and my system is iOS 9/10 and Xcode 7/8 actually I tried with both.
I did all the step correctly Make “Test User”, Remove iTunes account from the device etc and also test cases from this web link but still facing “In Valid Product ID” don’t know why? but did not get list of product(s) from iTunes.
Just clear me for below point
1) Do I need upload app on AppStore (temporary then reject it) for first time test IAP in sandbox environment or no need to do?
2) Do I need to add ”Contracts, Tax, and Banking Information" in iTunes for sandbox environment or no need to do? (Right now added in my iTunes Account)
I added product on iTunes with and without screenshot uploaded but each time when I upload screenshot with product in iTunes then status was “Ready to Submit” and and without screenshot status was “Missing Metadata”
Is it correct status? and can we test IAP purchase with this status in Sandbox Environment?
1) No. There is no need to upload an App and reject it in order to test In-App purchases. You only need to create a sandbox account.
2)Yes, add the required information.
Make sure you have properly submitted each In-App purchase AND added them to the app - both steps required.
Trying to figure this out and following Apple's docs. Here is what I have done, hopefully someone can help point out where I screwed up. My app, we'll call it MyApp, is at v1.1 and for sale in the app store. I have created an In-App non-consumable purchase for 99 cents, tier 1 with a product ID we will call AdFree. Simple option to remove ads from the app.
Product ID: "AdFree"
App Bundle ID: "com.name.MyApp"
I have setup my bank/tax info for iOS Paid Applications.
I created a provisioning profile to test this, with the explicit App ID: com.name.MyApp.AdFree - if the Product ID is "AdFree", should my explicit App ID be "com.name.MyApp.AdFree" or just "com.name.AdFree"?
I configured code signing in my project (Xcode) to use the new provisioning profile i created and downloaded.
On my phone, I am signed out from the iTunes Store. I run my app and try to purchase AdFree, but I keep getting back "AdFree" as an invalid product identifier.
Hoping someone here can point out something I missed or tip me off to some other related problem.
Code wise, I have a static NSString *productID = #"AdFree"; setup and I do the following when in the option to purchase Ad Free:
NSSet *productSet = [NSSet setWithObjects:productID, nil];
SKProductsRequest *request = [[SKProductsRequest alloc]
initWithProductIdentifiers:productSet];
request.delegate = self;
[request start];
This project is targeting iOS 7.
Thanks for your time...
Well, after being frustrated and side tracked, I finally got to work on this again. I was following old suggestions and found nothing recent that helped...until last Friday. My problem was where iTunes Connect stated:
This In-App Purchase is not currently available for testing in the sandbox environment because you have chosen to host your content with Apple, but have not delivered your content. Upload your content to test this In-App Purchase in sandbox.
So my product requests came back invalid. I read everything about having to upload an app binary and then rejecting it (don't do that), adding an IAP purchase screenshot (don't do that), using the app id in front of the IAP id or just the name of the IAP purchase and not the full bundle-like id in your product requests (don't do that).
This post finally solved my problem. It just linked to this guide for uploading IAP purchase content from XCode and Application Loader. Once I uploaded the IAP content I built in XCode, my IAP status went to "processing content." A lot of posts say wait anywhere from a couple of hours to a day. It took 3 days but my IAP finally moved to "waiting for screenshot" and my sandbox build now works great.
Part of my problem was trying to follow Apple's documentation. Nearly every post linked to the Technical Note TN2259, which should be good. However, that doc complete skips over the part about starting a new project in XCode to build your IAP purchase content and uploading with Application Loader when you use Apple to host your IAP.
I am having problems testing my in-app purchases. I get back valid product identifiers, but upon purchase I receive the dreaded "Cannot connect to iTunes Store". Interesting thing is that restore purchases seems to work - iTunes login pops up.
I have:
- Checked that my in-app purchases are cleared for sale
- Checked, rechecked my source code to be in sync with Apple's documentation
- Added appropiate test users
- app id does not contain wildcard
- in-app purchases are linked to the app (app itself is in developer rejected state, purchases are in ready to submit)
- waited
- reinstalled app, cleaned solution, all the voodoo stuff
Make sure you have signed out of any production iTunes accounts on the device.
I was getting this error on my test phone which was logged in with my actual iTunes account. You cannot test apps using your production iTunes account, hence the error. I just wish Apple provided a better error so as to avoid this guesswork...
see In-App Purchase FAQ: Cannot connect to iTunes Store
Your app is running in the Simulator, which does not support In-App Purchase
For testing in app purchases always use real devices.
For newcomers, make sure your in-app purchasing product's status is Ready to Submit, with no "missing metadata". In my case, what was missing was the localization of the subscription's group.
I've been having this problem and I'm convinced its a bug. I've filed a bug report with Bug Id 10108270
The problem seems to be that the test user is getting 'locked' and may have something to do with attempting to purchase an in app purchase in an already released app with that account.
My workaround was to create a new test user but until Apple get back to me, I can't provide any better solutions. I'll update this answer when I get replies.
This problem remains persistent in 2016. Incredible. Here was my solution:
Add a build number. Target > General > Identities > Build.
This is an old thread that is related to problem I was facing today.
In my case, I was able to test in-app purchases on my device till yesterday but it stopped working today. It turned out that Apple had pushed an 'Amendment for Paid Applications' for me to review and agree to. Once I agreed to the amendment (without reading it, of course), everything started working again. Did not have to create a new test user or any other workaround.
There may be many reasons for in-app purchases to not work but make sure you are correctly set up on itunesconnect or you won't be able to test in-app purchases.
I'm hitting the same issue. For me it happens after this secuence:
Install app on a device logged into a UK account on iTunes
Launch the app and use a test user set in USA
Message is shown saying account is only valid in USA. Closes the app and auto launches iTunes
Open your app again and retry purchase. Receive products but no other callback or error.
I don't know whether this is an issue on the IAP platform but I would like to get an error/callback to handle it in some way in my code.
To carry on testing your IAPs try any of these:
Remove Provisioning Profile in Settings area, remove App and log out from Store in Settings. Then go to XCode and change the signing identities to "Do Not Sign" to then put them back (I know how it sounds :) but try) OR
Hard reset all Settings on your device (Settings -> General...). Obviously you will loose any settings on that device...
Kill iTunes app on the device (multitask menu) and log out from the Store on the Settings
If none of the above work, it might be an issue on IAP platform, see my comments below.
Make sure the system status is ready https://www.apple.com/support/systemstatus/
I have an Iphone, Restart it worked for me
Here the exhaustive checklist if you got this error "cannot connect to iTunes Store" :
Make sure you have a sandbox user created in App Store Connect
Simulator DOES NOT support In-app purchase : test on real-device
The sandbox may be unreachable. Check the Apple System Status
Check that your app does have a bundle version (CFBundleVersion)
Check that the product is available for sale. Did you create it in App Store Connect?
If previous iOS 12, signed out of any production iTunes accounts on the device. Otherwise, you can just sign in within the dev app with your sandbox account.
You may also be getting this error when reusing an old sandbox account you tested a previous IAP on another app with (My scenario). Apple really needs to update the way we test IAPs, I'm running out of emails :0
I was able to purchase in-app on iPhone but not on iPad(11.0.2). I tried with all mentioned solution but none helps. After trying all other possibilities, finally I was able to make it work.
When you create a test account in iTunes connect, don't verify the email id. If it is verified, iap returns "Cannot connect to iTunes" error. It looks strange but it is how worked for me. In iPhone, irrespective of email verification, I am able to purchase using test account.
This error also had occurred when to SKProductsRequest passed wrong NSSet:
Wrong:
let products = NSSet(objects: ["id1", "id2"])
Correct:
let products = NSSet(objects: "id1", "id2")
In my case, I just forgot to handle .failed in transactionState. In particular, SKPaymentQueueue.default().finishTransaction(transaction).
The same issue got for me, and I had checked on the issue including Apple form, I couldn't find a solution.
Today when I checking the device I found that the following
In Device Settings -> iTunes & App Store found another Apple Id logged In.
So I tried signOut that and checked again the InApp purchase, it worked perfectly. So please check the issue is linked to the same or not.
Thanks & Regards,
Unnikrishnan.P
In addition to all the other methods outlined here, if you are working with subscriptions it seems you need to make sure you've generated a shared secret:
"To test or offer auto-renewable subscriptions, you must have a master shared secret or use an app-specific shared secret for each app."
A master shared secret is generated from the 'Shared Secret' tab of the 'Users and Access' section of App Store Connect.
An app-specific shared secret is generated where you manage the in-app purchases of the app itself.
I fixed mine! If you are getting Error Domain=SKErrorDomain Code=2 "Cannot connect to iTunes Store" error, make sure you insert SKPaymentQueue.default().finishTransaction(transaction). It worked for me after I added SKPaymentQueue.default().finishTransaction(trans) in the following:
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
for trans in transactions{
if trans.transactionState == .purchased {
print("Successful.")
SKPaymentQueue.default().finishTransaction(trans)
} else if trans.transactionState == .failed {
print("failed!")
print(trans.error)
SKPaymentQueue.default().finishTransaction(trans)
}
}
Found in Apple developer website, here
I had to go to Settings > iTunes & App Stores, then scroll to the bottom to the "Sandbox Account" field and Sign out from there. Now it is working!!!
I know that there are many related questions and I've read them all but still didn't find answer, so please read my question.
Problem:
I Try to get product id with SKProductRequest, but only invalid id returns.
Try to make purchase - unable to connect to iTunes error.
In App Purchase enabled at Provisioning Portal
IAP products are added to the application in iTunes Connect with Cleared for Sale checked (status is Ready to Submit)
Bundle ID from iTunes Connect and *.plist are the same
Target iOs is 3.0 and above
Use full product id (..*.ProductID) when doing SKProductRequest.
Tried reinstall app, iTunes etc.
Log out from Store in Settings
Also, I use Phonegap and InAppPurchaseManager plugin but I believe problem is somewhere in store settings and not in Phonegap.
Any thoughts what I have missed?
The final thing I was thought about is approving 'iOS Paid Applications' contract. They finally approved it but IAP still doesn't work.
Please help! Can't be there are no solutions.
I found an answer! In ALL guides I have only seen the wording 'Use full product id (AppID.ProductID) when doing request', but actually you should specify ProductID in this form at the iTunes Connect! So, my ProductID is 'com.test1.testProduct1' and I send exactly the same ID in all requests. The problem is solved!
I've been working on adding in-app purchases and was able to create and test in-app purchases using Store Kit (yay!). During testing, I exercised my app in a way which caused the app to crash mid purchase (so I guess the normal cycle of receiving paymentQueue:updatedTransactions and calling finishTransaction was interrupted).
Now I am unable to successfully complete any transactions and instead am getting only transactions with transactionState SKPaymentTransactionStateFailed when paymentQueue:updatedTransactions is called.
The transaction.error.code is -1003 and the transaction.error.localizedDescription is "Cannot connect to iTunes Store"!
I have tried removing all products from iTunesConnect, and rebuilt them using different identifiers but that did not help. I have also tried using the App Store app to really connect to the real App Store and download some apps so I do have connectivity. Finally, I have visited the Settings:Store app to make sure I am signed out of my normal app store account.
I had a similar situation and dumped the iPhone's network traffic to see what's going on. I found that the normal store was contacted instead of the sandbox. It helped to delete the app from the device, make clean and build/install it again. Apparently something with the development profile had gone wrong.
Update: To dump the network traffic of a non-jailbroken iPhone, just use Internet Sharing on your Mac and configure your iPhone to use your Mac's WiFi. Then tcpdump -n -i en1on your Mac will do the trick.
If you're getting error 0 "Cannot connect to iTunes Store" (which I realize is not the error -1003 that OP asked about, but a web search for error 0 also leads here), this can be caused by two possible problems:
You're passing in the wrong product identifier. If that's the case, then you'll get error 0 shortly after calling -[SKPaymentQueue addPayment:], before you get the popup asking you to confirm payment.
Your test user has become invalidated. This can happen if you accidentally log into the App Store with your test user. When this happens, you'll get error 0 after entering your password to confirm your payment.
To fix problem #1, pass in the correct product ID. To fix problem #2, create a new test user on iTunes Connect, and optionally delete the old test user.
I had a similar issue, was getting "Cannot connect to iTunes Store" with Code=0. This is how I solved it, after trying every other ritualistic piece of advice found on the Internet from re-downloading my certificates to resetting all my device settings to sacrificing a virgin black goat:
In the target summary for the app, I used to have my version number in the "build" field, but nothing in "version" field. This seemed odd to me, so I moved the version number from "build" to "version". This resulted in the aforementioned error. Moving the version number back to "build" solved the error.
Add new test user for your app.
Make sure you have correct date and time set in the Settings. otherwise it fails to make a SSL conenction to the store!!
I had the same error, and after reading through some threads on the developer forums, I reset the settings on my device (Settings->General->Reset->Reset All Settings), which cleared it up. It seemed drastic, but it worked.
I had the same error that seemed to pop up out of nowhere (was working fine one day, but then the next day it was giving me these errors about 2 out of every 3 times I tried testing my in-app purchase).
Then I visited the App Store (when trying to make another real purchase), and realized that they had a new user agreement that they wanted me to verify. After I did that, when I went back to my own app and tried out the test purchase again, it was working fine and have had no errors since. So I suspect I was getting the error because they wanted me to verify the new user agreement.
Now the only thing I wonder is if there is a way for my in-app purchase to forward that prompt to my users instead of giving them a mysterious error?
What worked for me was to uninstall my app from the test device, then install a fresh copy from Xcode.
In SKPaymentTransactionState tells that SKPaymentTransactionStateFailed before your request is added to server queue.
#class SKPayment;
enum {
SKPaymentTransactionStatePurchasing, // Transaction is being added to the server queue.
SKPaymentTransactionStatePurchased, // Transaction is in queue, user has been charged. Client should complete the transaction.
SKPaymentTransactionStateFailed, // Transaction was cancelled or failed before being added to the server queue.
SKPaymentTransactionStateRestored // Transaction was restored from user's purchase history. Client should complete the transaction.
};
typedef NSInteger SKPaymentTransactionState;
And on SKPaymentTransaction Class Reference Error Discussion says:
The error property is undefined except when transactionState is set to SKPaymentTransactionStateFailed. Your application can read the error property to determine why the transaction failed.
So, transaction.error.localizedDescription is "Cannot connect to iTunes Store"! is a general error message.. I am also getting this error message regularly while testing my InApp Purchases.
Some tips u can do is,
Retrieve all products from app store using SKProductsRequest and check its response.products contain your requested productIdentifier.
for this use,
SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithArray:[objProducts allKeys]]];
//pass product identifier array as argument
[request start];
And Catch response in :
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{
NSArray *myProduct = response.products;
}
So that you can decide is you can communicate to app store. and your product id is there.
Make sure that you use In App test user account for testing.
And you use the same app-id provisioning that you configured In App purchase.
thanks
I fiddled around with going to the App Store and then back to Settings/Store to Sign Out. I did this 3 times, revisiting my app each time and adding debugging NSLog output, and now I am able to continue testing my in-app purchase code without error -1003. I am not sure the exact reason for this working again, but I am fairly certain is is not a code change on my part as all I was doing was adding NSLogs and re-running my app.
Yeah, IF you've connected your iPad/iPhone to a different computer initially, and are now using it on another, you absolutely must sign out of store on your iPad, sign in w/ normal account to ITunes on your MAC, then Sync.
Also, make sure your iPad "WIFI" is on...
I Did a Clean all Targets in XCode and manually deleted the application off my device, then Build and Run from XCode and it fixed a similar problem (Same error message but different error code:-1009)
Unfortunately, I ran into a problem that was not documented here. In-App-Purches will not work until you accepted all contracts related to app- and in-app-purcheses. So make sure you (or your customer) set up all contracts in iTunesConnect properly, they must appear in the "Contracts In Effect" section to make your purchaes work.
Our problem was that in Itunes Connect we had the wrong bundle identifier. Someone had created the app before hand and we had to edit the app and set its appId to the new one.
I had two problems that caused this:
1) I had copied the IAP code from a different (working) app but had missed setting up my observer:
observer = [[IAPHelper alloc] init];
[[SKPaymentQueue defaultQueue] addTransactionObserver:observer];
2) I was logged in to iTunes in the settings of my device. You can only use a test user in the sandbox - I logged out and it worked again.
Just log out your iTunes account (don't login your test account now! ) , and start your program. When inapp purchase it ask your login details, you must enter your test account information.
I tried every solution offered in the thread here, but to no avail. In my case, I had a wild-card bundle identifier starting with the same domain name as the one I used while creating the bundle identifier for in-app purchase provisioning profile.
Here is how I fixed the problem and may help you fix yours (See attached):
1) Connect your iPhone to Mac.
2) Under the "Devices" (in Xcode > Window menu > Organizer window) select the "Provisioning Profiles" option for your iPhone. You will see all provisioning profiles currently residing on your iPhone.
3) Carefully remove all provisioning profiles starting with the particular domain name in the bundle identifier (com.MYDOMAIN.*) especially the ones that use wild-card except for the one you create specifically with the ability to do In-App purchase (com.MYDOMAIN.inappidentifier).
4) Install the app afresh and test your implementation with a fresh iTunes connect test user (sandbox)
SCREENSHOT:
I have been stuck for 2 days, here's my solution:
Remove all in-app-products.
Remove new in-app-products.
Create a sandbox tester.
Log out my apple account from device (iPad), and then try to buy the product.
It will ask for login, then re-login with the sandbox tester account.
Purchase goes through.
I think the importance is the sandbox tester account, I have not used it before since I always got error-0.
In my case,
I tried everything in the internet, but nothing worked.
Apple actually broke the production payment system, and the sandbox. I just had to wait two days, and it started to work.
The In-App Purchase FAQ says:
Cannot connect to iTunes Store
The "Cannot connect to iTunes Store" issue may be due to one or more of the following reasons:
The sandbox may be unreachable.
Your app does not have a bundle version (CFBundleVersion). See Setting the Version Number and Build String for more information.
Your app is running in the Simulator, which does not support in-app purchase.
You are attempting to purchase a product that is unavailable for sale. See Query the App Store for product information before presenting your app’s store UI for more information.
In my case, the error occurred because I was using the Xcode simulator. It started working when I used my device.
Even in the In-App Purchase Programming Guide says to use the development iOS device has a suggested testing step.