How to test in-app purchase ios - ios

I built my app with ionic, and now I am ready to test it.
I am able to sign it correctly with certificate and provisioning profile from my apple developer account.
In my app I added also in-app purchase. I used the cordova plugin.
Next I enabled in Capabilities section, the In-App Purchase menu.
Then, in iTunesConnect I created a product, and once did it, I uploaded again a new build and connected my app with this new build. Keep in mind that I set also the product in the tab App Store in iTunesConnect.
For now I am using Test Flight to test the app, and it works fine
In iTunesConnect, in the "in-app purchase" section, I have this notice:
"Your first in-app purchase must be submitted with a new app version. Select it from the app’s In-App Purchases section and click Submit.
Once your binary has been uploaded and your first in-app purchase has been submitted for review, additional in-app purchases can be submitted using the table below."
In the In-App Purchase section, I can see only one product with status "ready to submit", and I am not able to submit in some way...
I followed some help on line, but with no success.
Please help me!
Thanks

Login to itunesconnect.com -> User and roles -> Sandbox Testers
Add a sandbox account -> install your app in device -> Sign In with the Sandbox account in your device -> Test your app.

Related

SKProductsRequest returns no product in production environment

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.

ionic ios app with in-app purchase - how to test in-app consumable product before first submission of the app and product

Building an ionic 3 app and want to add in-app purchases for iOS. But can't seem to be able to test the in-app purchase products.
I integrated with both Native in app purchase plugins from the Ionic Native documentation website
In App Purchase and In App Purchase 2 i am not able to test any of the products. i always get the error that the "Unknown product identifier".
(NOTE: this works ok with Google Play in-app purchases)
Important : this is pre any submission of the app with in-app purchases to the App Store (however the app has been approved before and is published in the App Store).
I already have an in-app purchase product created in App Store Connect that is "cleared for sale" and "ready for submission".
also - i have checked the following:
Paid Applications contract in iTunes is signed
in-app purchase capability in Xcode is turned on (i run ionic cordova prepare ios and opened the workspace in Xcode)
App ID in the Identifiers section of developer.apple.com page exists and has In-App Purchase Enabled for both Dev and Distribution
created Sandbox user for testing
All the above being considered i tried building both in Debug and Release mode - with iOS App Development profile and App Store or Ad Hoc distribution profiles and deployed to a trusted device and always get that same error when i try to purchase the product "Unknown product identifier".
Is there something i am missing - is there something i need to do for the build, or set-up on the profiles. Or does it have to do with the in-app purchase product not being approved yet (although i can't submit the product without submitting a new build with in-app purchases and the new build is not good because i can't test the product - kind of the egg and the chicken problem).
Any help and/or pointers would be appreciated, as i ran out of ideas.

Testing In App Purchases on TestFlight

I am trying to test In App Purchases on TestFlight but some things are not clear to me.
I have created my In App Purchase Products and their statuses are 'Ready to Submit'. However at the top on the screen it says "Your first In-App Purchase must be submitted with a new app version. Select it from the app’s In-App Purchases section and click Submit."
So when I click on the 'App Store' tab at the top and then under the 'iOS App' subheading I click '1.0 Prepare for submission'. I am taken to the screen where I fill in the App Store information of the App as if I was going to upload the App to the App Store. There are inputs for me to fill in the description, keywords, screenshots, app icon etc. And I also see the section were I can add some In App Purchases which is what I assume is meant by the previous message "Your first In-App Purchase must be submitted with a new app version. Select it from the app’s In-App Purchases section and click Submit." Here I can select my IAP products for my first submission.
My question is this:
1) I don't want to actually put the app on the App Store yet. I just want to test the IAP on TestFlight with my testers. I assume I need to click the "Manually release this version" radio button when I submit the app for review for this to happen? Or am I meant to do this another way?
2) Since I need to fill in the description, screenshots etc, it sounds like the app basically needs to be completed before I can submit it for review. Could I just add some dummy descriptions and screenshots here? Or does the app really need to be in a close-to-finished state JUST to TEST In-App-Purchases?
Thanks for the responses.
For testing In-App Purchase on TestFlight you don't need to submit app.
You have to test In-AppPurchase with sandbox account. For in-app purchase from your app you have to logedin with existing id and set your sandbox account in itunes and purchase.
Create sandbox Account (test user for In-App)
Goto iTunesConnect >> Users and Roles >> Sandbox testers >> add
give this test accounts credentials to all testers for testing IAP or make many testing account.
make sure when you have to submit for review please add your in-App
purchase with the review (from prepare for submission >> Add In-App
purchases).

Steps for Testflight to test an in app purchase on IOS?

I cannot work out nor find up-to-date documentation that shows how to test in-app purchases on IOS using Testflight.
As far as I understand the use of Testflight negates the need for sandbox users. Testers can use their normal iTunes account details - correct?
I have enabled In-App Purchases for the app in the Developer Console.
I have uploaded In-App Purchases to iTunes Connect via Application Loader
The IAP are showing status 'Ready to submit'
The app itself is showing as 'prepare for submission' - it is way off submission yet, I'm just trying to test functionality.
The ID's of the IAP match those in the app code.
Is there anything else I need to do in iTunes Connect to get them working in Testflight builds?

How to test In App Purchases through Apple TestFlight?

I uploaded my first app to iTunes Connect (iOS 8, iPhone) and it's now available through Apple TestFlight for internal and external testers.
I created a Non-Consumable in app purchase for it and would like to test it. How can I add it to my beta app?
I'm getting this message in iTunes Connect:
Your first In-App Purchase must be submitted with a new app version. Select it from the In-App Purchase section in Version Details
and click Submit.
You do not currently have a iOS Paid Apps contract in effect. If this In-App Purchase was submitted with your app, then your app will
not be available on the App Store until your contract goes into
effect. Legal, Admin, and Finance users can go to the Agreements, Tax,
and Banking module in iTunes Connect to view your contract status.
TestFlight users don't require a sandbox account, but they will test against an automatically created sandbox account.
Sandbox Accounts
The moment a tester opens your application, a sandbox
account is created for them. This means it's no longer necessary to
create test accounts in iTunes Connect. Testing In-App Purchases was
never easier.
Source
Note that your TestFlight user is a legitimate App Store user. That user will be purchasing, restoring, etc. from the IAP in the Sandbox as opposed to the real IAP.
On iTunes Connect, the IAP can be "Approved" or "Ready to Submit" (or any other status, I think).
English
Testers - TestFlight - Apple Developer
Each build is available to test for up to 90 days, starting from the
day the developer uploads their build. You can see how many days you
have left for testing in the app’s details page in TestFlight.
TestFlight will notify you each time a new build is available and will
include instructions on what you need to test.
All in-app purchases are free during the testing period.
中文
测试员 - TestFlight - Apple Developer
从开发者上传的那一天起,每个构建版本可被测试长达 90 天。您可以在 TestFlight 的 app 详细信息页面上查看可供测试的剩余天数。
在测试期间,所有 App 内购买项目都是免费的.
you can test in-app purchase with test account.
go to itunes connect -> Users and Roles --> Sandbox Testers
then create an account for testing your in app purchase.
when test in app purchase try to logout from app store which uses your real account. then it will ask for itunes account while in testing in app purchase then enter your test account credentials.
Testing IAP is going to require a test user that you create under iTunes connect. Plus code in you app to implement IAP. Then to test it you "purchase" the item from within the app, under the sandbox, using that user id.
As far as I know TestFlight is no different than testing the IAP on your device by building directly to your device.
I'm assuming that you didn't just add the IAP bundle id and expect it to do something.
If you have not added code to support IAP, that answer is non-trivial within the scope of a SE answer. Google IAP tutorial. There are lots of good ones out there.

Resources