Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone StoreKit - invalid product id's

I'm trying to test In App Purchase within the sandbox environment.

In order to test the code I did the following:

  1. Created an In App Purchase Test User account under 'Manage Users' in iTunes Connect

  2. Created some in app purchase products under 'Manage Your In App Purchases'. I used numeric values and alpha-numeric values for the Product IDs.

  3. Loaded the app onto the iPhone, went to Settings->Store and logged out of the regular store and into the test account created in step 1

  4. Set a breakpoint in the (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response callback

All the submitted Product ID's are in the response.invalidProductIdentifiers property. When submitting the request I first tried the exact Product IDs created during step 2. I also tried prefixing them with the Bundle ID:

NSString *id2 = @"com.super.duper.8";
NSSet *productList = [NSSet setWithObjects:id2, @"8", nil];

SKProductsRequest *request= [[SKProductsRequest alloc] initWithProductIdentifiers:productList];

Am I missing something obvious? Any help is appreciated.

Achim

like image 578
Achim Avatar asked Jun 25 '09 00:06

Achim


People also ask

What is product ID in In App Purchase IOS?

A: A product identifier is a string used to uniquely identify every product you wish to sell from your application. The App Store uses it to retrieve information about a product. It is a string identifier that can only contain alphanumeric (A-Z, a-z, 0-9), underscore (_), and period (.) characters.

What is StoreKit in IOS?

StoreKit provides a simple and secure way to purchase digital goods or services in your apps across all Apple platforms, so people can start playing, gaming, reading, and more, right away. StoreKit 2 uses modern Swift-based APIs that make it easy to deliver great in-app purchase experiences.

What does purchase identifier invalid mean?

Typically, it is an issue with the developer's production server not being able to be validated by Apple. Feb 21, 2021 3:13 PM. User profile for user: Tesserax. Tesserax.

How do I enable in app purchases Xcode?

In the Xcode Project navigator, select the StoreKit configuration file. Choose Editor > Enable Interrupted Purchases.


15 Answers

If you are still getting invalid product ids, I've been accumulating a checklist of all of the various causes:

http://troybrant.net/blog/2010/01/invalid-product-ids/

like image 67
Troy Brant Avatar answered Oct 04 '22 00:10

Troy Brant


I spent two days struggling with all my productsRequest (for AppID) ended up in response.invalidProductIdentifiers list, instead of in response.products list. Apple definitely did an F grade job in dealing with their storekit. It is confusing, intertwined and complex.

I did finally resolved it. One very important lesson I learned as indicated by few in the forums: It may take many hours for what you entered on the itunesconnect.apple.com to take affect.

There are two parts: application name and AppID in your xcode and what you entered in itunesconnection, they have to match exactly (case sensitive). If you registered or modified your in-App AppleID (I also completed all my contracts and bank information as suggested by some that the purchase actions won't work without getting this part done), you may as well go to bed before testing it again because it really takes hours in my case to take affect. I was so frustrated battling with this issue before my 9 year old dragged me for bed time story then surprised to find the issue disappeared when I woke up.

I found the suggestions by Eddy71 in http://www.iphonedevsdk.com/forum/iphone-sdk-development/21035-problems-creating-test-user-app-purchase.html really helpful. Before resolving it I did everything I possibly could do in Eddy's check list and still got zero products, one of my fears was that whether without uploading the binary code to complete the application registration in itunesconnect was ok (no need to go live as taught in http://blog.mugunthkumar.com/coding/iphone-tutorial-%E2%80%93-in-app-purchases/). It is indeed ok. Make sure the "cleared for sale" is check and in the icon is green (you need an extra step to approve it after filling out the form). The other fear was that whether I can use developer provisional (not distribution provisional) in debug mode, it is also indeed ok. I hope this may help some of you. Good luck and have faith. It will work eventually.

like image 38
Wayne Lo Avatar answered Oct 03 '22 23:10

Wayne Lo


Our issue was the last bullet point from Apple's FAQ, "Why are my product identifiers being returned in the invalidProductIdentifiers array?":

  • You did not complete all the financial requirements (see the "Contracts, Tax, and Banking Information" section of this document).
  • You did not use an explicit App ID.
  • You did not use the Provisioning Profile associated with your explicit App ID.
  • You did not use the correct product identifier in your code. See Technical Q&A, QA1329, 'In App Purchase Product Identifiers' for more information about product identifiers.
  • You did not clear your In App Purchase products for sale in iTunes Connect.
  • You might have modified your products, but these changes are not yet available to all the App Store servers.
  • If you or App Review rejected your most recent binary in iTunes Connect.

I changed the most recent version (which had been rejected) to "Waiting for Upload" by clicking "Ready to Upload Binary" in iTunes Connect and the problem was resolved after about 10 minutes.

like image 31
Phil Calvin Avatar answered Oct 03 '22 23:10

Phil Calvin


it's OK that the phone is jailbroken, you just have to uninstall appSync in Cydia, then it works

like image 32
Kulitorum Avatar answered Oct 04 '22 01:10

Kulitorum


Apple has a fantastic document which is not well known that covers this at the end. It also dispels some myths about things that don't help (eg. submitting a binary).

Technote 2259 "Adding In-App Purchase to your iOS and Mac Applications"

like image 22
Jesse Rusak Avatar answered Oct 03 '22 23:10

Jesse Rusak


We ended up creating a new provisioning profile, there was a line somewhere (can't recall where, not in the docs for in app purchase) that stated that you have to enable in app purchase in the provisioning profile. We couldn't do that with our existing profile, so we created a new one and then we could enable it.

like image 34
Achim Avatar answered Oct 04 '22 00:10

Achim


Try resetting the iphone settings and delete the app from iphone and use the request product id directly without the Bundle ID

like image 26
osama ali Avatar answered Oct 04 '22 00:10

osama ali


For anyone else that has these issues, I highly recommend reading this thread on the Apple Forum.

like image 32
William Denniss Avatar answered Oct 04 '22 00:10

William Denniss


I tried everything suggested in the Apple forums and here, and still couldn't get it to work. Found the solution - your app needs to be transferred by Xcode for the sandbox to be enabled.

Obvious, right? Well, if you are working with an update to an existing application, the device will still treat it as an App Store-installed app.

So delete the app from your device. Then install the app back onto the device using Build & Run with your device tethered to your Mac. It should work now :)

like image 20
Héctor Ramos Avatar answered Oct 04 '22 01:10

Héctor Ramos


In my case, I didn't complete the bank info, tax info, and contact info.Once I finish this, I can get my productID, hope this will help someone.

like image 39
Randall Wang Avatar answered Oct 03 '22 23:10

Randall Wang


This is where you are going wrong, you need this in your code:

NSSet *productList = [NSSet setWithObjects:product id]

You can get this product id from iTunes connect.

And you need to make sure that you have created a test user, and have signed out of your original iTunes account. Please see do not sign in with test user account, regardless of what apple documentation says, just use it when a pop up appears.

like image 27
Vibhor Goyal Avatar answered Oct 04 '22 01:10

Vibhor Goyal


What's that @"8" for? your product is named as com.super.duper.8 right?

http://blog.mugunthkumar.com/coding/iphone-tutorial-%e2%80%93-in-app-purchases/

like image 24
Mugunth Avatar answered Oct 03 '22 23:10

Mugunth


Another issue I had was that I had to go to Window > Organizer in Xcode and delete my app and the provisioning profile(s) and re-add my development provisioning profile. I restarted the device and xcode as an extra measure.

like image 28
Banjer Avatar answered Oct 04 '22 00:10

Banjer


I have tried every solution that available on the internet, and nothing worked, absolutely nothing. My problem: My device was jailbroken and had Cydia on it. I restored the device to factory defaults (Not jailbroken) and it worked the first time and returned the product ID no problem.

like image 20
Greg Richards Avatar answered Oct 03 '22 23:10

Greg Richards


For me the problem was that I had chosen "Turn on Content Hosting" when set up the In-App purchase. So I had to turn it off and the problem was resolved.

like image 33
Dogahe Avatar answered Oct 03 '22 23:10

Dogahe