Testing of In-App-Purchasing in ios - ios

I am using In-App-Purchasing first time in ios,for this i have follow the steps which is given on following links.
http://www.raywenderlich.com/21081/introduction-to-in-app-purchases-in-ios-6-tutorial
and
http://www.tutorialspoint.com/ios/ios_in_app_purchase.htm
I have add two consumables product in my application on itunes connect.
create and download new provisioning profile and configure it with my project.
create test user for testing in-app-purchase
my issue is
"response.products.count" is empty on device AND on simulator it returns 2(which is correct product).
I don't know why it is not working on device.
(1). Can we test In-App-Purchasing with sandbox mode on "unlock devices" ?
(2). Can we test In-App-Purchasing with sandbox mode on "Jailbreak Devices" ?
Can you please help me to resolve this issue.
Thanks.

This is a bug from apple server side. because from last couple of days many test accounts are not working.
fix this issue, I simply registered a new user in iTunesConnect, but I set their store to 'USA'.

for testing in app purchase check that in device you are not logged in to app store from apple id
if you are logged in App Store then sign out all of account and then test in app purchase within application..

Some times there will be problem while fetching products from server if your application works in simulator then it will working fine with your Device ....just checkout your certificate that you used for testing in device and also checkout sandbox account ..it working try thanks...

Related

Devices with iOS 15 ignore my sandbox account during test in-app purchases

We have recently updated several test devices from iOS 14.7.1 to 15.2. After that, when trying to make a test purchase inside our app, TestFlight ignores the sandbox accounts (which we add to Settings -> Apps-Store -> Sandbox account) and uses the main account that is used for purchases in the App Store.
The SandBox account works fine if you log out as the main user in the App Store - but then you can't use TestFlight to download test builds.
maybe someone has faced a similar problem and knows the solution or will tell me in which direction to look?
TestFlight ignores the sandbox accounts (which we add to Settings -> Apps-Store -> Sandbox account) and uses the main account
That is correct behavior. The sandbox account is for when you are running an Xcode build. TestFlight, on the other hand, always uses your real account, but it doesn't charge you (and the same for your beta testers).
#matt is right. The only what I can add here is that after you
logged in as sandbox user > attached device to xcode > run the build > made the purchase with sandbox user
you will be able to use that sandbox user even in next TestFlight builds.
For other testers this new approach is very uncomfortable, expecially if tester has a very complex password for their primary accounts... Apple made these things worst, for sure.
Btw, important to note that making purchases using primary account in sandbox environment (liek your testers do in TestFlight builds) will also reset the subscriptions in some time range. Not sure what exactly, probably from 5min to 1h. I didn't know it and had tons of questions, why my app doesn't recognise any previous subscription made recently. Purchase restore response also says that there is nothing to restore... Weird way of tasting, Apple...

iTunes account creation not allowed when trying to test In-App Purchases

I have an app in the App Store and I want to test in-app purchases. I followed the steps described on the Apple website but I'm facing some problems.
When I try to log in in the iTunes in my application or in Settings/iTunes & App Stores, I receive the error:
iTunes account creation not allowed.
This Apple ID cannot be used with the iTunes Store at this time. Please try again later
I searched the internet but I found nothing about this. It seems like I am the first to encounter this kind of error.
Looks like Apple has this poorly documented. Basically, you shouldn't log in with your sandbox user from that screen. Log in when actually prompted by your test IAP.
Source: Unable to log in with sandbox test users on device
I just had the same problem. Here's how I solved it:
Don't try to sign in Settings > iTunes & App Stores
Log out of iTunes & App Stores (make sure you're not logged into any account)
Just open the app you're trying to test
Your app will promt you to sign in
Enter your credentials for your sandbox test account
Et voilĂ ! You're done. Worked for me. I hope it works for you.
For those who are still facing an issue, here is the solution:
From settings main screen, select "iTunes & App Store", as seen in the picture
now scroll to bottom and you will find your previous apple is still there, sign out of that, see picture for reference, and now when doing in app purchase, it will ask for both apple id and password, use your sandbox tester apple id and password there.
I had this issue. I tried changing existing Sandbox tester account password and tried to login on device...but didn't worked.
Even iPhone device restart didn't worked [last option that most developer follows ;-) ]
I thought it takes time to update this newly created Sandbox testing on DB. So left the login option as it is on device
Now, after launching app that contains In App purchase. Press on button that is responsible for In App purchase. This will prompt for Apple credentials. Enter the Sandbox tester credentials here.
Voila this worked for me!
This has changed... again. Here's how to fix it in 2020:
0) On your test device, go to Settings.
1) Click your account name at the the top, the one with "Apple ID, iCloud, iTunes & App Store" under it.
2) Click "iTunes & App Store"
3) Scroll all the way to the bottom and find the option: "SANDBOX ACCOUNT". It will have defaulted to your AppleID. Tap it and sign out.
4) Tap "Sign In" under SANDBOX ACCOUNT.
5) Add your Sand Box Account credentials. You will probably have to have verified your email address before this will work.
The top answer is correct, but if you're still having the issue:
Make sure that the app you're trying to log into is a development app installed with Xcode. You'll get the same error if your version was installed from the App Store.
(I got confused because I have 5 versions of almost the same app.)

how to switch from Sandbox to live in In App purchase

I am using In App purchase and it is working fine when i am testing it from the sandbox account. But when i tried to purchase the online subscription by making amount zero by live account. it is giving an error of
[you are not authorised to make purchase in this inApp in SandBox at this time Environment Sandbox]
i guess it was setup in sand box mode. So As i tested in sandbox and it is working fine ho can i make it live to that any one can purchase it.
I got my answer for the apple document that app installed from Xcode is always in Sandbox environment and app download from live itunes is Live. thanks a lot to all and specially for one who commented heae on post and guided me.
=>
StoreKit connects to the sandbox environment when you launch your application from Xcode, from your test device (iOS), or from the Finder (OS X). It connects to a production environment for applications that were downloaded from the App Store. You must not use your test user account to sign into the production environment. This will result in your test user account becoming invalid. Invalid test accounts cannot be used to test In-App Purchase again.
<=
Apple Document
You can not test live app with sandbox test ID as sandbox email ID has no real credit. If In App Purchase is working for sandbox ID, it will work for real IDs too.

iOS in app purchase - "this account does not have permission.."

Ok here goes trying to explain this as clearly as possible:)
I have developed an app for a partner.
They wanted to submit the app under their company so I was given the certs and profiles. I packaged the app ...they submitted and all was fine.
Now I need to update the app with new content. So all this is done and the client has set up new in App purchase products for the app.
The Problem:
When I am testing all of the "product requests" are successful and it displays the description of the product etc.
However when I come to test purchasing with a iTunes test account it does not work. It says
"This account doesn't have permission to make in app purchases. You
can change account permissions in iTunes Connect."
However to try and work out the problem, as a test I quickly set up a "test" app in OUR iTunes account and a new bundle id etc and set up same IAP products. I then changed the app ID for the actual client app to point at this. And this works fine no problem what soever when testing via Xcode on device.
I am at a loss at what is wrong here as when I did the original app all worked as expected as in I was able to use a iTunes test account I had set up to test their app.
Any ideas what might be going on?
regards
ade
Apparently the test user account needs to be on the same apple developer account as your app!

In App Purchases - empty product list

I'm trying to understand how to work with In App Purchases. I've read many documents and seen a lot sample codes but I can't understand why product list is empty. According to documentation and forums I made this:
Setup contracts on iTunes connect.
Create AppID on provision portal with unique bundle ID
Create and install provision profile for this AppId and enable In App Purchases
Create application on iTunes connect.
Create purchases for this application.
Submit application.
Reject application.
In code, I've tried to receive product information by product ID and as result I can see empty list. However, I can see an array of invalid product IDs.
Could you help me to understand what is wrong?
Thanks.
According to Apple documentation:
Follow these steps to test your application in the sandbox.
- Log out from your iTunes account on the test iOS device.
- Before you can test your application, you must first log out of your regular iTunes account. iOS 3.0 includes a Store category in the Settings application. To log out of your iTunes account, exit your application, launch the Settings application and click the Store icon. Sign out from the currently active account.
- Important: Do not sign in with your test account in the Settings application.
- Launch your application.
- Once you have signed out of your account, exit Settings and launch your application. As you make purchases from your application’s store, Store Kit prompts you to authenticate the transaction. Log in using your test account to approve the payment. No financial transaction takes place, but transactions complete as if a payment was made.
I've tried it and can't see "Store Kit prompts you to authenticate" when I ask for products. Maybe I need to setup project in xCode?
Hm...
I can see products in Simulator of iOS 5 but can't buy it. Magic.
Try to delete your build and app on your device. I think this one should work.
It can take a good few hours for Apple's server to get round to enabling the in-app buys. I had the same problem that you did, but then it just started working half a day later.

Resources