Test in-app purchases manually on a real iPhone and check the contents of paywalls automatically
A paywall is the one screen where a bug costs you money directly: a plan with the wrong price, a missing Restore Purchases button, a trial label that says 7 days when the product says 3. It’s also the screen that behaves most differently between a simulator and a phone. This guide sets up three layers of testing, from a fake store to the real sandbox, and shows how to check the paywall’s plans and prices from a saved file on every build.
Layer 1: a StoreKit configuration file
In Xcode, choose File › New › File from Template, type storekit in the filter and pick StoreKit Configuration File. Add your products with the same IDs, prices and trial lengths you have in App Store Connect. Then edit the scheme (Product › Scheme › Edit Scheme › Run › Options) and set the StoreKit Configuration to that file.
Now a run from Xcode, on a simulator or a device, talks to a fake store on your Mac. You can buy, fail a purchase, expire a subscription and refund from Xcode’s Transaction Manager (Debug › StoreKit › Manage Transactions), and nothing leaves your Mac. This is the fastest loop, and it’s the right one for the purchase flow itself.
Know what it doesn’t test: the fake store isn’t Apple’s. A local file’s prices are the ones you typed, so a price you forgot to update in App Store Connect still looks right here. A synced configuration file, created from your App Store Connect products, narrows that gap; the sandbox closes it.
Layer 2: a sandbox account on a real iPhone
A development or TestFlight build on a phone loads products from the App Store sandbox (Test an iOS app on a real iPhone gets the build there). That is the first layer that proves your product IDs, prices and trials exist in App Store Connect. It needs a paid Apple Developer Program membership with the Paid Applications Agreement signed.
- In App Store Connect, open Users and Access › Sandbox and create a Sandbox Apple Account. Use an email address that isn’t an Apple Account already.
- Run a development build from Xcode and start a purchase. Sign in with the sandbox account when the purchase sheet asks;
[Environment: Sandbox]on the sheet confirms you’re in the sandbox. After that first purchase, the account appears under Settings › Developer › Sandbox Apple Account. - A TestFlight build always uses the sandbox. To reach the sandbox controls with it, sign out under Settings › your name › Media & Purchases, then sign in under Settings › Developer › Sandbox Apple Account. Use a test phone for this: signing out of Media & Purchases can hide content you bought.
- Buy. The sandbox doesn’t charge anything.
Sandbox subscriptions renew on a short clock so you can watch a renewal. At the default rate a 1-week subscription renews every 3 minutes, a 1-month one every 5 minutes and a 1-year one every hour, up to 12 times. You can slow it down or speed it up for each sandbox account in App Store Connect › Users and Access › Sandbox. Use that to test what your app does when a subscription lapses or renews while it’s open.
Layer 3: a check that runs on every build
Layers 1 and 2 are manual. The regression you ship is the one nobody retested: a refactor drops a plan, a string changes, Restore Purchases moves off the screen. Put the paywall’s contents in a saved Mobster check and run it on every build.
mobster test add writes one from a recipe into .mobster/:
mobster test add paywall --bundle com.example.yourapp --set url=yourapp://paywallSaved .mobster/ checks/ paywall.yaml from the paywall recipe. Run it with: mobster test .mobster/ checks/ paywall.yamlEdit it to match your products:
# .mobster/ checks/ paywall.yamlversion: 1name: The paywall shows three plans with Annual at $39.99 a yearapp: bundle: com.example.yourapp path: .mobster/ build/ Build/ Products/ Debug-iphonesimulator/ YourApp.apptags: [smoke, paywall]launch: url: yourapp://paywall args: ["-StoreKitProducts", "local"]expect: - text: Choose your plan - count: { id: /^plan_/ } equals: 3 - value: { id: plan_annual } equals: $39.99 / year - visible: { label: Restore Purchases, role: button }Mobster checks these assertions against the accessibility tree, without a model or screenshot comparison. .accessibilityIdentifier("plan_annual") in SwiftUI is what makes id: plan_annual match.
On a simulator, run it with mobster test .mobster/. A simulator that Mobster launches doesn’t load the StoreKit configuration file your Xcode scheme names: that only applies to runs started from Xcode. So the check passes -StoreKitProducts local, a launch argument your app reads to show a fixed list of products. Then prices are the same on every run.
On your iPhone, a development or TestFlight build loads products from the sandbox, so the same file proves the real prices:
mobster test .mobster/ checks/ paywall.yaml --device "Test iPhone"For a TestFlight build, name your app’s bundle ID so a check may drive it, and Mobster can open it in TestFlight first:
mobster testflight install --app com.example.yourapp --device "Test iPhone"mobster test --device "Test iPhone" --testflight com.example.yourappWhen a price drifts, the check fails with the frame and what it found, for example that plan_annual was $49.99 /.
What a check doesn’t do
Mobster checks everything up to the purchase and never buys. On a simulator Smart refuses every purchase, and on an iPhone every send, buy, post or delete, with nobody asked. So a check can’t complete a sandbox purchase, and it can’t prove that a purchase unlocks your content. For that, test the purchase flow with Layer 1 or 2, or write the purchase step in XCUITest against a StoreKit configuration file.
On a real iPhone a check drives only a build you installed. It never clears your app’s data, so a check that depends on a fresh install belongs on a simulator.
Catch price changes between versions
App X-ray taps through an app with no model, reads every paywall it reaches, and writes a map with a table of each plan’s price, period and trial. It leaves everything on a paywall alone and backs out. Run it before and after an update and compare:
mobster xray app com.example.yourappmobster xray diff before/ map.json after/ map.jsonYearly price went $59.99 → $69.99 on ProNew paywall screen: Upgrade (Settings › Upgrade), $4.99The diff needs no phone.
Download Mobster for Mac to run these checks on your simulators and your own iPhones: free (AI runs on a supported AI plan, an API key or a model on your Mac).
Checks lists every assertion a check can make. Device setup puts the helper on your iPhone.
Questions
Can I test in-app purchases without paying?
Yes. A StoreKit configuration file in Xcode fakes the store on a simulator or device, and a sandbox Apple Account buys from the real sandbox store on a device without charging anything.
Does Mobster complete a purchase in a test?
No. A check goes up to the purchase and asserts the plans, prices and buttons on screen. On a simulator Smart refuses every purchase, and on a real iPhone it refuses every send, buy, post or delete.
Why does my paywall show different prices on a simulator and an iPhone?
A simulator launched outside Xcode doesn't load the StoreKit configuration file your scheme names, so the app has to be told which products to show. A TestFlight or development build on an iPhone loads products from the App Store sandbox.
Sources
- Apple: Setting up StoreKit Testing in Xcode
- Apple: Testing in-app purchases with sandbox
- Apple: Testing an auto-renewable subscription
- App Store Connect Help: Manage Sandbox Apple Account settings
- Mobster docs: checks for TestFlight, purchases and push
- Mobster docs: X-ray
- Mobster docs: run every check with mobster test



