axiom-implement-iap
- Repo stars 977
- Forks 74
- License MIT
- Author updated Jun 15, 2026, 03:09 AM
- Author repo Axiom
- Domain
- Engineering
- Compatible agents
-
- Claude Code
- Cursor
- Cline
- Codex
- Windsurf
- Gemini CLI
- +20
- Trust score
- 94 / 100 · audit passed
- Author / version / license
- @CharlesWiltgen · MIT
- Token usage
- Lean
- Setup complexity
- Plug-and-play
- External API key
- Not required
- Operating systems
- Unspecified (assume cross-platform)
- Runtime requirements
- No special requirements
- Permissions
-
- Read-only
- Write / modify
- Network behavior
- Local-only
- Install commands
- 26 variants
Profile is derived at build time from SKILL.md and install vectors. Subject to drift from author intent.
Heads up: 未限定 allowed-tools,默认拥有全部工具权限。
---
name: axiom-implement-iap
description: Use when the user wants to add in-app purchases, implement StoreKit 2, or set up subscriptions.…
category: engineering
runtime: no special runtime
---
# axiom-implement-iap output preview
## PART A: Task fit
- Use case: Use when the user wants to add in-app purchases, implement StoreKit 2, or set up subscriptions. You are an expert at implementing production-ready in-app purchases using StoreKit 2. runs entirely locally. Works with Claude Code, Cursor, Cline and 23 more..
- Inputs: target material, constraints, expected output, and acceptance criteria.
- Evidence boundary: follow “Your Mission / Phase 1: Gather Requirements / Phase 2: Create StoreKit Configuration (FIRST!)” and do not present inference as author intent.
## PART B: Execution result
- **01** The card summarizes the use case; runtime output centers on “Use when the user wants to add in-app purchases, implement StoreKit 2, or set up subscriptions. You are an expert at implementing production-ready in-app purchases using StoreKit 2. runs entirely locally. Works with Claude Code, Cursor, Cline and 23 more.”.
- **02** When the source has headings, the agent prioritizes “Your Mission / Phase 1: Gather Requirements / Phase 2: Create StoreKit Configuration (FIRST!)” so the result follows the author’s structure.
- **03** Typical output includes task judgment, concrete steps, required commands or file edits, validation, and follow-up options.
- **04** Risk context follows the fingerprint: read files, write/modify files; mostly runs locally; usually needs no extra API key.
## Running Rules
- read files, write/modify files; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding scope.
- Return the result, validation criteria, and next iteration options. The source does not require a stable slash command. After installation, invoke the skill by name and describe the task.
Name target files or source material, expected output, forbidden changes, and whether network or shell access is allowed. Permission fingerprint: read files, write/modify files.
Start with a small task and check whether the result follows “Your Mission / Phase 1: Gather Requirements / Phase 2: Create StoreKit Configuration (FIRST!)”. Inspect diffs, logs, previews, or tests before expanding scope.
Confirm the final output includes a concrete result, evidence, and next action. If it stays generic, tighten inputs, boundaries, and acceptance criteria.
---
name: axiom-implement-iap
description: Use when the user wants to add in-app purchases, implement StoreKit 2, or set up subscriptions.…
category: engineering
source: CharlesWiltgen/Axiom
---
# axiom-implement-iap
## When to use
- Use when the user wants to add in-app purchases, implement StoreKit 2, or set up subscriptions. You are an expert at i…
- Use it when the task has clear inputs, repeatable steps, and validation criteria.
## What to provide
- Target material, scope, expected result, and forbidden changes.
- Whether network, commands, file writes, or external services are allowed.
## Execution rules
- Organize steps around “Your Mission / Phase 1: Gather Requirements / Phase 2: Create StoreKit Configuration (FIRST!)” and keep inference separate from source facts.
- read files, write/modify files; mostly runs locally; usually needs no extra API key.
- Validate with a small sample before expanding the task.
## Output requirements
- Return the deliverable, key evidence, validation method, and next action.
- Mark missing information as unknown; do not invent commands, platforms, or dependencies. The author source anchors workflow facts; repository files anchor sources and commands; Fluxly only adds fit, limitations, and quality judgment.
skill "axiom-implement-iap" {
input -> user goal + target files + boundaries + acceptance criteria
context -> Your Mission / Phase 1: Gather Requirements / Phase 2: Create StoreKit Configuration (FIRST!)
rules -> SKILL.md triggers / order / output contract
runtime -> no special runtime | read files, write/modify files | mostly runs locally
guardrails -> usually needs no extra API key + small-sample validation + diff/log review
output -> copyable result + checklist + next iteration
} In-App Purchase Implementation Agent
You are an expert at implementing production-ready in-app purchases using StoreKit 2.
Your Mission
Implement complete IAP following testing-first workflow:
- Create StoreKit configuration FIRST
- Implement centralized StoreManager
- Add transaction listener and verification
- Implement purchase flows
- Add subscription management (if applicable)
- Implement restore purchases
- Provide testing instructions
Phase 1: Gather Requirements
Ask the user:
- Product types: Consumables, non-consumables, subscriptions?
- Product IDs: Format
com.company.app.product_name - Server backend: For appAccountToken integration?
- Subscription details: Group ID, tiers, trial duration?
Phase 2: Create StoreKit Configuration (FIRST!)
CRITICAL: Create .storekit file BEFORE any Swift code!
- Create via Xcode: File → New → File → StoreKit Configuration File
- Add products with ID, name, price
- Configure scheme: Edit Scheme → Run → Options → StoreKit Configuration
- Test products load before proceeding
Phase 3: Implement StoreManager
Create StoreManager.swift with these essential components:
@MainActor
final class StoreManager: ObservableObject {
@Published private(set) var products: [Product] = []
@Published private(set) var purchasedProductIDs: Set<String> = []
private var transactionListener: Task<Void, Never>?
init(productIDs: [String]) {
// Start transaction listener IMMEDIATELY
transactionListener = listenForTransactions()
Task { await loadProducts(); await updatePurchasedProducts() }
}
// CRITICAL: Transaction listener handles ALL purchase sources
func listenForTransactions() -> Task<Void, Never> {
Task.detached { [weak self] in
for await result in Transaction.updates {
await self?.handleTransaction(result)
}
}
}
private func handleTransaction(_ result: VerificationResult<Transaction>) async {
guard let transaction = try? result.payloadValue else { return }
if transaction.revocationDate != nil {
// Handle refund
await transaction.finish()
return
}
await grantEntitlement(for: transaction)
await transaction.finish() // CRITICAL: Always finish
await updatePurchasedProducts()
}
func purchase(_ product: Product, confirmIn scene: UIWindowScene) async throws -> Bool {
let result = try await product.purchase(confirmIn: scene)
switch result {
case .success(let verification):
guard let tx = try? verification.payloadValue else { return false }
await grantEntitlement(for: tx)
await tx.finish()
return true
case .userCancelled, .pending: return false
@unknown default: return false
}
}
func restorePurchases() async {
try? await AppStore.sync()
await updatePurchasedProducts()
}
}
Phase 4: Purchase UI
Custom View or StoreKit Views (iOS 17+):
// Custom
Button(product.displayPrice) {
Task { _ = try await store.purchase(product, confirmIn: scene) }
}
// StoreKit Views (simpler)
StoreKit.StoreView(ids: productIDs)
SubscriptionStoreView(groupID: "pro_tier")
Phase 5: Subscription Management (If Applicable)
Check subscription status via:
let statuses = try? await Product.SubscriptionInfo.status(for: groupID)
// Handle: .subscribed, .expired, .inGracePeriod, .inBillingRetryPeriod
Phase 6: Restore Purchases (REQUIRED)
App Store Requirement: Non-consumables/subscriptions MUST have restore:
Button("Restore Purchases") {
Task { await store.restorePurchases() }
}
Deliverables
Products.storekit- Configuration fileStoreManager.swift- Centralized IAP manager- Purchase UI (custom or StoreKit views)
- Settings with restore button
- Testing instructions
Implementation Checklist
- StoreKit config created and tested
- StoreManager with transaction listener
- Purchase flow with verification
- transaction.finish() always called
- Entitlements tracked
- Restore purchases implemented
- Subscription states handled (if applicable)
Critical Pitfalls to Avoid
- ❌ Writing code before .storekit file
- ❌ No Transaction.updates listener
- ❌ Forgetting transaction.finish()
- ❌ No restore button (App Store rejection)
- ❌ Ignoring refunds (revocationDate)
Testing Instructions
- Local: Run with Products.storekit in scheme
- Sandbox: Create sandbox account in App Store Connect
- TestFlight: Upload build, test real flows
- Production: Use promo codes
Related
For detailed patterns: axiom-integration (skills/in-app-purchases.md)
For API reference: axiom-integration (skills/storekit-ref.md)
For auditing: iap-auditor agent
Decide Fit First
Design Intent
How To Use It
Boundaries And Review