28.4 · JWS, certificate chains, notifications, the Server API and why receipts gave way to transactions
The device is untrusted territory. Anything worth money gets re-checked on a server that can verify Apple's signature and keep the state when the app is closed.
Mental model. Everything Apple sends is a signed JWS. Verify the chain to Apple's root, verify the signature, then treat the payload as one event in a stream that may be duplicated or out of order.
Signed data
JWS anatomy and the certificate chain behind it.
- How is a StoreKit JWS built, and what must a server check before trusting signedTransactionInfo?
A JWS (the compact serialisation Apple uses) is base64url(header).base64url(payload).base64url(signature). The header contains alg: "ES256" and an x5c array of… - How do you validate the x5c certificate chain of an App Store JWS, and what does the leaf certificate prove?
The x5c chain is only meaningful if it ends at a root you already trust: download Apple's root (Apple Root CA G3 for current App Store signing, from Apple's…
Events and APIs
Notifications, the Server API and its JWT, and moving off receipts.
- How do App Store Server Notifications V2 behave, and how do you process them idempotently and out of order?
Server Notifications V2 are HTTPS POSTs to a URL you configure per environment. The body is {"signedPayload": "<JWS>"}; verify it like any JWS, then read… - How do you authenticate to the App Store Server API, and what do you use it for?
The App Store Server API (REST, JSON) is authenticated by a JWT you sign with an In-App Purchase key from App Store Connect (a .p8 ES256 private key, with a… - What replaced the receipt, and how do you grandfather paid users with AppTransaction.originalAppVersion?
The legacy model was an app receipt (a PKCS#7 blob at appStoreReceiptURL) that the app sent to Apple's verifyReceipt endpoint; that endpoint is deprecated, the…
More in Purchases & subscriptions
- 28.1 · Products, prices, the purchase call, verification and the update stream
- 28.2 · Subscription groups, renewal states, grace period, billing retry and offers
- 28.3 · What the user owns: entitlements, restore, family sharing, refunds and revocation
- 28.5 · Paywall design, price display and testing with StoreKit configuration, sandbox and TestFlight
- 28.6 · App Review rules, external purchases and designing a billing platform
- 28.7 · Building the integration: the store object, the catalogue, the SwiftUI views, status, account tokens and tests