TechnologiesCommerce, Payments & Ads

StoreKitTest

iOSmacOStvOSwatchOSvisionOS

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.

  • Cl
    SKTestSessioniOS 14.0+
    An object that drives simulated StoreKit purchase flows and configures the test store environment.
  • Cl
    SKTestTransactioniOS 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.

  • Cl
    SKAdTestSessioniOS 15.4+
    An object that simulates SKAdNetwork ad postbacks so you can validate ad attribution during testing.
  • Cl
    SKAdTestPostbackiOS 15.4+
    An object that represents a simulated SKAdNetwork install-validation postback for testing ad attribution.
  • Cl
    SKAdTestPostbackResponseiOS 15.4+
    An object that captures the response a simulated ad network returns for a test postback.
  • St
    SKAdTestPostbackVersioniOS 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.

  • Pr
    FailableStoreKitAPIiOS 17.0+
    A protocol that StoreKit test APIs conform to so you can inject simulated failures into their operations.
  • Pr
    SKTestFailureiOS 17.0+
    A protocol that describes a simulated failure you can inject into a StoreKit operation under test.
  • En
    SKTestFailuresiOS 17.0+
    An enumeration of the StoreKit operations into which you can inject simulated failures.
  • St
    StoreKitPurchaseAPIiOS 17.0+
    A failable test API that simulates failures when initiating a purchase.
  • St
    StoreKitLoadProductsAPIiOS 17.0+
    A failable test API that simulates failures when loading product information.
  • St
    StoreKitRefundRequestAPI
    A failable test API that simulates failures when requesting a refund.
  • St
    StoreKitSubscriptionStatusAPIiOS 17.0+
    A failable test API that simulates failures when checking subscription status.
  • St
    StoreKitManageSubscriptionsAPIiOS 17.0+
    A failable test API that simulates failures when presenting subscription management.
  • St
    StoreKitOfferCodeRedeemAPIiOS 17.0+
    A failable test API that simulates failures when redeeming offer codes.
  • St
    StoreKitAppStoreSyncAPIiOS 17.0+
    A failable test API that simulates failures when syncing transactions with the App Store.
  • St
    StoreKitAppTransactionAPIiOS 17.0+
    A failable test API that simulates failures when retrieving the app transaction.
  • St
    StoreKitVerificationAPIiOS 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.

  • St
    SKTestErroriOS 14.0+
    An error reported by simulated StoreKit purchase and transaction operations.
  • St
    SKAdTestErroriOS 15.4+
    An error reported by simulated SKAdNetwork ad-postback testing operations.

Type Aliases 1

  • Ty
    SKANTestPostbackResponseHandler

Extends 1

Product
← Commerce, Payments & Ads