Anonymous Subscription Setup in Swift: A Privacy Checklist
Subscriptions and privacy can coexist, but only if you decide up front where purchase data lives and what you tell users about it. This guide walks through a stripped-down Swift subscription flow: configure the Purchases SDK without a user identity, gate premium content on an active entitlement, present an offering-based paywall, and file the App Store privacy answers that follow from anonymous IDs. It closes with the support path that lets you diagnose a subscription without asking who the customer is.
Why server-side receipt validation changes your disclosure
Receipt validation is the fork in the road. Validating on a server is the only way to keep subscription status secure, and it necessarily means some purchase data leaves the device. Local validation avoids purchase-data collection entirely, but it opens the door to interception and man-in-the-middle attacks, removes cross-platform purchase syncing, and forces an app update whenever your product catalog changes. Local validation also costs you simpler purchase logic, support tooling, and reporting.
Use this checklist before choosing:
- Are you willing to let premium content be reached on jailbroken devices, or to risk a hijacked connection between the app and Apple?
- Do you need purchases to sync between iOS and Android?
- Do you want to change products without shipping a new build?
- Do you need support tools and reporting on subscription behavior?
If you answer yes to the last three, server-side validation is the path that supports them. If you accept the risks and want no purchase-data disclosure, local validation implementations are the alternative. Either way, the disclosure requirement is not unique to a subscription platform: running your own subscription status server still requires disclosing the data you collect.
Configure the SDK so the user stays anonymous
Turn on debug logs as early as possible in the app lifecycle, for example in the AppDelegate's didFinishLaunchingWithOptions method, so the SDK's context is available when something goes wrong. The exact call is preserved in the accompanying code module.
Then configure the SDK with your API key and leave out the app user ID, or pass nil. The SDK generates a randomized anonymous identifier and attaches that user's purchases to it. No account, email, or profile is needed for the purchase to be tracked.
Before you start, you need the Purchases SDK installed and your products organized into the platform's product, package, offering, and entitlement structure. The sample project used here is a stripped-down Swift weather app that is already prepared for subscriptions.
Gate premium content on an active entitlement
In the weather view controller's performMagic method, the original sample simply regenerated fake forecast data. Replace that unconditional call with a purchaser-info fetch that checks whether the configured entitlement is active. If it is, update the weather; if not, present the paywall storyboard.
The SDK caches purchaser info for a few minutes, so calling the fetch whenever the screen needs a decision is safe. On a fresh install no purchase exists yet, so the first run lands on the paywall — which is the expected behavior, not an error.
A useful way to read the flow:
- Input: the current purchaser info from the SDK.
- Decision: is the entitlement's isActive flag true?
- Output A: premium content renders.
- Output B: the paywall is presented modally.
Fetch the offering, purchase a package, unlock the entitlement
Products are grouped into offerings and packages. In the paywall controller's viewDidLoad, after the super call, fetch offerings, store the current offering, and reload the table view that lists packages. Each row represents an available package; selecting a row calls purchasePackage through the SDK. The purchase callback also exposes a userCancelled flag alongside the transaction, purchaser info, and error, so your additional implementation can distinguish a deliberate dismissal from a failure. After a successful purchase the paywall dismisses and the premium content becomes available. Whether the SDK also syncs the receipt to a subscription backend and unlocks the associated entitlement under the anonymous identifier depends on the platform you integrate; treat that as a configuration question to verify against your own backend rather than an assumption.
File the matching App Privacy answers
In App Store Connect, open the app and choose App Privacy in the sidebar. With anonymous identifiers and no personally identifiable information collected, only one data type needs to be declared: Purchases. Check it and save. Apple then asks what the purchase history is used for. A common pairing for this setup is Analytics, which covers dashboard features such as customer history, charts, and experiments, and App Functionality, which covers receipt validation and entitlement-driven features. Treat those as the rationale for the platform you integrate, not as a universal Apple rule; confirm the purposes that apply to your own stack. Because the identifiers are anonymous, answer No when asked whether purchase history is linked to the user's identity. Answer No again when asked whether the data is used for tracking. Save the result. This is the minimum for this setup, not a universal answer. If you add analytics integrations or collect other data, additional disclosures apply, and the platform's app-privacy support documentation is the place to confirm the current requirements.
Support customers without learning who they are
Anonymous does not mean unsupportable. The SDK exposes the current app user ID, so you can display it in settings — or in the sample app's User tab — and let the customer share it with you when they open a ticket. Copying the ID to the clipboard on tap removes a common source of support friction. With that ID, a subscription dashboard can be used to locate the customer, diagnose subscription problems, and grant promotional subscriptions, provided your own tooling supports those actions; confirm that before promising them to customers. Showing the ID is optional for the user and is not part of core app functionality, so it does not count as data collection under Apple's definition. At the end of this flow you have working purchases, entitlement-gated content, a filed privacy disclosure, and a support path — with no account identity attached to any of it.
Frequently asked questions
Can I validate receipts on the device instead?
Yes, but it is a tradeoff. Apple strongly recommends against local validation because a bad actor can intercept the connection and perform a man-in-the-middle attack. Local validation also prevents syncing purchases between iOS and Android and requires an app update whenever the products you sell change. In exchange, you avoid disclosing purchase data collection.
Do I have to disclose purchase data if I run my own subscription server?
Yes. The disclosure requirement is not tied to a particular subscription platform. Any server-side receipt validation collects some minimum purchase data, and that must be reflected in your App Store privacy answers.
Why does the app show the paywall on first launch?
No purchase has been made yet, so the entitlement is not active. The entitlement check returns false and the paywall is presented. Once a package is purchased and the entitlement unlocks, the premium content renders instead.
Is it safe to check purchaser info every time the screen loads?
Yes. The SDK caches purchaser info for a few minutes, so repeated fetches do not create a performance problem.
Does showing the anonymous app user ID count as data collection?
No. Sharing the ID is optional for the user and is not part of the app's core functionality, so it falls outside Apple's definition of data collection.