Keeping subscription access correct everywhere

Modern platform Senior Swift 5.5+ iOS 17+ Reviewed By Alok Singh

Pick the fix

A user subscribes on their iPhone and opens the app on their iPad. How should the iPad know?

Options
Hint 1 of 1

Where does the truth live?

Choose an answer, then open Show answer below to check it.

Show answer

Answer: A Check Transaction.currentEntitlements at launch and listen to Transaction.updates

Correct. Entitlements sync through the user's Apple Account.

Why not the others?
  • B Ask the user to tap Restore every time. Restore is only needed in rare cases.
  • C Read a premium flag from iCloud key-value storage. It can go stale and be edited, and isn't the App Store's truth.
  • D Email the user a code. It's unnecessary and error-prone.

30-second answer

Treat the App Store as the source of truth. On each device, derive access from Transaction.currentEntitlements at launch and update it from Transaction.updates. If users also sign in to your service, set appAccountToken at purchase and keep a server-side record updated by App Store Server Notifications V2, so web and other platforms agree. Handle grace periods, billing retry, refunds and family sharing.

Practise saying it · 45 s. No recording, just a timer

Explain cross-device subscription access.

Say your answer out loud, then check which of these points you covered:

  • Entitlements as truth
  • Updates and server notifications
  • appAccountToken
  • Edge cases

Deep dive

Don't cache 'isPremium' forever; recompute from entitlements.

Refunds and revocations arrive through Transaction.updates and server notifications.

Billing grace period keeps access while payment is retried.

Expose a restore option that calls AppStore.sync() only when the user asks.

Common mistakes

  • A local premium flag that never expires.
  • Ignoring refunds and revocations.

Senior take & follow-ups

Seniors keep one source of truth and handle the lifecycle edge cases.

Follow-up questions

Think of your answer first, then open the hint.

  1. What is appAccountToken for?

    Show hint

    Linking a transaction to your own user id.

  2. How does the server learn about renewals?

    Show hint

    App Store Server Notifications V2.

Suggest a fix if something here is wrong or out of date.