Monetization: In-App Purchases & Subscriptions

iOS Development — Production & Publishing

Chapter 8 · Monetization: In-App Purchases & Subscriptions

Chapter 6 mentioned in-app purchases briefly, as one more piece of App Store Connect metadata. This chapter covers the real, working mechanics behind them — StoreKit 2, Apple's modern, Swift-native purchasing API.

The Four Real Product Types

TypeReal, Concrete Example
ConsumablePurchasable repeatedly — an in-app currency, extra credits
Non-ConsumableA one-time unlock — removing ads, an unlocked premium feature
Auto-Renewable SubscriptionRecurring access that renews automatically until cancelled
Non-Renewing SubscriptionA fixed-length access period the user must manually repurchase

Making and Verifying a Purchase

StoreKit 2's own real API is genuinely built around Swift's async/await — the same real concurrency model Architecture & Data Chapter 2 already covered — rather than the older, delegate-callback-based approach of StoreKit 1.

let result = try await product.purchase() switch result { case .success(let verification): let transaction = try checkVerified(verification) await transaction.finish() // grant real entitlement here case .userCancelled: // real, expected outcome — no error case .pending: // e.g. real Ask to Buy parental approval still pending @unknown default: break }
A Real, Verified Security Detail
Verified directly against Apple's own StoreKit documentation: every real transaction StoreKit 2 hands back is cryptographically signed by the App Store itself, using JSON Web Signature (JWS) format — the real reason a purchase result can be verified as genuine rather than simply trusted at face value.

Real Commission Rates

Verified directly against Apple's own current Small Business Program documentation:

SituationReal, Verified Commission
Standard rate30% of proceeds
Small Business Program15% — real eligibility: under $1 million USD in prior-year proceeds
EU, alternative terms, subscriptions after year oneA real, further-reduced 10%
A Real, Verified Eligibility Detail
The Small Business Program's real $1 million threshold is calculated on proceeds net of Apple's own commission and certain taxes — and every associated developer account has to be declared, with their combined proceeds counted toward that same real threshold together, not each account counted separately.

Testing Purchases Locally

Verified directly against Apple's own StoreKit documentation: StoreKit Testing in Xcode provides a real local sandbox — a StoreKit Configuration file defining test products directly inside Xcode, letting purchases be tested entirely on a simulator with zero real App Store Connect setup or real money involved.

Hands-On Exercises

Exercise 1

TaskFlow is considering a "Pro" tier unlocking unlimited tasks permanently, versus a recurring monthly cloud-sync subscription. Explain, in your own words, which real StoreKit 2 product type fits each, and why.

📄 View solution
Exercise 2

Explain, in your own words, why .pending is a genuinely different real outcome from an error, and why an app must handle it as its own distinct case rather than treating it as a failed purchase.

📄 View solution
Exercise 3

Explain, in your own words, why testing purchases through StoreKit Testing in Xcode's own local sandbox is genuinely preferable to testing directly against a live App Store Connect in-app purchase during development.

📄 View solution

Chapter 8 Quick Reference

  • Four real product types: consumable, non-consumable, auto-renewable subscription, non-renewing subscription
  • product.purchase() is a real, async StoreKit 2 call — handle .success, .userCancelled, and .pending as genuinely distinct outcomes
  • Every real transaction is cryptographically signed (JWS) by the App Store itself
  • Standard commission: 30%; Small Business Program (real, verified): 15% under $1M/year; EU alternative-terms subscriptions after year one: a real 10%
  • StoreKit Testing in Xcode provides a real local sandbox with zero App Store Connect setup or real money required