Why Testing In-App Purchases Breaks Your Phone
A smooth payment experience only happens when it is tested thoroughly, yet the testing tools themselves create friction. Each problem below is small on its own; together they discourage the very testing that protects customers at checkout.
Sandbox accounts: setup that can burn the account
Start with the account itself. Sandbox accounts are created in iTunes Connect and each one needs a unique email address. Teams typically either invent a random address they later forget, or append a unique tag to a real address. Decide on one convention and record it, because shared credentials make forgotten addresses a recurring cost.
Logging in has a sharp edge. You must log out of your real App Store account before using sandbox credentials, which can leave the device awkwardly signed out until you remember to sign back in. Worse, signing into the App Store app itself with sandbox credentials can ruin that sandbox account permanently. The damage is latent: purchases simply start failing later, which sends the team hunting for a regression that never existed. Treat sandbox sign-in as purchase-flow-only, and keep a replacement account ready.
The looping login prompt
After a test purchase of a recurring subscription, some devices get stuck with a repeating App Store login prompt, often appearing when the phone is unlocked. It can surface five or six times in a row, and the only reliable fix found was uninstalling the app under test. That means a personal phone used for testing may be unable to keep the test build at all, which limits how much real-world testing the developer can do and creates awkward gaps when colleagues ask to try the app.
Failures without a cause: a four-point check
Many failures arrive without a useful explanation. Two frequent culprits are easy to miss: iTunes Connect contracts that were never accepted, a step that may sit outside the developer's control in a company, and attempts to use StoreKit in the simulator, which fails with a similarly vague message. Before debugging code, run this checklist:
- Confirm the iTunes Connect contracts are accepted
- Confirm you are testing on a device, not the simulator
- Confirm the sandbox account has not been burned by an App Store sign-in
- Confirm the receipt was verified against the correct environment
If all four pass and the failure persists, only then treat it as a code regression.
Different screens in sandbox and production
The sandbox and production purchase screens are not the same. In iOS 11, production moved to a cleaner one-tap flow while sandbox kept the older UIAlertView-style flow. A developer who trusts the sandbox screen will misjudge the final customer experience. Use sandbox to verify that a purchase completes, and reserve judgement about layout, wording and taps for the production flow.
Server-side verification across two environments
Receipt verification adds a second split. The receipt is a signed container holding a user's purchases, and most developers send it to Apple's hosted verification service rather than parsing it themselves. There are separate sandbox and production versions of the /verifyReceipt endpoint. Sending a receipt to the wrong one returns an error pointing to the opposite endpoint, so verification code must handle that retry.
The common setup of a development backend pointed at sandbox and a production backend pointed at production works during development but breaks at review time: the submitted build is configured for production while the review team tests in sandbox. That mismatch often leads to unexpected rejections. Plan for it explicitly by making verification environment-aware instead of hard-coding one endpoint per backend.
Why the small bugs add up
The cumulative effect matters more than any single bug. When testing is this unpleasant, purchase features get postponed, designed thinly and tested lightly, and customers absorb the resulting friction. A simpler model would whitelist a small number of regular accounts for free test purchases and pre-release products, letting one account serve both production and testing. Until that exists, the checklist above is the practical defence: protect sandbox accounts, expect vague errors, distrust the sandbox UI, and make receipt verification handle both environments.
Frequently asked questions
How do I set up a sandbox account without ruining it?
Create the account in iTunes Connect with a unique email, log out of the real App Store account first, and never sign into the App Store app with sandbox credentials. That last step can permanently burn the sandbox account, so keep sandbox sign-in confined to the purchase flow and keep a spare account ready if one is lost.
Why does a test purchase fail with no clear error?
Check the unglamorous prerequisites first: whether the iTunes Connect contracts have been accepted, whether you are trying to use StoreKit in the simulator, and whether the receipt was sent to the wrong environment. Those three causes produce vague failures and are easy to overlook because the error message does not name them.
Does the sandbox purchase screen match production?
Do not assume the sandbox flow matches what customers see. In iOS 11 the production flow became a cleaner one-tap experience while sandbox still used the older UIAlertView flow, so judge layout and wording from production and treat sandbox as a functional check only.
What should my backend do when a receipt goes to the wrong environment?
A wrong-environment response is a signal to retry against the opposite endpoint, not proof the receipt is invalid. Build that retry into verification, and remember that app review tests in sandbox even when the submitted build points at production, which is a common source of unexpected rejections.