27

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 ?

Safouane Azzabi
  • 299
  • 1
  • 3
  • 7

4 Answers4

27

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.

meim
  • 740
  • 4
  • 7
  • 5
    I did that ! What I want, is to do a real test; I mean testing a real purchase with a real iTunes user. What I try to avoid, is to discover, when the app is in the app store, that the IAP doesn't work! – Safouane Azzabi Nov 22 '12 at 08:36
  • 1
    If the IAP works for your test account in the iTunesConnect, it will work for a real iTunes user when it's released in the app store.There's no way to use a real iTunes user to test IAP. – meim Nov 22 '12 at 12:19
  • @Shadowfiend, I certainly hope what you said is true. I'm having a problem with an app that comes with IAP which works well in development stage, but not real case after released for sell. Here is my case: http://stackoverflow.com/questions/13574037/iap-fails-after-release-but-no-in-development-stage – Tony Xu Nov 26 '12 at 22:51
  • 1
    Is there a way to set up a test user account without giving a valid credit card? – deek0146 Apr 15 '13 at 18:16
  • 9
    yes: setup your test account on iTunesConnect (no credit card needed), then logout from your actual account in the App Store app on your iOS device. **Do not log back in with your test account in the App Store app.** Go in your app and process with the purchase; only log in there when asked for your credentials. You won't need a credit card. – Kamchatka Mar 15 '14 at 16:21
  • Now you can login into sandbox user account from settings without signing out from real account :) – Ayyappa Apr 15 '20 at 07:52
16

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.

scosman
  • 2,343
  • 18
  • 34
4

Just create a test account on iTunes Connect. Then log out from the device and run your app from Xcode.

Darshan Rivka Whittle
  • 32,989
  • 7
  • 91
  • 109
nits
  • 61
  • 2
1

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.

ACP
  • 21
  • 2