So I think I did all the steps to try to put in-app purchases onto my app, but it still just says "Invalid product ID".
I made the app on Xcode
I registered a bundle ID on xcode
I went to developer.apple.com and checked that the App ID is there, and it is.
I signed into itunes connect and created a new app. I used the same bundle ID.
I created an in-app purchase and created a product id for that (it says ready to submit).
I followed a tutorial and used SwiftyStoreKit (installed with cocoapods) to put in-app purchases on my app, and used the same product ID I created a step ago.
I delete the app on my phone, and then build it onto the phone again.
I test it, and it says invalid product ID.
the log of the error:error(__C.SKError(_nsError: Error Domain=SKErrorDomain Code=3 "Invalid product id: NWPremium" UserInfo={NSLocalizedDescription=Invalid product id: NWPremium}))
Do I have to submit the app for review before in-app purchases will work or something? Because the tutorial I followed didn't have to do that. Did I go wrong by registering the bundle ID in xcode first?
Related
I have an iOS application which uses in-app purchases.
I have already set the environment:
Set the Agreements Tax and Banking section,
Created iap products
Turned on "In app purchases" in the capabilities tab
Implemented my code to retrieve the product list and to perform a purchase validating the receipt server-side
I have also tested all with a sandbox environment and all works as expected: the list of products is correctly received by the store and i can purchase a product validating the corresponding receipt.
I have also tested the application using testflight which creates automatically a sandbox user for all testers and all works as expected.
I submitted my application to the Apple store and the revision has been passed so that at the moment the application is in "pending developer release" status, all the products have been approved:
In order to try an actual purchase (using a real credit card) I have generated a promo code with iTunes connect and I have installed the application on my iPhone.
However, when using the application downloaded in this way I can't see any products in the IAP section of my application. It seems the application downloads an empty or invalid product list. The same application version works fine with Testflight. Is the use of promo code permitted with IAP? Why I can download a proper list of products only using a sandbox user? Since I can't debug my application, how can I find the problem?
EDIT
I found found here the following points about invalid Product Identifier problem:
Have you generated and installed a new provisioning profile for the new App ID?
Have you configured your project to code sign using this new provisioning profile?
I have generated the App Id managing signing automatically with XCode.
In the developer portal I have the App ID in this form
Currently, I don't have generated any provisioning profile, in fact I can't find it in the "Provisionig Profile" section of the developer portal. And, as you can see in the image above, in Xcode I see "XCode Managed Profile" as a Provisioning Profile:
Is this a problem? If yes, how should I fix it? Is it enough to generate a new provisioning profile manually and install it on my machine? Should I upload a new build for my application?
If the provisioning profile is missing, why is my application working correctly using sandbox users and Testflight environment?
The problem was that, actually, you can't download a list of product until the application is in the "ready for sale" state. As stated in the In app Purchase FAQ:
"When an application is approved, the developer must also approve the application for release to the App Store. On approval, the application ID is activated to the App Store. The same activation is required for the in-app purchase identifiers and can only take place once the application is activated. In some cases, the activation of the In-App Purchase identifiers may lag up to 48 hours following the activation of the application.
If the developer does not approve the release of the production application to the App Store, then any new in-app purchase identifiers will not be activated. This is an issue when a developer wants to verify the application prior to activating it on the App Store. If the desire is to test the in-app purchase process for the new items, the application must be activated to the App Store. This is only an issue for new in-app purchase identifiers in a corresponding application submission. Once these in-app purchase identifiers have been activated, application updates to the submission will find that these in-app purchase identifiers are validated, even if the update is not activated."
So if your application is in "pending developer release" status, you can't get the product list with an application downloaded through promotional codes.
Once the app has been released on the store, the product list has shown correctly.
The problem was not related to provisioning profiles: the auto-generated provisioning profile is valid to submit applications with in-app purchases functionalities.
I am implementing IAP in my iOS app, and I am using the latest version of SwiftyStoreKit Framework to help me with the purchases.
I have done all the pre cursor tasks such as setting up a developer account in itunes connect, generating provisiong profiles for the app, making new consumable and non consumable purchases in TestFlight, adding those purchases to the app information (ready to submit) and also creating a sandbox user. I have done debugging following this answer, this one and this one.
Now, the problem is that whenever I send a request to retrieve info about a product, I get the following error.
RetrieveResults(retrievedProducts: Set([]), invalidProductIDs: Set(["com.mycompany.app.consumable"]), error: nil)
and when I try to purchase the product, I get this error Purchase Failed: SKError(_nsError: Error Domain=SKErrorDomain Code=3 "Invalid product id: com.mycompany.app.consumable" UserInfo={NSLocalizedDescription=Invalid product id: com.mycompany.app.consumable})
Restoring purchases and verifying receipts seem to work fine...
Any pointers would be very helpful.
Thank you.
UPDATE:
I have now left behind the SwiftyStoreKit framework and am using Apple's own way of using a SKProductsRequest, where I have setup the delegate functions and all the requirements and then I run the function call 'SKProductsRequest.start()' and it still gives me back a set of invalid product ids once again.
For the new method, I setup a new project, along with bundle ids provisioning profiles, and itunes connect app. I can upload the app to itunes connect for testflight too! So the ids seem to be correct.
Ok, after all this time I visited my old co-workers again and they told me that the admin had forgotten to accept the store agreements.
Even though I had specifically mentioned it as a possibility... but oh well. They were able to get purchases working again after that.
I am building an App with IAP (auto-renewal subscription). The workflow seems to work fine, IPA are created for sure (in iTunes connect), sandbox user also logged in. The IAP product ID is also correct but I get the error (from SKPaymentTransaction):
Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store"
Before that error I get the purchase screens where the price, the duration of the subscription and the name of the subscription is displayed. So the connection and the product ID is correct.
I am logged in with sandbox user: The screens displays [Environment: Sandbox].
I am using a real device (iPhone 7 and iPhone 5). The error occurs on both devices and on simulator (for sure on simulator?).
Any ideas?
I forgot to add localized title and description in iTunes connect. After that the IAP worked like a charm. *doh
What I've done:
I've created a new iMessage application, it came with two targets.
One for the iMessage extension (com.x.y.MessagesExtension) and one
with the main bundle ID (com.x.y).
I've set up an app id for (com.x.y) and created an app on iTunes
Connect.
I created an inApp purchase with id (foo) in iTunes Connect
I created a sandbox test user
I uploaded to test flight
PROBLEM Tried purchasing: Invalid Product ID
I've went through a nicely compiled list to make sure I wasn't missing anything from this source: http://troybrant.net/blog/2010/01/invalid-product-ids/
Everything checks out except for one; The bundle ID. I'm trying to purchase from the iMessages "extension", It has a different bundle Id than the one on iTunes Connect, but I figured since it's an extension, it should find the IAPs.
I would appreciate any help. Thanks!
Thanks to Apple's great error messages, they were very descriptive when saying "Invalid Product Id". It turned out I didn't have my bank details active. Anyway, fixed that, and it solved my problem.
I get errors when I try my IAP's in the simulator, it says "Purchase Failed: invalidProductId" but it returns the right ID that is setup in the store. Is this because I have not submitted my app (or binary, what is this?)?
Project is here: github.com/kaio37k/KCC