0.8.2
N/A
Not sure if that's a real bug or just due to the sandbox environment: when fetching products from StoreKit using SwiftyStoreKit.retrieveProductsInfo, I'm randomly getting a valid or invalid product. Is that expected?
SwiftyStoreKit.retrieveProductsInfo(productsIdentifier) { result in
print(result)
}
which is called directly in didFinishLaunchingWithOptions
Always getting a valid product.
Valid or invalid.. depending of a mysterious mind!
I'm also getting invalidProductIDs all the time.
@bizz84 I'm having Auto-Renewable Subscriptions. I think this issue need to be fix as soon as possible as many users trying to fetch all available subscriptions from iTunesConnect and then display subscription details (Subscription Name and Price)
@shuhrat10 @tbaranes do you know which was the latest version where this was working for you?
I've been testing with the demo app and this works consistently with my sandbox user.
Also maybe this info is relevant:
http://troybrant.net/blog/2010/01/invalid-product-ids/
@bizz84 it's working fine on iOS but it's not working on tvOS.
I'm using SwiftyStoreKit (0.8.2) tvOS 10.1.
It never worked fine (since it's working randomly) for me, but it's my first project using that SwiftyStoreKit, so hard to say... I will give a try to your link and keep you updated.
@tbaranes It's possible that only my sandbox users will work with the demo app. You could try to substitute your own product identifiers and see if it works with your sandbox users.
One of my apps is using SwiftyStoreKit v0.6.1 in production and I have verified that all product IDs are valid with that version as the purchase succeeds.
I'm going to update my app to the latest version 0.8.3 and submit to the App Store.
The only change concerning retrieving products info from v0.6.1 to v0.8.3 is that the SKProductsRequest request is now made on the calling thread (main), rather than on the background queue (DispatchQueue.global(qos: .default).async). I don't believe this should make any difference.
I don't think their an issue in the library itself, it looks like a bug from IAP itself since the fetchProduct is just a wrapper of StoreKit. That's a good idea to try it with your sample app and my own credentials, I will do it next week and keep you in touch!
Weird thing happened. I commented out alert with "Invalid product ID", just included print and now it works. I tried with external tester and they were able to go through in-app purchase.
If this is actually a bug, please fill out an apple bug report for this. I have already done so and am waiting for a reply.
Im getting invalid id all the time in iOS btw.
@returnzer0 I'm planning to write a small sample app including only the code in SwiftyStoreKit to retrieve products, test it and submit it to Apple with a radar.
I am also having the same issue with AutoRenewSubscriptions in TVOS. I get Invalid Product ID Error when requesting list and the same when trying to purchase.
While trying to fetch product information using my bundle id in your sample app, I find a small difference: you fetched the products after a user action, whereas I'm fetching them in didFinishLaunchingWithOptions. So, since I can't reproduce the issue in the sample, I move my fetch in the viewDidAppear of the first UIViewController.
Up to now, I didn't reproduce it, but I will let you know if that issue appear again.
Has anyone ever got this working on tvOS?
I have added a tvOS demo app to SwiftyStoreKit here: https://github.com/bizz84/SwiftyStoreKit/tree/feature/tvOS-demo-app
I have configured a test app on my iTunes Connect account with iOS and tvOS versions sharing the same IAPs.
These match the bundle ID and IAP ids in the SwiftyStoreKit demo apps, however I can see that this works consistently on iOS with my sandbox users, but always fails on tvOS.
@gerasimospy Can anyone test this branch with their own bundle ID and IAPs with the demo app and let me know if you have some luck?

enum RegisteredPurchase: String {
case purchase1
case purchase2
case nonConsumablePurchase
case consumablePurchase
case autoRenewablePurchase
case nonRenewingPurchase
}
class ViewController: UIViewController {
let appBundleId = "com.musevisions.iOS.SwiftyStoreKit" // REPLACE THIS
let purchase1Suffix = RegisteredPurchase.purchase1
let purchase2Suffix = RegisteredPurchase.autoRenewablePurchase
...
}
@bizz84 I have my own project which is setup exactly the same way and I have the same problem. on iOS everything is working fine.
The demo app now runs identical code for iOS and tvOS, but one works and the other one doesn't.
It could be a configuration issue, but I have registered exactly the same IAPs in iTunes Connect.
Next step: file a radar or contact Apple about this.
Tested this and still no luck :(
I filed a Technical Support Incident to Apple with a demo app showing the problem:
https://github.com/bizz84/SwiftyStoreDemo
Hopefully they'll shed some light.
I received a detailed response from Apple Support. Sharing here as I feel it may help.
I'll try to follow up with the suggested steps.
Hello Andrea,
In response to your finding, you are correct that the problem is likely not a problem with your code. It is more likely, an issue with the iTunes Store Server. When this issue occurs, my recommendation is that a bug report be submitted for the Apps Ops Engineering QA group to investigate. The Apps Ops Engineering team processes all such bug report - to replicate the issue, then forwards the validated bug reports to the iTunes Store Server engineers to be investigated and resolved.
When this issue is experienced by the developers who implement your framework, my first recommendation is that the developer review Tech Note 2413, iAP FAQ - https://developer.apple.com/library/content/technotes/tn2413/_index.html#//apple_ref/doc/uid/DTS40016228-CH1-TROUBLESHOOTING-WHY_ARE_MY_PRODUCT_IDENTIFIERS_BEING_RETURNED_IN_THE_INVALIDPRODUCTIDENTIFIERS_ARRAY_
The Technical Note lists all of the known reasons for the SKProductsRequest call to not validate an iAP identifier - assuming that these issue are not the cause of the problem, then the iTunes Store Server is the issue. You might wonder why things work one day and not the next. The iTunes Store Server engineers have not provided an answer to this question.
The standard response which I provide to developers follows - In your case, you can skip the Tech Note and move to the bug report submission. Please send me the bug report so that I can review the console log file which you will submit - to use to get some info to replicate the problem using the curl command-line tool.
You’ve reported that the In-App Purchase identifiers are failing the validation process when called using the SKProductsRequest method. There are 2 cases where this problem occurs.
In the production environment, please verify that your products have the “Cleared for Sale” property set to YES in iTunesConnect to ensure that they are available for sale from your app. If the problem persists, a second reason for this problem is that when the app is first approved, the application may be activated before the In-App Purchase identifiers are activated. Please give the system 48 hours for the identifiers to be activated. You can proactively submit a bug report so that the issue can be investigated in case the problem is not resolved. See the section - Submitting a Bug Report to iTunes Production Support QA - below.
In the sandbox environment, there are a number of reasons for this failure. The known reasons are documented in Tech Note 2413 “In-App Purchase FAQ Troubleshooting Question - “Why are my product identifiers being returned in the invalidProductIdentifiers array?”
https://developer.apple.com/library/ios/technotes/tn2413/_index.html#//apple_ref/doc/uid/DTS40016228-CH1-TROUBLESHOOTING-WHY_ARE_MY_PRODUCT_IDENTIFIERS_BEING_RETURNED_IN_THE_INVALIDPRODUCTIDENTIFIERS_ARRAY_
In the case where the In-App Purchase identifiers work one day, then fail to validate the next day, this is a bug report issue for iTunes Production Support QA to investigate.
If you have recently renewed your developer membership, please check that you have also renewed the “Paid Applications” contract in the “Agreements, Tax, and Banking” section of your iTunesConnect account. Note that the agreement must also be completed by Apple. If there is no “Paid Application Contract” in effect, the call to SKProductsRequest to validate the In-App Purchase identifiers, will fail.
If none of the above issues apply, then this is a bug report issue to be investigated by iTunes Production Support. DTS does not investigate these issues.
Submitting a Bug Report to iTunes Production Support QA
There are 2 parts to submitting a bug report in the case that the In-App Purchase identifiers fail to validate. The first thing is to collect the evidence on the form of a console log. To capture the console log, you will need to install the StoreKit profile first, so that the commands issued by iOS for the StoreKit API’s can be captured.
THE FOLLOWING SECTION IS NEW
INSTALL THE StoreKit PROFILE
Please login to the Apple Developer Bug Report - Profiles and Logs website - using the device you will use to replicate the problem.
https://developer.apple.com/bug-reporting/profiles-and-logs/
Click the “Profile” URL associated with the “App Store/iTunes Store for iOS” item. Please follow the instructions to install the profile to your device.
IMPORTANT - PLEASE RESTART THE DEVICE
THE FOLLOWING SECTION IS NOW OMITTED
DOWNLOAD THE StoreKit PROFILE
Please login to the Apple Developer Bug Report - Profiles and Logs website
https://developer.apple.com/bug-reporting/profiles-and-logs/
Click the “Profile” URL associated with the “App Store/iTunes Store for iOS” item. You will download the “itmsdebugging.mobileconfig” file.
INSTALL THE PROFILE
To install the profile to your iOS device, with the Apple Configurator 2 tool follow these instructions.
Install the Apple Configurator 2 application available from the Mac App Store
https://itunes.apple.com/us/app/apple-configurator-2/id1037126344?mt=12
You can also install the profile via email. To do so, follow these instructions.
CAPTURE THE DEVICE CONSOLE LOG
To capture the device console log with the macOS Sierra 10.12 Console app.
To capture a log with Xcode,
To make sure that the console log has the correct information, please peruse the log file and search for the string “fetchSoftwareAddOns”. If this string is present, then proceed to filing the bug report. If the string is not present, the profile was not installed or the SKProductsRequest was not issued by the app.
To submit a bug report for investigation by iTunesConnect, please use the Apple Developer Bug Report web page - https://developer.apple.com/bug-reporting/.
After logging in, click the New button to author a new bug report, making sure to select the “iTunes Connect” Product from the product picker.
Set the title of the bug report to “SKProductsRequest fails to validate iAP identifiers for app ID “XXXXXXXXXX” ( where XXXXXXXXXX is the app ID of your application”
Please include the saved console log file with the bug report.
By following these instructions, the Bug Report team will be able to expedite the assignment of the bug report to the iTunes Production Support QA team.
Personally, I don't reproduce that issue anymore, I'm letting it open since there a few more comments, but don't hesitate to close it whenever you think it's ok for you 👍
Let me try to test again
On Apr 13, 2017, at 7:45 AM, Tom Baranes notifications@github.com wrote:
Personally, I don't reproduce that issue anymore, I'm letting it open since there a few more comments, but don't hesitate to close it whenever you think it's ok for you 👍
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
@bizz84 So, I did testing and I noticed I'm getting invalidProductIDs only in tvOS Simulator but if you run this code on real device via USB-cable it's working fine.
My scenario: non-consumable IAP, everything works in development and sandbox mode. When my app got approved I downloaded from the production app store. Now I am getting .paymentInvalid "The purchase identifier was invalid" errors.
My solution: In iTunes Connect, go to your IAP page and uncheck "Cleared for Sale." Save. Re-check "Cleared for Sale." Save. Delete production app from your phone and re-download from App Store. Now it works.
The same problem. in-app purchase works stable in the sandbox but I have "The purchase identifier was invalid" error in production.
Hope that my case will be from Apple note above "Please give the system 48 hours for the identifiers to be activated."
Disable/Enable "Cleared for Sale." status does not help in my case.
Update: Tested application 7 hours later, in-app purchases works without changes from my side.
Hello, I was in the same situation as you guys, the solution for me was simple : The productID is not "BundleID.iAPProductID" but is simply "ProductID". Assuming that you have the correct app-secret , bundler identifier and iAP correctly configured in both developer portal and xcode , you should be able to test in sandbox environment before submitting to the appStore
This is what worked for me:
I was confusing the reference name ( left side ) with the Product ID ( right side )
So make sure that you're using iTunes Connect's Product ID in your code.

Most helpful comment
@bizz84 So, I did testing and I noticed I'm getting
invalidProductIDsonly in tvOS Simulator but if you run this code on real device via USB-cable it's working fine.