How to Test In-App Purchases on iOS Devices

On This Page Why are In-App Purchases Popular?In-app Purch

May 31, 2026 · 11 min read · Mobile Testing

How to Test In-App Purchases on iOS Devices

In-app purchases (IAP) are a key revenue driver for mobile apps, but yet minor subject in the purchase flow can frustrate exploiter, lead to lost gross, and risk App Store rejection. Common pain points include failed transactions, incorrect entitlements, security vulnerabilities, and inconsistent behavior across devices.

Testing IAP on iOS ensures that purchases operation correctly, subscription renew as require, users receive the correct access, and errors are handled graciously. It also involves verify compliance with Apple ’ s guidelines, sandbox testing, and simulating real-world purchase scenario to catch issues before release.

This guide will facilitate efficaciously test IAP for iOS apps at scale, ensuring a smooth user experience and submission with Apple ’ s policies.

Why are In-App Purchases Popular?

It is forever a win-win if any app provides premium or add-ons for monetary benefits. Here are a few valid reasons why developer act towards making their apps relevant and engaging:

  • Encourages App Installs:If a developer offers their app for free, it is unmistakable that more users will download and install it. It open the doorway for users to try out an app since they are more willing to download a free app than a paid one. Depending on the app experience, users will eventually be willing to pay for extra feature.
  • Ad Revenue:Developers can likewise choose to display ads in their apps, and for this, they get paid too. Online giants like Twitter and Linkedin expose ads that advance specific products/services, a huge receipts root.
  • Monetary Benefits:For initial app releases, developers choose to proffer it for free download. Once the grip cull up, in-app purchases boost profits and make the app highly engaging, democratic, and successful.
  • Encourages better apps:As more and more users download an app, it advance developers to add more content and features to provide the best experience to users.

In-app Purchases: Market size

The global in-app purchase marketplacewas valued at $ 76.43 billion in 2019 and is projected to reach $ 340.76 billion by 2027, growing at a CAGR of 19.8 % from 2020 to 2027.

A few well-known ways to serve in-app purchases are:

  • Consumables:These are mainly for power-ups, in-game currency, and additional wellness prevalent in gaming apps. They are immediately available after purchase and can be purchased multiple time.
  • Non-Consumables:Once purchased, app user experience lasting access to these features.
  • Auto-renewed Subscriptions:They are subscriptions to apps like Netflix, where the service renews every month with an automatic amount deduction.
  • Non-renewed subscriptions:They are manual subscription that ply premium content for a circumscribed clip.

As per the below graph, it is clear that the subscription models are more democratic than the other case of in-app purchases.

Read More:

In-App Purchase Testing (IAP) Flow on a Remote iOS Device

Since in-app purchases are the primary monetisation element, app developers should ensure that the purchase flow is easy for their user base. It is straightforward to test in-app purchases using BrowserStack App Live. It allows developer to try their coating on with test-dev environments, real-time debugging, and other features.

Step 1 & # 8211;Open and log in to your account.

Step 2 & # 8211;Once you ’ re logged in you can choose the iOS device you desire to test on.

  • Device: iPhone 12 Pro
  • App to test: Coursera

Step 3& # 8211; Open the App fund on the device

Step 4& # 8211; Search for the Coursera app in the app store

Step 5& # 8211; Download the app and log in to Coursera.

Step 6& # 8211; There are a lot of line available on Coursera to purchase. Select and enroll to any course of your choosing

Step 7& # 8211; Click on subscribe to get the purchase.

Step 8& # 8211; Click on continue to start the payment process

Step 9& # 8211; Enter your payment details to go with the purchase

This is how users can test the whole in-app purchase flow on BrowserStack and look for any improvements.

The chances are that your app is already in good health since you ’ re considering in-app purchase. However, you can always enumerate on testing natural gestures, battery consumption, and to obviate any errors.

Your QA squad can share glitch via JIRA, Trello, and Slack, and developers can easily replicate these bugs and fix them. You can also mix CI/CD plugins with tools like Jenkins, CircleCI, etc.

Must Read:

Talk to an Expert

In-app purchase Testing in Xcode vs Sandbox

SUSA automates exploratory testing with persona-driven behavior, catching bugs that scripted automation misses.

iOS provides two agency to test in-app purchases (IAP): Sandbox examination and Xcode StoreKit local testing. It supports Testing for full end-to-end testing on real devices and Xcode StoreKit Local Testing for faster, automated testing in the simulator.

FeatureSandbox testingXcode StoreKit Local Testing
Where It RunsExistent devices onlyXcode Simulator & amp; real devices
Setup RequirementRequires a Sandbox chronicle & amp; real Apple IDNo extra accounts needed
End-to-End TestingSupports full end-to-end testing (repayment, Ask to Buy, etc.)Limited to local establishment only
Receipt ValidationUses App Store substantiationDeveloper handles establishment manually
Currency ConversionFully indorseNot supported
Purchase SpeedSlower, requires manual stepFaster, automated testing possible
Automation SupportLimited, principally manual examinationSupports automation for IAP testing
Best ForReal-world testing before releaseEarly-stage testing & amp; faster loop

Read More:

How to Test iOS In-App Purchases with Sandbox

Testing iOS in-app purchases with Sandbox is essential to ensure that the purchasing flow work swimmingly without involving existent money dealing. The Sandbox environment imitate purchases, allowing developer to test different scenarios in a controlled setting, ensuring a unlined user experience before found the app to the world.

1. Prerequisites

To essay in-app purchases, the Sandbox testing surround provided by Apple is needed. It simulates purchase without real money minutes.

Some things to consider before examination:

  • The app must be a developer build in Xcode.
  • In-app purchases can be tested without App Review approval.
  • Device provisioning is limited to prevent dispersion outside the App Store.
  • Subscription rehabilitation are quicker in the sandbox (eg., 1 month = 5 minute).
  • Receipts are generated only after a purchase.

Read More:

2. Add a Testing Account to App Store Connect

Before quiz in-app purchase in Sandbox, a Sandbox testing history needs to be created in App Store Connect:

  • From the App Store Connect homepage, go to Users and Access.
  • In the top navigation, select Sandbox, then click the add (+) push. If contribute testers for the first time, click Create Test Accounts.

Source: Apple Developer

  • On the Test Accounts page, click the add (+) icon next to the Test Accounts header.
  • Enter the quizzer & # 8217; s first and last gens. (Note that once created, the gens, email, and password can not be edited.)
  • Enter a unique email address. Use an email that hasn ’ t been used for an Apple account or iTunes/App Store purchases.
  • Set a potent password for the examiner account. Password requirements will be shown if it doesn ’ t meet the standards.
  • Choose the quizzer ’ s App Store land or area. This can be edited later to prove on different storefronts with the same history.
  • Click Create to finalize the setup.

3. Testing iOS Subscriptions with Sandbox

After setting up the Sandbox account, the subscription renewal speed can be set for each tester. By default, subscriptions renew every 5 minutes, simulating one month of usage.

Sandbox Subscription Durations:

  • Subscriptions renew and expire quickly (e.g., a monthly subscription renews/expires every 5 moment, a weekly one every 1 minute).
  • Subscriptions auto-renew up to 12 times, with the actual number of renewals typically being up to 6.
  • Grace Periods are shorter than in production, lasting only a few minutes instead of days. If payment issues are adjudicate within this time, the subscription continue active; differently, it expires.

Now, testing iOS subscription can begin:

  • On the testing device, go toSettings & gt; App Storeand sign in with the Sandbox chronicle.
  • Open the app and pioneer a subscription purchase.
  • If prompted, enter theSandbox story credentials again.
  • Wait for the confirmation message from Apple, show that the purchase was successful.
  • The subscription should now be active, and the functionality, such as climb, downgrades, and cancellation, can be tested.

Read More:

4. Testing Subscription Cancellation on iOS

To test subscription cancellation:

  • Go to Settings & gt; AppStore on the testing gimmick.
  • Under the Sandbox Account section, tap theSandbox Apple ID.
  • Tap Manage and take the subscription to cancel.
  • Tap the Cancel Subscription button.

How to Test In-App Purchases via Xcode

StoreKit Testing in Xcode provides a local environment for simulating in-app purchases without join to App Store servers. In this environment, in-app purchase are configure use a StoreKit configuration file, which can be created straight in the Xcode projection or synchronize from App Store Connect. Once enabled, the test environment uses the local configuration data when StoreKit APIs are called during examination.

1. Setting up Xcode

Before starting testing in Xcode, the basic apparatus requires make a StoreKit form file and enabling StoreKit testing.

Create a StoreKit Configuration File:

  • In Xcode, go toFile & gt; New & gt; Fileand hunt for & # 8220;storekit“.
  • Select StoreKit Configuration Fileand enter a gens.
  • For synced constellation, check the box and take your team/app, then snapNext. For local contour, leave the box unchecked and click Next.
  • Choose a locating and clickCreate.

Enable StoreKit Testing in Xcode:

  • Open the Scheme menu and chooseEdit Scheme.
  • In the scheme editor, choose theRunactivity and click the Options tab.
  • Under StoreKit Configuration, select your configuration file and detentClose.

2. Testing a receipt in the test surroundings

Testing receipts is an significant step when prove in-app purchases. In the test environment, Xcode ’ s StoreKit generates receipts that are exclusively valid within that environment. These receipts can be formalise locally use a credentials provide by Xcode. These can not be validated usingverifyReceiptbecause they are not subscribe by the App Store, causing verification to fail.

The certificate in the test environment is a root certificate, so there is no credential chain to validate when checking the receipt touch. Here ’ s an example (in swift) of how to retrieve the local reception:

// Get the receipt if it 's available.



if let appStoreReceiptURL = Bundle.main.appStoreReceiptURL,



FileManager.default.fileExists (atPath: appStoreReceiptURL.path) {



    do {



let receiptData = try Data (contentsOf: appStoreReceiptURL, options: .alwaysMapped)



let receiptString = receiptData.base64EncodedString (options: [])



// Add codification to read the receipt data.



    }



    catch { 



print (`` Could n't read receipt data: `` + error.localizedDescription)}



}

3. Test an interrupted purchase

An fitful purchase happen when a transaction ask user action outside the app, such as updating a payment method. In Xcode, this interruption can be simulated to test how the app handles it.

  • In Xcode, select the StoreKit configuration file and go toEditor & gt; Enable Interrupted Purchases.
  • Run the app in the simulator or on a device.
  • Make an in-app purchase and observe the defrayment sheet.
  • In the code, check thatSKPaymentTransactionObserverreceives a transaction in the buying state.
  • Tap Confirm. The payment should fail, and the transaction should travel to the failed state.
  • Ensure finishTransaction (_:) is called to take the failed transaction.
  • Go to Debug & gt; StoreKit & gt; ManageTransactions, select the failed transaction, and dogResolve.
  • Verify the transaction moves to the buy state and receipt validation occurs.

Read More:

4. Test restoring purchases without subsist purchases

To test how an app handles restore purchase requests when no previous purchase exist, includes at least one non-consumable product, auto-renewable subscription, or non-renewable subscription in the StoreKit configuration file.

  • In Xcode, go toDebug & gt; StoreKit & gt; Manage Transactions, select all transactions, and clickDeleteto remove any existing purchase.
  • In the app, take the restore purchases option.
  • Verify thatrestoreCompletedTransactions () or restoreCompletedTransactions (withApplicationUsername:)is called.
  • Ensure that StoreKit notifies the observer by ringpaymentQueueRestoreCompletedTransactionsFinished (_). No minutes will be restore.

5. Test cancellation of a subscription

To prove how an app handles subscription cancellations, the app presents an App Store sheet for managing subscriptions.

  • In the app, add a & # 8220;Manage Subscriptions& # 8221; button that triggers theshowManageSubscriptions (in:) or manageSubscriptionsSheet (isPresented:) method.
  • Tap the & # 8220;Manage Subscriptions& # 8221; button in the app.
  • Observe that the App Store sheet for managing subscription appear.
  • Verify if the trial exploiter is subscribed to a subscription.
  • Cancel the subscription and affirm the cancellation in the dialog.
  • Verify that the user is no longer support to any subscription.

6. Test an offer code

To essay redeeming an offer codification for a subscription, the app allows users to redeem pre-configured subscription pass code.

  • In the app, add a & # 8220;Redeem Offer Code& # 8221; push that calls thepresentCodeRedemptionSheet () method.
  • Tap the & # 8220;Redeem Offer Code& # 8221; button in the app.
  • Ensure the Redeem Offer Code sheet appears.
  • Select and redeem the configured offer code.
  • Verify that the defrayment sheet appears with the applied offer.
  • Tap Confirm on the payment sheet.
  • In the code, see that theSKPaymentTransactionObserverreceives a transaction in the SKPaymentTransactionState.purchased province viapaymentQueue (_: updatedTransactions:).
  • Confirm that the app furnish the service or product and calls finishTransaction (_).

Read More:

Conclusion

With iOS devices be the phantasy choice amongst many, the monetisation of apps will only continue to grow. Developers see outstanding likely in this ecosystem, and if dealt with smartly, in-app purchases can become a revenue locomotive.

When spending money, users will be cautious and expect flawless experiences, andBrowserStack App Liveensures only that. Providing a across-the-board reach of real iOS device for app testing ensures that the operation is robust to keep at bay.

Tags
48,000+ Views

# Ask-and-Contributeabout this subject with our Discord community.

Related Guides

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free