Local Testing with a .storekit File
Develop and QA the purchase and restore flows offline with a bundled StoreKit configuration file, without a backend or a real account.
Local testing runs OnsideKit fully offline against a bundled .storekit configuration file. Products come from the file, login is automatic and fake, and purchases and restores run against a local simulation — no backend, no registered app, and no real Onside account.
For an offline login flow, leave Onside.externalLoginDelegate unset and choose .local through OnsideDelegate.onsideLoginMethod(). An external delegate can start a real session request even when a .storekit file is configured; .auto can still attempt the store-app handoff. See Authentication.
Enable it
Add a StoreKit configuration file to your app target — for example
LocalProducts.storekit. (Xcode can create one via File → New → File → StoreKit Configuration File.)Pass its base name (no extension) to
initialize:
Onside.initialize(storeKitConfigurationName: "LocalProducts")When storeKitConfigurationName is nil (the default), the SDK runs normally against the live backend. The choice is fixed at the first initialize call.
On success the SDK logs:
[Onside]: ✅ Initialized for local testing with N product(s) from LocalProducts.storekitHow it behaves
Products come from the
.storekitfile.makeProductsRequestreturns the configured products, matched by identifier.Local login uses a synthetic session with no phone verification. With external login disabled and
.localselected, no store-app handoff or external session request is needed. The storefront country is the one you set in the file (see_storefrontbelow).logout()still clears it.Purchases present a fake Apple-Pay-style sheet (no real charge) and complete the transaction through the normal payment queue. Restorable products (non-consumables and subscriptions) are remembered locally; re-buying one shows an "already purchased" alert.
Restore replays the locally remembered purchases.
Limits of the simulation
Local product responses do not apply external-profile filtering, so unsupportedProductIdentifiers is always empty. Local testing does not verify real external-account restrictions, server authentication, Apple Pay processing, or receipt delivery. Exercise those using a real service session.
Not supported in local testing
Two APIs require a real account and return a dedicated error:
Onside.presentPaymentMethodsManager(completion:)→.notSupportedInLocalTestingOnside.makeSignedInAppsHistoryRequest()→.notSupportedInLocalTesting
Reset between runs
This clears the locally remembered purchase history so you can simulate a fresh install — restorable products are forgotten and re-buying one shows the full payment sheet again. It does not clear the fake login or the parsed products.
The .storekit file
OnsideKit reads a subset of Apple's StoreKit configuration format.
Supported fields
products[]:productID,referenceName,type(Consumable→ consumable; anything else → non-consumable),displayPrice,localizations[].subscriptionGroups[]:id,name,localizations[],subscriptions[].subscriptions[]:productID,referenceName,type,displayPrice,recurringSubscriptionPeriod(ISO-8601 duration, e.g.P1M),localizations[].localizations[]:locale,displayName,description.settings:_locale(preferred localization, defaulten_US) and_storefront(the testing storefront/country code — set this explicitly).
Last updated
Was this helpful?