In App Purchase - iOS - ios

I'm trying to add In-App Purchase to my app. My app is already on the App Store so I added my IAP's in iTunes Connect and I'm using the SwiftyStoreKit from Github to do a purchase.
When I test my IAP in the sandbox they work fine but when I submit the app the testers tell me that they can't perform a purchase. What can cause this?

There are a few steps you have to take into account:
1: If the IAP's don't show in the app, make sure that you use the same bundle identifier for your AdHoc distribution as te one you created the IAP's for.
2: what Eugene said: for sandbox, only sandbox testers can purchase tests. Create sandbox testers and make sure your testers log out first in their own App Store account, before trying to make a purchase with the sandbox user
3: also make sure testers NEVER use the sandbox accounts to make actual purchases; this will convert the sandbox account to a live account.
Hope this was of any help :-)
IAP's aren't that hard, you just have to make sure you don't mess anything up.

Only Sandbox Testers can make test purchases. It's NOT the users who are listed in Internal and External testers lists. Check iTunes Connect => Users and Roles => Sandbox Testers.

Related

iOS In-App-Purchase Sandbox Environment Product issue

I’m new for IAP feature in iOS. I sent my couple of day to test IAP for learning purpose bur did not get success.
Something I’m missing to implement or whatever I don’t know exactly thats why I’m asking here. Basically I wrote code from this tutorial and my system is iOS 9/10 and Xcode 7/8 actually I tried with both.
I did all the step correctly Make “Test User”, Remove iTunes account from the device etc and also test cases from this web link but still facing “In Valid Product ID” don’t know why? but did not get list of product(s) from iTunes.
Just clear me for below point
1) Do I need upload app on AppStore (temporary then reject it) for first time test IAP in sandbox environment or no need to do?
2) Do I need to add ”Contracts, Tax, and Banking Information" in iTunes for sandbox environment or no need to do? (Right now added in my iTunes Account)
I added product on iTunes with and without screenshot uploaded but each time when I upload screenshot with product in iTunes then status was “Ready to Submit” and and without screenshot status was “Missing Metadata”
Is it correct status? and can we test IAP purchase with this status in Sandbox Environment?
1) No. There is no need to upload an App and reject it in order to test In-App purchases. You only need to create a sandbox account.
2)Yes, add the required information.
Make sure you have properly submitted each In-App purchase AND added them to the app - both steps required.

How do I avoid paying for my own In-App Purchase?

I've just had an In-App purchase approved and hit the App Store. To check the app, I've deleted my test copy and downloaded fresh from the App Store - but now I can't get the In-App purchase without paying for it. Is there a way around this? Sandbox user isn't working in the real App Store, and I don't want to make the In-App purchase free, even for a short while, during the first few days of update. Promo codes are available for the app, but not the IAP.
You can use the below link to create sand box users and test app without paying for it:
https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnectInAppPurchase_Guide/Chapters/TestingInAppPurchases.html
I suppose it is not possible to test (without paying) IAP once app is in app store. For this purpose sandbox environment is provided by apple so that IAP are tested in development.

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.

How to test in App purchase for an live app

I saw this question but its not what i need :- Testing in-app purchase after going live\
I want to provide limited set of testers free access to In App Purchase for testing purposes.The first version of app is live i wish to upload new version. What are my options?
I can make every thing free through code on development build and install it on testers device but i don't want to go this way.
Will the IAP test accounts work if one version of app is live already?
For Testing In-App purchase you have to login into your developer account and add Test user account for In-App purchase . Search for Sandbox In-App purchase testing and app you will get relevant steps.

iOS In App Purchase: test a real purchase without submitting to Apple

I implemented in app purchase in my iOS app and I want to do a real test (not a sandbox) before submitting this new version to Apple
Of course, the current version of the app (in the App Store) was validated with a product
So, I archived the app using an Ad Hoc distribution profile and I generated an IPA file for Ad Hoc deployment. But when I installed the app via Testflight on my device, I discovered that the app was in sandbox environment!
Is there a way to do a "real" purchase before submitting the app to the App Store ?
You can actually test the in-app purchasing in the sandbox environment, basically you'll need to set up an test user account in your iTunesConnect.
Check the apple documentation here:
http://developer.apple.com/library/ios/#technotes/tn2259/_index.html
You'll be able to find all the information related to In-App Purchasing, including sandbox testing.
Short answer: you can't test a real purchase (aka, spend real money). It isn't possible.
Slightly longer answer: You'll automatically hit the sandbox environment unless it's an apple-signed release build. Even ad-hoc signed builds hit the sandbox.
To test a new IAP: create your IAP (it will be in "needs approval mode" until submitted with the final build and test against the sandbox - that's fine). If your purchase works against the sandbox, it should work against prod with real money as well. It would be great to do a trial run with real money, but that's just not possible until the IAP is approved and you get the production signed version of the app from the app store.
Just create a test account on iTunes Connect. Then log out from the device and run your app from Xcode.
To get access to the purchase you need apple signature, because you are connecting with the apple servers.
I assume that your app, is doesnt have that signature, so your request goes to the sandbox.

Resources