Skip to content

Latest commit

 

History

History
378 lines (367 loc) · 66.1 KB

StoreKit.md

File metadata and controls

378 lines (367 loc) · 66.1 KB

StoreKit

Symbols: 65.4% of Apple's iOS API (825 of 1261, exact) · Rows: 47: 41 ✅ 2 🟡 4 ❌ · iOS: 3.0+

Area: Commerce & privacy · Apple: StoreKit · Issues: area:commerce

How isim implements it

  • Adapted: a local store like Xcode's StoreKit testing.
  • The ledger is in ISIM_DATA/Library/isim/StoreKit/<bundle id>/ledger.json; JWS values and receipts are signed with the device's own certificate.
  • isim storekit is the Transaction Manager.
  • Objective-C: StoreKit.framework (isim/sdk-src/Frameworks/StoreKit) declares the overlay's classes under Apple's names: SKAdNetwork, the product page and overlay, and StoreKit 1.

API

API / feature Status iOS Notes
StoreKit configuration files (.storekit selected by the scheme) ✅ ≤17 copied into the bundle by isim build; products, subscription groups, offers, _timeRate, _storefront
Product.products(for:) (id, type, display name, description, price, display price) ✅ ≤17 prices shown in USD
Product.purchase() with confirmation sheet ✅ ≤17 always succeeds when confirmed, except Ask to Buy (next row); owned non-consumables / current plan show the iOS notice
Ask to Buy (.simulatesAskToBuyInSandbox(true), SKMutablePayment.simulatesAskToBuyInSandbox, the .storekit "Enable Ask To Buy" setting, ISIM_STOREKIT_ASK_TO_BUY=1) ✅ ≤17 adapted: the purchase returns .pending (StoreKit 1: .deferred) and waits for the family organizer, `isim storekit approve
Purchase options (appAccountToken, quantity) ✅ ≤17 stored on the transaction
Transaction.currentEntitlements, all, latest(for:), currentEntitlement(for:), unfinished ✅ ≤17 all leaves out finished consumables (unless SKIncludeConsumableInAppPurchaseHistory)
Transaction.updates ✅ ≤17 unfinished transactions at launch, renewals, refunds, offer-code redemptions, Transaction Manager changes (also one made just before the app writes the ledger itself; the app and isim storekit lock the ledger file while they change it); tested (test_store, test_store_refund_during_purchase)
Transaction.finish() ✅ ≤17 unfinished transactions are delivered again at the next launch
VerificationResult ✅ ≤17 always .verified; jwsRepresentation is ES256 with the device's StoreKit testing certificate in x5c (Apple's payload fields, environment Xcode); deviceVerification = SHA-384(nonce + device ID); tested: verified with OpenSSL (test_store_billing)
AppStore.sync() (restore) ✅ ≤17 adapted: the purchase history is the device's account (outlives the app); sync applies renewals and Transaction Manager changes, re-delivers unfinished transactions, sends every status to Status.updates and signs the receipt again; no sign-in prompt (as in Xcode's local testing); tested: the app deleted and reinstalled keeps its subscription, sync (test_store_billing)
AppStore.canMakePayments ✅ ≤17
Consumables / non-consumables ✅ ≤17
Auto-renewable subscriptions: Product.SubscriptionInfo (group, period, level, group name) ✅ ≤17
Subscription status (status, Status.updates, RenewalInfo, RenewalState) ✅ ≤17 subscribed / expired / revoked / grace period / billing retry; one status per group (no Family Sharing)
RenewalInfo members: state, renewalPrice, currency, currencyCode, offer, offerPaymentModeStringRepresentation, offerPeriodStringRepresentation, eligibleWinBackOfferIDs (iOS 18), appAccountToken, appTransactionID, environmentStringRepresentation (and in jsonRepresentation) ✅ ≤17 the renewal price is the running offer's (introductory periods left) or the plan it renews into, in USD; nil when it will not renew; a lapsed subscriber's eligible win-back offers on iOS 18 and later; Advanced Commerce, bundle and commitment fields are not there; tested (HelloStore: subscribed, then expired)
AppStore.ageRatingCode ✅ 26.2 adapted: isim's local store has no App Store record, so it is what isim storekit <app> age-rating CODE set (or ISIM_STOREKIT_AGE_RATING), nil until then; tested (HelloStore under iOS 27)
Renewals on an accelerated clock ✅ ≤17 Xcode time rate from .storekit _timeRate (SKTestSession.TimeRate order; mapping unverified against Xcode) or ISIM_STOREKIT_TIME_RATE (month=4, renewal=10, names); renews while the app runs and catches up at launch
Expiration, cancel (auto-renew off), billing issues ✅ ≤17 isim storekit billing-issue makes renewals fail: billing grace period (.storekit _billingGracePeriodEnabled, key name unverified against Xcode, or ISIM_STOREKIT_BILLING_GRACE_PERIOD=1; 16 days, 6 for weekly plans, entitlement kept, gracePeriodExpirationDate), then billing retry (60 days, isInBillingRetry, expirationReason .billingError), then expiry; resolving (isim storekit resolve, the Billing Problem message) renews; tested: every step (test_store_billing), expiry and cancel (test_store)
Upgrade / downgrade / crossgrade within a group ✅ ≤17 upgrades (and same-period crossgrades) immediate, isUpgraded set; downgrades at the next renewal
Introductory offers (free trial, pay as you go, pay up front), isEligibleForIntroOffer ✅ ≤17 eligible until the first subscription in the group
Promotional offers (.promotionalOffer(...)) ✅ ≤17 from .storekit adHocOffers; the signature (ECDSA P-256 over Apple's payload, or the compact JWS; StoreKit 1 SKPaymentDiscount too) is checked against the device's subscription offers key (isim storekit offer-key), at most 24 h old, single-use nonce, app account token bound; existing and lapsed subscribers only; tested: forged, valid and JWS signatures
Win-back offers (.winBackOffer) ✅ 18.0 from winbackOffers; eligible only after a lapsed subscription; iOS 18+: the win-back message (Message.Reason.winBackOffer, isim's sheet or the app's Message.messages), SubscriptionStoreView shows the offer, preferredSubscriptionOffer; tested: sheet purchase reaches Transaction.updates, deferred by a listener, the store view, none under iOS 17 (test_store_winback_ios17)
Offer codes (presentOfferCodeRedeemSheet, offerCodeRedemption) ✅ ≤17 redeem sheet; codes are the .storekit codeOffers reference names / IDs; eligibility (new / existing / expired), each offer once, a current subscriber's offer starts at the next renewal; iOS 18+: codes for one-time products; tested: invalid, new, existing, already redeemed, non-consumable
Refunds (beginRefundRequest, refundRequestSheet), revocationDate / revocationReason ✅ ≤17 refund sheet; local requests are approved at once; revoked transactions arrive in Transaction.updates
showManageSubscriptions, manageSubscriptionsSheet ✅ ≤17 iOS-style sheet: status, change plan, cancel
StoreKit views (StoreView, ProductView, SubscriptionStoreView) ✅ ≤17 iOS-like look; product view styles compact/regular/large and app-defined (makeBody(configuration:)); storeButton (incl. .policies), subscriptionStorePolicyDestination (URL or view), control styles (automatic/picker, prominent picker, compact picker, buttons), subscriptionStoreButtonLabel, preferredSubscriptionOffer, onInAppPurchaseCompletion/Start, subscriptionStatusTask, currentEntitlementTask; prefersPromotionalIcon uses the icon, as in Xcode's local testing (promotional images come from App Store Connect); tested: buttons + multiline label + policies + win-back offer, a custom product style
AppTransaction ✅ ≤17 adapted: original app version = CFBundleVersion at the first launch on this device's account; environment .xcode; signed with the device's StoreKit testing certificate; deviceVerification = SHA-384(nonce + deviceVerificationID), originalPlatform; tested: JWS verified with OpenSSL, device verification
SKStoreReviewController.requestReview, @Environment(\.requestReview) ✅ ≤17 development-style rating card, at most 3 times per 365 days; nothing sent
StoreKit 1 (SKProductsRequest, SKProduct/SKProductDiscount, SKPaymentQueue, observers, finishTransaction, restore) ✅ ≤17 shares the StoreKit 2 ledger; renewals reach the observer. price is Foundation's NSDecimalNumber (until 0.21 a StoreKit stand-in class; Swift apps using it must be rebuilt)
StoreKit 1 from Objective-C (SKProductsRequest / SKProductsResponse / SKRequestDelegate, SKProduct / SKProductDiscount / SKProductSubscriptionPeriod, SKPayment / SKMutablePayment, SKPaymentTransaction, SKPaymentQueue addPayment: / finishTransaction: / restoreCompletedTransactions, SKErrorDomain / SKErrorCode, SKReceiptRefreshRequest, SKStoreReviewController, NSBundle.appStoreReceiptURL) ✅ ≤17 adapted: the Swift overlay's classes under Apple's Objective-C names and selectors (StoreKit.framework); Objective-C delegates and observers are wrapped for the Swift protocols. SKPaymentDiscount is an NSObject subclass with Apple’s initializer and NSNumber timestamp (Swift apps built with isim 0.23 or earlier that use it or paymentDiscount must rebuild for 0.24); paymentDiscount supports signed promotional offers. Not yet from Objective-C: downloads. Tested (HelloStoreObjC: products, purchases with the confirmation sheet, an unknown product failing, restore, receipt refresh, the review prompt, signed and forged promotional offers in test_store_objc_promotional_offer)
App receipt (Bundle.main.appStoreReceiptURL, SKReceiptRefreshRequest) ✅ ≤17 adapted, like Xcode's local receipts: PKCS #7 SignedData with Apple's ASN.1 receipt fields (bundle ID, versions, opaque value, SHA-1 hash with identifierForVendor, in-app purchases), signed with the device's StoreKit testing certificate (validate against isim storekit certificate instead of Apple's root); refresh properties expired / volume purchase; tested: openssl cms -verify, fields and hash
SKOverlay, SKStoreProductViewController ✅ ≤17 adapted: the app's listing (name, developer, icon, rating, price, description) from Apple's public lookup API (ISIM_APPSTORE_LOOKUP_URL overrides it); unknown apps fail (loadProduct completion, storeOverlay(_:didFailToLoadWithError:)); overlay slides in with the delegate's transition calls; installing is unavailable on isim (GET says so); tested with a lookup fixture
Transaction Manager (refund, expire, cancel, clear) ✅ ≤17 isim storekit <app> list|refund|expire|cancel|resume|billing-issue|resolve|delete|clear, isim storekit certificate|offer-key; the running app picks changes up within 0.5 s; isim storekit <app> purchase-intent PRODUCT [OFFER] starts a purchase as the App Store would, isim storekit <app> promotions prints the promotion order and visibility; `approve
SKAdNetwork (updatePostbackConversionValue with coarse values and lockWindow, startImpression / endImpression, SKAdImpression) ✅ ≤17 adapted: no ad-driven installs, nothing is sent to ad networks. Values checked like iOS (fine 0–63: SKANError.invalidConversionValue; coarse low / medium / high), locking closes one of the three conversion windows (time compressed: a window stays open until locked), impressions checked and recorded; shared with AdAttributionKit and recorded in the device data. Tested: test_ad_attribution
SubscriptionStoreView store content (iOS 18): StoreContent, StoreContentBuilder, TupleStoreContent, SubscriptionOptionGroup (all its initializers; AutomaticSubscriptionOptionGroupLabel), SubscriptionOptionGroupSet, SubscriptionOptionSection, SubscriptionOptionGroupStyle (.automatic, .tabs, .links), subscriptionStoreOptionGroupStyle, the store content modifiers (subscriptionStoreOptionGroupStyle, subscriptionStoreButtonLabel, storeButton, subscriptionStoreControlStyle), SubscriptionStoreContentView ✅ 18.0 adapted: the content resolves into option groups (a segmented control of tabs, or a list of links that open each group with a back button; automatic is tabs) and sections (a header or title, the plans, a footer); plans in no group are not shown once there are groups; if/else content uses StoreKit's own _ConditionalStoreContent (iOS: SwiftUI's _ConditionalContent, which isim keeps for views only); tested (HelloStore: tabs, links by billing period, sections; test_store_ios18_views)
SubscriptionStoreView(groupID:visibleRelationships:), Product.SubscriptionRelationship (.all, .upgrade, .downgrade, .crossgrade, .current) ✅ ≤17 a subscriber sees the plans of those relationships to their current plan (by group level); before subscribing, every plan; tested (HelloStore: upgrades only)
Custom subscription store controls (iOS 18): SubscriptionStoreControlStyle.makeBody(configuration:), SubscriptionStoreControlStyleConfiguration (options, sections, groupDisplayName, autoRenewPreference, allOptions, descriptionVisibility; Option with subscribe() and dynamic member lookup, PickerOption, Section, Icon), SubscriptionStorePicker (all four initializers) 🟡 18.0 adapted: the options are the page's plans with the offer the store shows; subscribe() buys like the store's button; SubscriptionStorePicker draws one row per plan (the app's, or a checkmark row) and the confirmation for the selected plan; plan icons are nil; Placement, the SubscribeButton / SubscriptionPicker typealiases and the paged pickers are not there yet; tested (HelloStore: a custom picker that subscribes)
SubscriptionOfferView (all its initializers), SubscriptionOfferViewStyle (.automatic, .compact, custom), SubscriptionOfferViewStyleConfiguration (visibleSubscription, activeOffer, icon, state, subscribe(), displayDetails()), subscriptionOfferViewStyle, ProductIconPhase, Product.CollectionTaskState 🟡 26.0 adapted: a card with the plan (a group's first plan of the relationship that is not the current one, or the given plan), its offer (introductory, or win-back for a lapsed subscriber) or price, and a subscribe button; tapping it opens the group's subscription store; products have no promotional icons (ProductIconPhase.unavailable); subscriptionStatus is empty; tested (HelloStore under iOS 26 and 27)
Product.PromotionInfo (currentOrder, updateProductOrder(byID:), visibility, updateProductVisibility(_:for:), update(), updateAll(_:)) ✅ ≤17 adapted: kept with the app's local StoreKit data (isim storekit <app> promotions lists them); currentOrder is empty until the app sets an order; unknown products are refused (StoreKitError.unknown); tested (HelloStore)
PurchaseIntent (intents, product, id, offer on iOS 18), StoreKit 1 paymentQueue(_:shouldAddStorePayment:for:) ✅ ≤17 adapted: isim storekit <app> purchase-intent PRODUCT [OFFER] stands in for the customer starting a promoted purchase on the App Store; the app gets it while it listens (PurchaseIntent.intents) or has a StoreKit 1 observer (which decides whether the payment goes on the queue); intents wait for the app until then; tested (HelloStore: an intent completed with purchase())
ExternalPurchase (canPresent, presentNoticeSheet(), NoticeResult) ✅ ≤17 adapted: allowed with the com.apple.developer.storekit.external-purchase entitlement and the storefront's country in SKExternalPurchase (else notEntitled); isim's rendition of iOS's disclosure sheet (Continue / Cancel); Continue gives a token shaped like Apple's (base64 JSON) but isim's own, marked isimSimulated, not verifiable by Apple. ISIM_STOREKIT_EXTERNAL_NOTICE=continue|cancel answers without a sheet. Tested (HelloExternalPurchase, test_storekit_external.py)
ExternalPurchaseLink (canOpen, open(), eligibleURLs, open(url:)) ✅ ≤17 adapted: the …external-purchase-link entitlement and the storefront's URL in SKExternalPurchaseLink (multi links: …-link-streaming and SKExternalPurchaseMultiLink); the notice, then the URL opens in the browser. Tested (HelloExternalPurchase)
Types not yet in isim (iOS 17 and earlier) ❌ ≤17 not implemented, found by the 2026-10 sweep: ExternalLinkAccount, PaymentMethodBinding, SKCloudServiceController, SKCloudServiceSetupViewController, SKProductStorePromotionController, SubscriptionStoreControlBackground (6 types; with their members under "Not yet in isim")
ExternalPurchaseCustomLink (isEligible, token(for:) with TokenType or a string, showNotice(for:) / showNotice(type:), Token, NoticeResult, NoticeType, ExternalPurchaseType) ✅ 18.1 adapted: eligible with a StoreKit external purchase entitlement and the storefront's country in SKExternalPurchaseCustomLinkRegions (isim does not check which entitlement Apple requires for custom links); tokens as for ExternalPurchase (WITHIN_APP / OUT_OF_APP, or the string given), nil when not eligible; the same notice sheet. The ineligible case is tested (HelloExternalPurchase)
Types not yet in isim (iOS 18) ❌ 18.0 not implemented, found by the 2026-10 sweep: AdvancedCommerceProduct, SubscriptionPeriodGroupSet, SubscriptionStoreButton, SubscriptionStoreControlPlacement, SubscriptionStorePickerOption (5 types; with their members under "Not yet in isim")
Types not yet in isim (iOS 26) ❌ 26.0 not implemented, found by the 2026-10 sweep: StoreDownloaderExtension, SubscriptionOfferViewButtonKind (2 types; with their members under "Not yet in isim")
Types not yet in isim (iOS 27) ❌ 27.0 not implemented, found by the 2026-10 sweep: RedeemOption (1 type; with its members under "Not yet in isim")

Not yet in isim

436 symbols Apple documents for iOS that isim does not have (exact; Apple snapshot 2026-10-14). Each links to Apple's documentation.

List