/axiom-implement-iap
Use when the user wants to add in-app purchases, implement StoreKit 2, or set up subscriptions.
$ npx -y skills add charleswiltgen/axiom --skill axiom-implement-iap --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/axiom-implement-iap
Context preview
The summary Claude sees to decide when to auto-load this skill.
Use when the user wants to add in-app purchases, implement StoreKit 2, or set up subscriptions.
SKILL.md
axiom-implement-iap.SKILL.mdname: axiom-implement-iap
description: Use when the user wants to add in-app purchases, implement StoreKit 2, or set up subscriptions.
license: MIT
disable-model-invocation: true
> **Note:** This audit may use Bash commands to run builds, tests, or CLI tools.
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: 1. Create StoreKit configuration FIRST 2. Implement centralized StoreManager 3. Add transaction listener and verification 4. Implement purchase flows 5. Add subscription management (if applicable) 6. Implement restore purchases 7. Provide testing instructions
Phase 1: Gather Requirements
Ask the user: 1. **Product types**: Consumables, non-consumables, subscriptions? 2. **Product IDs**: Format `com.company.app.product_name` 3. **Server backend**: For appAccountToken integration? 4. **Subscription details**: Group ID, tiers, trial duration?
Phase 2: Create StoreKit Configuration (FIRST!)
**CRITICAL**: Create `.storekit` file BEFORE any Swift code!
1. Create via Xcode: File → New → File → StoreKit Configuration File 2. Add products with ID, name, price 3. Configure scheme: Edit Scheme → Run → Options → StoreKit Configuration 4. 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
1. `Products.storekit` - Configuration file 2. `StoreManager.swift` - Centralized IAP manager 3. Purchase UI (custom or StoreKit views) 4. Settings with restore button 5. 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
1. ❌ Writing code before .storekit file 2. ❌ No Transaction.updates listener 3. ❌ Forgetting transaction.finish() 4. ❌ No restore button (App Store rejection) 5. ❌ Ignoring refunds (revocationDate)
Testing Instructions
1. **Local**: Run with Products.storekit in scheme 2. **Sandbox**: Create sandbox account in App Store Connect 3. **TestFlight**: Upload build, test real flows 4. **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
Read more
name: axiom-implement-iap description: Use when the user wants to add in-app purchases, implement StoreKit 2, or set up subscriptions. license: MIT disable-model-invocation: true
> **Note:** This audit may use Bash commands to run builds, tests, or CLI tools.
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: 1. Create StoreKit configuration FIRST 2. Implement centralized StoreManager 3. Add transaction listener and verification 4. Implement purchase flows 5. Add subscription management (if applicable) 6. Implement restore purchases 7. Provide testing instructions
Phase 1: Gather Requirements
Ask the user: 1. **Product types**: Consumables, non-consumables, subscriptions? 2. **Product IDs**: Format `com.company.app.product_name` 3. **Server backend**: For appAccountToken integration? 4. **Subscription details**: Group ID, tiers, trial duration?
Phase 2: Create StoreKit Configuration (FIRST!)
**CRITICAL**: Create `.storekit` file BEFORE any Swift code!
1. Create via Xcode: File → New → File → StoreKit Configuration File 2. Add products with ID, name, price 3. Configure scheme: Edit Scheme → Run → Options → StoreKit Configuration 4. 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
1. `Products.storekit` - Configuration file 2. `StoreManager.swift` - Centralized IAP manager 3. Purchase UI (custom or StoreKit views) 4. Settings with restore button 5. 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
1. ❌ Writing code before .storekit file 2. ❌ No Transaction.updates listener 3. ❌ Forgetting transaction.finish() 4. ❌ No restore button (App Store rejection) 5. ❌ Ignoring refunds (revocationDate)
Testing Instructions
1. **Local**: Run with Products.storekit in scheme 2. **Sandbox**: Create sandbox account in App Store Connect 3. **TestFlight**: Upload build, test real flows 4. **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
Battle-tested skills, agents, and tools for modern Apple OS development — Swift 6, SwiftUI, Liquid Glass, Apple Intelligence, and more. Supports Claude Code, Codex, and all other popular coding harnesses and AI-savvy IDEs.
Repo: charleswiltgen/axiom
Other skills on axiom.
- /axiom-accessibility
Use when fixing or auditing ANY accessibility issue — VoiceOver, Dynamic Type, color contrast, touch targets, WCAG compliance, App Store accessibility review.
Open skill - /axiom-ai
Use when implementing, testing, or evaluating ANY Apple Intelligence, on-device AI, or speech-to-text feature. Covers Foundation Models, @Generable, LanguageModelSession, Tool protocol, eval suites, model-as-judge scoring, SpeechTranscriber, CoreML.
Open skill - /axiom-analyze-crash
Use when the user has a crash log (.
Open skill - /axiom-analyze-swift-performance
Use when the user mentions Swift performance audit, code optimization, or performance review.
Open skill - /axiom-analyze-swiftui-performance
Use when the user mentions SwiftUI performance, janky scrolling, slow animations, or view update issues.
Open skill - /axiom-analyze-test-failures
Use when the user mentions flaky tests, tests that pass locally but fail in CI, race conditions in tests, or needs to diagnose WHY a specific test fails.
Open skill

