StoreKitTest provides a testing harness for simulating StoreKit in-app purchases, transactions, and SKAdNetwork ad postbacks during development. You drive purchase flows with SKTestSession and inspect simulated transactions through SKTestTransaction, and validate ad attribution using SKAdTestSession, SKAdTestPostback, and SKAdTestPostbackResponse. To exercise error handling, you inject failures into specific StoreKit operations with FailableStoreKitAPI conformers such as StoreKitPurchaseAPI, StoreKitLoadProductsAPI, StoreKitRefundRequestAPI, and StoreKitSubscriptionStatusAPI, surfacing conditions through SKTestError and SKAdTestError. It is available on iOS, macOS, tvOS, watchOS, and visionOS.
Simulating In-App Purchases 2
Drive and inspect simulated StoreKit purchase flows and transactions during testing.
- ClSKTestSessioniOS 14.0+An object that drives simulated StoreKit purchase flows and configures the test store environment.
- ClSKTestTransactioniOS 14.0+An object that represents a transaction created in a simulated StoreKit test session.
Testing Ad Attribution 4
Simulate SKAdNetwork ad postbacks and validate their attribution data.
- ClSKAdTestSessioniOS 15.4+An object that simulates SKAdNetwork ad postbacks so you can validate ad attribution during testing.
- ClSKAdTestPostbackiOS 15.4+An object that represents a simulated SKAdNetwork install-validation postback for testing ad attribution.
- ClSKAdTestPostbackResponseiOS 15.4+An object that captures the response a simulated ad network returns for a test postback.
- StSKAdTestPostbackVersioniOS 15.4+A type that identifies the SKAdNetwork postback version to use when generating test postbacks.
Injecting Failures 12
Force specific StoreKit operations to fail so you can exercise error-handling paths.
- PrFailableStoreKitAPIiOS 17.0+A protocol that StoreKit test APIs conform to so you can inject simulated failures into their operations.
- PrSKTestFailureiOS 17.0+A protocol that describes a simulated failure you can inject into a StoreKit operation under test.
- EnSKTestFailuresiOS 17.0+An enumeration of the StoreKit operations into which you can inject simulated failures.
- StStoreKitPurchaseAPIiOS 17.0+A failable test API that simulates failures when initiating a purchase.
- StStoreKitLoadProductsAPIiOS 17.0+A failable test API that simulates failures when loading product information.
- StStoreKitRefundRequestAPIA failable test API that simulates failures when requesting a refund.
- StStoreKitSubscriptionStatusAPIiOS 17.0+A failable test API that simulates failures when checking subscription status.
- StStoreKitManageSubscriptionsAPIiOS 17.0+A failable test API that simulates failures when presenting subscription management.
- StStoreKitOfferCodeRedeemAPIiOS 17.0+A failable test API that simulates failures when redeeming offer codes.
- StStoreKitAppStoreSyncAPIiOS 17.0+A failable test API that simulates failures when syncing transactions with the App Store.
- StStoreKitAppTransactionAPIiOS 17.0+A failable test API that simulates failures when retrieving the app transaction.
- StStoreKitVerificationAPIiOS 17.0+A failable test API that simulates failures when verifying signed StoreKit data.
Errors 2
Error types reported by simulated StoreKit and ad-testing operations.
- StSKTestErroriOS 14.0+An error reported by simulated StoreKit purchase and transaction operations.
- StSKAdTestErroriOS 15.4+An error reported by simulated SKAdNetwork ad-postback testing operations.
Type Aliases 1
- TySKANTestPostbackResponseHandler