Implements Premium unlock via expo-iap with a PurchasePort: saved entitlement, paywall states, restore, refunds, and store testing. Use when touching IAP, buy, restore, paywall, or Premium state.
Ships in react-native. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Sells one non-consumable "Premium" honestly, on iOS and Android, with no server by default: the store verifies on the device, Premium is saved before a transaction is finished, only explicit evidence ever revokes it, every paywall state is reachable and tested, and two scripts prove it on the app's own code.
premium.getState().grantPremium(...) (synchronous, written
to the entitlements table) returns ok -> the paywall's finish-purchase -> port.finish(tx).
Never finish first, never auto-finish, and never finish when the grant failed: the paywall shows
save-failed and the transaction stays open. The re-check and the restore finish every owned
Android purchase marked isUnfinished once its grant returned ok. Why: StoreKit re-delivers an
unfinished transaction at the next launch, so the save is retried; a finished but unsaved purchase
is lost for good, and Google refunds a purchase left unacknowledged for 3 days.revokePremium(revokedAtMs); the reducer ignores a revoke without
a positive date). Absence, read errors and offline keep the saved Premium. Why: a fresh purchase
can be briefly missing from the store's list. On Android a refund only removes the purchase from
the list (no revocation date), so without a server Premium stays after an Android refund: that is
the honest default (see the server profile in references/store-and-adapter.md).startPremium subscribes to purchase events before it connects, then loads the
price, then re-checks silently through getAvailablePurchases({ onlyIncludeActiveItemsIOS: false })
(iOS Transaction.all). Why: the store replays unfinished and approved Ask to Buy transactions
right after connecting, and only Transaction.all still shows refunds.restore-failed; restore-empty only after a successful sync with no evidence, never for someone who owns Premium;
a restore whose save failed is save-failed. Why: telling a payer "no purchase found" because
the network failed is the worst answer.expo-iap is pinned exactly (5.8.0, the stack table), imported only by
src/services/purchase/expo-iap-purchase-adapter.ts with its allowlist, and the plugin entry is
the bare string 'expo-iap'. No useIAP, no auto-finishing, ever; no server API (kitApi,
KitApiError, verifyPurchase, verifyPurchaseWithProvider), plugin option or store switch
(Onside, Horizon, Fire OS, Vega, alternative billing, their EXPO_IAP_* variables) unless
contracts/in-app-purchases.json opts in. Why: they add a server or another billing SDK, or hide
the finishing order.StoreFailure; none rejects. The adapter wraps each
vendor call in attemptAsync; the service reads .ok. Why: a rejection escaping the adapter
skips the order above (error-handling-typed-results' adapter boundary).productId (naming-conventions'
product-id grammar, valid on both stores), the PREMIUM_PRODUCT_ID constant and every StoreKit
configuration agree. Price point, base territory and Family Sharing are the developer's decisions
in the contract (Family Sharing off by default: once on it can never be turned off); the StoreKit
file and the App Store Connect script read them, never a typed value. Why: product ids can never
be reused, and a second copy of a decision drifts.withConnectivity(createExpoIapPurchaseAdapter(), connectivity.isOnline) where
it is created; connectPremiumReloads reloads the store on a connectivity change (and re-checks once
back online) and re-checks on every return to the foreground. Store error texts are never shown.
Why: StoreKit returns [] instead of throwing, startPremium runs before the first network
report, and a simulated-offline switch reaches the store only through ConnectivityPort.displayPrice, unchanged (storePriceText; no text means "store
unavailable"); catalogs use {priceText}; never type a price into code or catalogs, never rebuild
it from the numeric price. Why: every storefront has its own price point and currency, and it
is the text the purchase sheet shows (value-objects-money-and-units states the same rule).selectIsPremium (ads pass it to
AdsProvider as isPremium, admob-ads-and-consent). The entitlements table is never in a data backup
or restore (data-export-and-restore excludes it); a new device gets Premium back through Restore.
Why: one path keeps ads, Settings and the paywall in step, a stray grant gives Premium away, and
an editable backup file would grant it too (entitlement-writers, port-callers).get-task-allow, *.storekit
and *.xctest never ship, StoreKit test code never enters src/, and the StoreKit flows live in
.maestro/storekit/, outside the normal E2E folders. Why: get-task-allow in a store build is a
rejection, and an unarmed build would fail those flows.maestroGlobalArgs (the simulator's UDID and its own driver port), Metro gets its own
port, never --udid alone. Why: other sessions share the Mac, and StoreKit answers the launch
re-check only after its transaction-cache sync (28 s measured).upsellPrice); Restore is reachable from the paywall and Settings. Why: App Review requires a
restore mechanism, and a pop-up after a failure or a line on every screen reads as a trap.npm install -E [email protected] (verified on 2026-10-10; re-verify with npm view expo-iap version)
and add the bare 'expo-iap' to the app.config.ts plugins. Copy templates/contracts/ and fill
in the developer's decisions (ask for the price point, territory and Family Sharing; never guess):
replace __PRODUCT_ID__ and __PRICE__ in the contract first, then the same values in
src/config/purchase-products.ts (step 2) and scripts/storekit/Premium.storekit (step 6).templates/src/services/purchase/,
templates/src/stores/premium/, templates/src/stores/paywall/,
templates/src/data/entitlements/, templates/src/config/purchase-products.ts,
templates/test/, templates/__mocks__/expo-iap.ts. Prerequisites: src/core/result.ts, the data
layer with the entitlements table (persistence-and-migrations), ConnectivityPort
(networking-and-server-state). Add entitlements: createSqliteEntitlementRepository(...) to
AppData and keep entitlements in contracts/persistence.json protectedTables. The premium
store persists, so an app whose only persisting store was settings now needs
state-management-zustand's contracts/stores.json: add it when missing. Copy
templates/src/stores/premium/upsell-line.ts (+ test) only when the app shows an in-context upsell.connectivity and the gated
purchase port to the composition root as in
examples/create-device-services.ts (fakes in
create-test-services.ts), then render the startup piece of
examples/purchase-root.tsx inside AppRoot: openPurchaseStores in a
useState initializer, startPremium after the first frame (never awaited, its unsubscribe
dropped even when the effect was cleaned up first), connectPremiumReloads right after it,
PurchaseStoresProvider around the root stack, as one wrapper so AppRoot stays within
react/jsx-max-depth. Build the paywall screen with screen-contracts: a
thin route (src/app/(app)/paywall.tsx), a model hook reading paywallView, paywallNotice and
selectIsPremium, and the contract's test IDs. Give every catalog the contract's keys.npx jest src/services/purchase src/stores/premium src/stores/paywall test/sqlite/sqlite-entitlement-repository.test.ts scripts/asc scripts/storekit --ci --maxWorkers=2.node ${CLAUDE_SKILL_DIR}/scripts/check-purchases.mjs . and
node ${CLAUDE_SKILL_DIR}/scripts/check-purchase-behaviour.mjs .; fix every FAIL line (each rule,
contract key and expected SKIP line is in references/checks.md) and rerun
until both print RESULT: PASS. Run state-management-zustand's and naming-conventions' checkers too
(list storekit in contracts/naming.json extraE2eFolders and in e2e-maestro's
contracts/e2e.json manualFolders, without startsOutside).templates/scripts/storekit/ and
templates/.maestro/storekit/, with templates/scripts/e2e/ when the repo lacks it (they also need
e2e-maestro's debug sub-flow). Add premium=0|1 and open=paywall to the debug-link registry
with its test-only Premium handler, as examples/debug-premium-link.ts
shows (debug-menu-and-test-hooks' template has neither). Run the harness on a throwaway simulator
of your own (<project>-storekit), then the Android license-tester run, in the release-day order.templates/scripts/asc/ and run
node scripts/asc/create-premium-iap.ts <bundleId> only after they said yes; create the Play
product by hand. Then ask for the Tier 3 runs and report the results in plain words.expo-iap is exactly 5.8.0, imported only by the adapter; the plugin entry is the bare string; no banned API, option or switch outside a contract opt-in.save-failed and finishes nothing; pending shows "waiting for approval" and an approval later turns Premium on without a tap.restore-failed after a failed sync and restore-empty only after a successful one; refunds revoke only with a date.PREMIUM_PRODUCT_ID and every StoreKit configuration agree on the product, price point, territory and Family Sharing.*.storekit, *.xctest or get-task-allow, and the Tier 3 runs passed.node ${CLAUDE_SKILL_DIR}/scripts/check-purchases.mjs . and node ${CLAUDE_SKILL_DIR}/scripts/check-purchase-behaviour.mjs . both print RESULT: PASS. Expected SKIP lines while adopting: src/i18n/catalogs [catalog-keys] (i18n-strings-and-catalogs creates it), the paywall folder [state-testids] (screen-contracts creates it), .maestro/subflows/debug-setup.yaml [harness-subflow] (e2e-maestro creates it). An app that sells nothing prints NOT APPLICABLE.restore-failed.useIAP or verifyPurchase "for simplicity". They hide finishing or call a server; the adapter template is the whole integration.{ iapkitApiKey } or any options object. Even an empty object fails the check; use 'expo-iap'.{priceText} and storePriceText.product.price with style: 'currency'. It can disagree with the purchase sheet; show displayPrice.getAvailablePurchases() with the default active-only list. Refunds disappear from it; pass onlyIncludeActiveItemsIOS: false.grantPremium writes, then publishes.launchApp: { clearState: true } or a short wait in a StoreKit relaunch flow. Uninstalling clears the test transactions, and StoreKit answers only after its sync; keep the 60 s waits..maestro/flows/. The normal E2E run would run it against an unarmed build.| File | What it is | Read/run when |
|---|---|---|
| references/store-and-adapter.md | The default model and the server profile, the StoreKit and Play Billing facts, version and plugin, bans, PurchasePort, adapter facts, error codes, re-verify, multi-package | Workflow step 1, before touching the adapter |
| references/paywall-states.md | Entitlement store and table, paywall flow and actions, the state table (views, test IDs, keys), notices, service order, wiring and routes, edge cases, price display, entry points | Workflow step 3, on any state change |
| references/testing-tiers.md | Tier 1 Jest, the StoreKit harness (facts, files, scenarios, commands, gotchas), Android license testers and Play Billing Lab, Tier 3, release-day order | Workflow steps 4 and 6 |
| references/store-consoles.md | Product rules, price, Family Sharing, the App Store Connect script and its remaining steps, Play Console, human steps | Workflow step 7 |
| references/checks.md | Every checker rule, the contract keys, config keys and expected SKIP lines | Workflow step 5, when a FAIL line needs context |
| examples/create-device-services.ts | The composition root with ConnectivityPort and the gated purchase port (the one place that creates the adapter) | Workflow step 3, as the model |
| examples/purchase-root.tsx | The startup piece AppRoot renders: stores, deps, start, reloads, provider | Workflow step 3, as the model |
| examples/debug-premium-link.ts | The debug-link registry entries (premium, open=paywall), the contract rows and the test-only Premium handler | Workflow step 6, before the StoreKit flows |
templates/src/services/purchase/ | Port, expo-iap adapter, fake (+ test), connectivity gate (+ test), evidence (+ test), service (+ test), store flow, reloads (+ test), storePriceText (+ test) | Workflow step 2 |
templates/src/stores/premium/ | Entitlement reducer, cases table (+ test), selectors, store (+ test), openPurchaseStores (+ test, the one caller of both factories), PurchaseStoresProvider (+ test), optional upsell-line.ts (+ test) | Workflow step 2 |
templates/src/stores/paywall/ | Paywall state, transitions (+ test), reducer, cases table (+ test), view, notice, memory-only store (+ test) | Workflow step 2 |
templates/src/data/entitlements/ | EntitlementRepository port, the SQLite repository, the fake | Workflow step 2 |
templates/src/config/purchase-products.ts | PREMIUM_PRODUCT_ID, equal to the contract | Workflow step 2 |
templates/test/ | purchase/create-premium-test-deps.ts (service over real stores and fakes), sqlite/sqlite-entitlement-repository.test.ts; synced SQLite test drivers and flush-microtasks.ts | Workflow steps 2 and 4 |
templates/contracts/ | in-app-purchases.json (the developer's decisions and the paywall's keys and test IDs) and its schema | Workflow step 1 |
templates/scripts/storekit/ | Premium.storekit, storekit-harness.entitlements, ArmTests.swift, add-harness.rb, storekit-harness.ts, busy-note.ts (+ test) | Workflow step 6 |
templates/.maestro/storekit/ | The seven StoreKit Tier 2 flows | Workflow step 6 |
templates/scripts/asc/ | Contract reader, payloads (+ test, including the exact bundle-id match), create-premium-iap.ts; the JWT (+ test), credentials and client are the canonical shared copies (ios-release-testflight owns them) | Workflow step 7 |
templates/__mocks__/expo-iap.ts | The canonical root mock (real ErrorCode, no server APIs), synced from the library (do not edit here) | When the repo lacks it |
templates/src/services/connectivity/ | The canonical ConnectivityPort, expo-network adapter, reachability hub and fake with tests (networking-and-server-state's, synced; do not edit here) | When the repo lacks them |
templates/src/core/ | The canonical result.ts with its test (synced; do not edit here) | When the repo lacks it |
templates/src/data/sql-driver.ts | The canonical SqlDriver port (synced; do not edit here) | When the repo lacks it |
templates/src/services/error-log/ | The canonical ErrorLogPort and its fake with a test (synced; do not edit here) | When the repo lacks them |
templates/scripts/clock/ | The canonical tooling wall clock with its test (synced; do not edit here) | When the repo lacks it |
templates/scripts/e2e/ | The canonical maestro-args.ts (Maestro device binding for the StoreKit harness) with its test (ios-simulator-build's, synced; do not edit here) | Workflow step 6, when the repo lacks it |
assets/purchase-facts.json | Pinned version, adapter allowlist, banned APIs and config words, harness facts | Read by the checkers; update on an upgrade |
assets/template-placeholders.json | Sample values for __PRODUCT_ID__ and __PRICE__ | When verifying templates |
assets/shared.json | Declares the synced files | When adding a shared file |
scripts/check-purchases.mjs | Static checks (21 rules + one SKIP-only) | Workflow step 5 |
scripts/check-purchase-behaviour.mjs | Runs the app's purchase modules and the adapter against a scripted expo-iap (19 rules) | Workflow step 5 |
scripts/lib/purchase-repo.mjs | Layout paths, adoption and NOT APPLICABLE facts, contract reader | Read only to change a checker |
scripts/lib/module-stubs.mjs | Resolves expo-iap to the stand-in while the behaviour check imports the app | Read only to change a checker |
scripts/lib/stubs/expo-iap.mjs | The scripted expo-iap 5.8.0 stand-in (update ErrorCode on an upgrade) | On an expo-iap upgrade |
scripts/lib/source-scan.mjs | Shared import and code scanning, synced from the library (do not edit here) | Never by hand |
scripts/lib/app-modules.mjs | Shared loader of the app's TypeScript in Node, synced from the library (do not edit here) | Never by hand |
scripts/check-lib.mjs | Shared script helper, synced from the library (do not edit here) | Never by hand |
scripts/selftest.mjs | Proves both checkers on the templates and every planted bug | After changing a checker, a template or a fixture |
tests/ | bases/app, bases/bare and the overlay fixtures of both checkers | When adding a rule |
admob-ads-and-consent - ads turn off for Premium; it reads selectIsPremium.state-management-zustand - the store pattern behind grantPremium and the paywall store.persistence-and-migrations - the entitlements table, its migration and its protection from resets.networking-and-server-state - ConnectivityPort and, for the server profile, the ApiClient port.error-handling-typed-results - Result, attemptAsync and the adapter boundary.screen-contracts - the paywall screen that renders the state table.i18n-strings-and-catalogs - the paywall texts in every locale.naming-conventions - the product-id grammar and the extraE2eFolders entry.debug-menu-and-test-hooks - the debug deep link the flows use; the app adds premium and open=paywall to it (the screen parameter is open; its contract refuses screen).value-objects-money-and-units - Money from the store's double, and formatMoney when digits follow an in-app setting.e2e-maestro - Maestro, the debug sub-flow and the device binding.ios-simulator-build - simulators and scripts/e2e/maestro-args.ts.privacy-and-store-declarations - the network and SDK audit of a release.ios-release-testflight - signing, the store-artifact gate and TestFlight.assets/purchase-facts.json (opens in a new tab)assets/shared.json (opens in a new tab)assets/template-placeholders.json (opens in a new tab)examples/create-device-services.ts (opens in a new tab)examples/debug-premium-link.ts (opens in a new tab)examples/purchase-root.tsx (opens in a new tab)references/checks.md (opens in a new tab)references/paywall-states.md (opens in a new tab)references/store-and-adapter.md (opens in a new tab)references/store-consoles.md (opens in a new tab)references/testing-tiers.md (opens in a new tab)scripts/check-lib.mjs (opens in a new tab)scripts/check-purchase-behaviour.mjs (opens in a new tab)scripts/check-purchases.mjs (opens in a new tab)scripts/lib/app-modules.mjs (opens in a new tab)scripts/lib/module-stubs.mjs (opens in a new tab)scripts/lib/purchase-repo.mjs (opens in a new tab)scripts/lib/source-scan.mjs (opens in a new tab)scripts/lib/stubs/expo-iap.mjs (opens in a new tab)scripts/selftest.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/react-native:in-app-purchasesfrom react-native
npx claudepluginhub zakariaf/reactnative-skills --plugin react-native73 skills in this plugin
/accessibility-as-codeEnforces a11y labels, 44pt targets, 200% text, VoiceOver, TalkBack. Use when adding a pressable, swipe or a11y label, text clips when large, contrast fails or Reduce Motion is missed. Not for RTL (rtl-and-direction)./adaptive-layoutLays screens out by window, not device: breakpoints, master-detail panes, readable widths, grids. Use when making screens responsive or for tablets, iPad, foldables, rotation, split screen, orientation lock. Not for tab bars (navigation-and-routing)./admob-ads-and-consentBuilds AdMob ads behind a port - banners, interstitials, rewarded, UMP consent then ATT, pacing, ADS_MODE test IDs. Use when touching ads, consent, ATT, ad IDs or rewarded perks. Not for purchases (in-app-purchases)./analytics-and-consentGates analytics on opt-in consent: no SDK before a yes, typed events without personal data, ATT. Use when adding analytics, events, screen views or a usage-data toggle. Not for crashes (crash-reporting-and-observability)./android-emulator-buildAssembles Release APKs with Gradle on an AVD started by name (pinned JDK and SDK) and inspects them. Use when trying the app on the Android emulator, or Gradle, adb, an AVD or the SDK fails. Not for Play uploads (android-release-play)./android-release-playShips Android App Bundles to Google Play: upload key, Play App Signing, AAB gate, versionCode, tracks, rollout. Use when releasing or signing for Play, or an upload, rollout or version code fails. Not for eas.json (eas-build-and-submit).Other plugins' skills for the same job