iOS In-app purchases - ios

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!

Related

Linking In-App purchase missing on iTunes Connect

Last week I successfully created IAP product on "Features=>In-App Purchase" Menu on iTunes Connect. And I tested that product through sandbox and it was worked fine.
And I also can link my IAP product to my specific version of iOS app. (App Store => specific version of iOS APP ) So I submitted app for review.
However, During the state of "In-Review", I found some critical bugs and I rejected submit on myself. (Developer rejected). I fixed bugs, and tried to submit again with new binary.
But I can't find linking IAP product on my app. Last time I remember there was a section for linking IAP product to my app on specific version of iOS app. Like below, there is no linking section. it was disappeard.
I totally don't understand... I signed the contracts, and input bank information successfully. I can create IAP products, but I can't link these to my app. What is the problem?
I read some stackoverflow questions, perhaps Missing In-App-Purchase section in iTunes Connect this question is very similar with my situation but I can't resolve it. Thanks in advance...
Guys I found solution...
Crazy... your IAP's status in "waiting for review" you can't link that product to your app.
At least you have to have one of "ready-to-submit" IAP product...
WTF

In app purchases using SwifyStoreKit unable to get info about product

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.

Invalid product ID in iMessage application

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.

inapp purchase - can't load products

i want to enable some inapp purchases in my new app. but i'm not able to load the informations from the store.
i'm quite sure, that i configured everything all right.. the bundle id seems to be the same at all 3 places (APP ID # provisining portal, bundle id in iTunes Connect and the Provision Cer). i'm also able to upload the binaries to apple.
EDIT:
fixed the problem by myself.
for me helped 2 things in combination:
remove "rejected" status via uploading the binaries again
don't use a jailbroken device
But in FAQ 6 are some more reasons for this problem listed:
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.
hope this will help some more of you.

"Cannot connect to iTunes Store" in-app purchases

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!!!

Resources