◉CLAUDE LABJP
●SONNET 4.5 — Sonnet 4.5 was retired from the Claude API on 11/30. Calls now return an error. Move to Sonnet 5.5●PROJECTS — The Enterprise Analytics API now reports daily usage for the new projects experience (beta)●OPUS 4.5 — claude-opus-4-5 retires on 2027/1/22, 52 days from now. The replacement is claude-opus-5-5●LANGUAGE — Some users say Claude switches to another language mid-session while they write in English●NEW — New: Weekly usage looks like it jumped right after a plan upgrade? Check this first●COWORK — Handing Cowork a folder for the first time? Start with a task that only reads files●SONNET 4.5 — Sonnet 4.5 was retired from the Claude API on 11/30. Calls now return an error. Move to Sonnet 5.5●PROJECTS — The Enterprise Analytics API now reports daily usage for the new projects experience (beta)●OPUS 4.5 — claude-opus-4-5 retires on 2027/1/22, 52 days from now. The replacement is claude-opus-5-5●LANGUAGE — Some users say Claude switches to another language mid-session while they write in English●NEW — New: Weekly usage looks like it jumped right after a plan upgrade? Check this first●COWORK — Handing Cowork a folder for the first time? Start with a task that only reads files
Articles/Claude Code
⟐ Claude Code/2026-04-15Advanced

Building StoreKit 2 × SwiftUI Purchases with Claude Code — The Minimum That Passes Review

Build a StoreKit 2 × SwiftUI purchase flow end to end with Claude Code as your design partner — PurchaseManager, server-side validation, and paywall UI — plus the operational traps Apple's docs skip, like Ask to Buy and late-arriving transactions.

Claude Code296SwiftUI7StoreKit 2iOS27in-app purchasesubscription4Swift5App Store9

✦ Premium Article

Why StoreKit 2 Trips Up Even Experienced Developers

The night I moved a wallpaper app's purchase code over to StoreKit 2, I tapped Buy in Sandbox, watched the payment sheet close, and the paywall just stayed there. Three attempts, same result. The purchase code was fine. I had started the transaction listener inside a view's .task, so it came online after the transaction had already arrived. I only saw it once I noticed that not a single "purchase succeeded" line had made it into the log.

What I'd like to say up front is that the hard part of StoreKit 2 is rarely the API surface. It's knowing when, and through which path, a purchase reaches your app. Most Stack Overflow answers still assume the StoreKit 1 APIs, Apple's documentation leans toward concepts rather than a complete picture, and Sandbox behaves just differently enough from production to hide bugs.

StoreKit 2 was announced at WWDC21 and is available from iOS 15. It's built around async/await, with Product and Transaction at the center and signed results delivered as VerificationResult. The older API built on SKPaymentQueue and SKProductsRequest (the Original API for In-App Purchase) was deprecated in iOS 18. It still runs, but there's no good reason to build new code on it (as of November 2026, per Apple Developer Documentation).

This guide builds a StoreKit 2 × SwiftUI implementation from scratch with Claude Code as a design partner: non-consumables, consumables, auto-renewable subscriptions, server-side validation, and a paywall that passes review. Later sections add a symptom-first troubleshooting table, a few corrected misconceptions, and the operational traps Apple's docs leave out.

For setting up Claude Code with your iOS project, see Claude Code × Swift/iOS Production App Development Guide first.


Why Claude Code Is an Effective StoreKit 2 Partner

Claude Code brings three specific advantages to StoreKit 2 work:

Full project context for architecture decisions. Claude Code reads your entire project before making suggestions. When you say "I want to manage subscription state in this ViewModel," it proposes solutions that fit your existing architecture rather than generic sample code.

Comprehensive error handling in one pass. StoreKit 2 error types span StoreKitError, Product.PurchaseError, and VerificationResult.VerificationError. Asking Claude Code to "handle all StoreKit 2 error cases" produces exhaustive coverage that would take significant research time to assemble manually.

Sandbox debugging support. When Transaction.currentEntitlements returns empty after a successful Sandbox purchase, or when entitlements don't refresh after subscription renewal, Claude Code can diagnose the issue and provide corrected code immediately.


✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Subtle Transaction.updates timing gaps that Apple docs never mention, and a cache-first design that eliminates the flash-of-paywall problem
✦A measured comparison showing a decode-only JWS parser accepting both a tampered payload and an alg:none token, plus why NODE_ENV must not decide the API environment
✦Why treating an Ask to Buy pending state as a failure gets flagged in review, and how to reproduce it in Sandbox
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⟐ Claude Code2026-11-19
My Porting Checklist Was Written in SwiftUI Terms, and It Couldn't Find a Single Purchase Item in My Objective-C Code
I built a small pipeline that hands Claude Code only the checks relevant to the file I'm editing, out of a 113KB list of 33 Android pitfalls. Three scripts, and how a SwiftUI vs Objective-C vocabulary gap let the most important items slip through.
⟐ Claude Code2026-10-12
After Moving to SPM, My App Died the Moment It Launched — Reading One dyld Line with Claude Code
Right after moving from CocoaPods to Swift Package Manager, the build passed but the app died on launch. Here is how I traced one dyld line to its cause, the fix, and how to verify it.
⟐ Claude Code2026-09-04
The One File I Keep Out of Claude Code's Reach: project.pbxproj
With Xcode project files, the breakage that still opens costs far more than the breakage that refuses to open. Here is what I measured before moving every edit behind a script, and where the line sits today.