TL;DR: The hard part of in-app subscriptions is not the purchase screen, it is keeping one honest answer to "is this user allowed to use the paid thing right now?" across iOS, Android, the web and your backend. My approach on small apps: let the stores handle the money, keep a single entitlement record on your own server, update it from the stores' server notifications rather than from the app, treat the app's local purchase state as a hint, and design the awkward states (grace period, billing retry, refund, cancelled but still paid up) on purpose. Most subscription bugs I have seen are not payment bugs. They are "the app and the server disagree" bugs.
Running LectureNotes AI, the note-taking app I co-founded with Benjamin Rhodes, taught me that a subscription is a small product feature with a long tail. The app grew to nearly 10,000 users at roughly $1k MRR, which is not a huge number, but every one of those subscribers is a person who will email you the moment they pay and the app still shows the paywall. I wrote about the cost side of that business separately. This post is about the plumbing between "the user paid" and "the app unlocks", which is where most of the support tickets come from.
Start with the store rules, not the code
Before any architecture, settle which billing you are allowed to use. On both the App Store and Google Play, digital features and subscriptions consumed inside the app generally have to go through the store's own billing. Real-world goods and services can use your own payment processor. I covered how that plays out in review in getting a startup app through App Store review, and it is the first thing I check on any paid app, because getting it wrong is a rejection, not a bug.
The rules also differ by region and change over time, so read the current guidelines for your category instead of trusting a blog post from two years ago, including this one.
The practical consequence for a typical subscription app: you will have up to three sources of purchases (Apple, Google, and possibly a web checkout), each with its own IDs, its own lifecycle events and its own idea of when a subscription ends. Your job is to turn those into one answer.
The core design: one entitlement record you own
The mistake I see most often in inherited apps is that the client decides whether the user is paid. The app asks the store "do I have an active purchase?", gets a yes, and unlocks. That works on the device where the purchase happened and breaks almost everywhere else:
- The user logs in on a second device or on the web, and the purchase does not follow them.
- The backend has no idea the user is paid, so any server-side feature (the expensive AI call, in my case) cannot check it.
- A refund or a failed renewal never reaches the app if the user does not open it.
What I build instead is a small entitlement record on the server, per user:
- What they are entitled to. Not the product ID, but the access level:
pro,free. Product IDs change when you run a new price or a promotion; access levels should not. - Until when. An expiry timestamp, with the state that produced it.
- Which store and which original transaction. So you can match future notifications back to this user.
- The current state. Active, in grace period, in billing retry, cancelled but paid until expiry, expired, refunded.
Every paid feature, on every platform, asks the server. The app can cache the answer for offline use, but the server is the source of truth. This is the same "one owner for a core fact" rule I applied to the leaderboard at RAQTS and wrote about in what technical debt to pay down: when two places can each decide a fact, they will eventually disagree, and the user sees the disagreement.
Let the stores tell your server, not the app
Both stores can send your backend notifications about subscription changes: renewals, cancellations, billing problems, refunds, upgrades. These server notifications are the main input to the entitlement record.
The flow I use:
- The app completes the purchase and immediately sends the transaction or purchase token to the backend.
- The backend verifies it with the store's server API, never trusting the app's word alone, then links the original transaction to the logged-in user and writes the entitlement.
- From then on, store notifications update the record. Renewal moves the expiry forward. A billing failure moves the state to retry or grace. A refund revokes access.
- The app reads the entitlement from the backend on launch and after any purchase.
Step one matters because it closes the gap between purchase and first notification, so the user gets access right away. Steps two and three matter because they keep working when the user never opens the app again.
A few rules for the notification endpoint, because it is an unglamorous webhook that quietly decides your revenue:
- Verify every notification using the method the store provides. An unauthenticated endpoint that grants paid access is an obvious hole.
- Make it idempotent. Notifications can arrive twice and out of order. Store the notification ID and ignore duplicates, and when in doubt ask the store's API for the current state instead of applying events blindly.
- Log the decision. "Renewal received, expiry moved from X to Y" or "refund received, access revoked". The same structured logging habits from error monitoring on a small product apply, and a subscription support ticket is much faster to answer when you can search one transaction ID.
- Alert on silence. If you normally see renewals every day and suddenly see none, the endpoint or its credentials broke. No error will tell you.
Design the awkward states on purpose
The happy path is "paid, active, renewed". The support load lives in the states in between, and each one is a product decision, not just a technical one.
Cancelled but still paid up
Cancelling usually means "do not renew", not "remove access now". The user keeps access until the period ends. The app should say so clearly ("Your plan ends on 3 March"), because users who cancel and immediately lose access feel cheated, and users who cancel and see no change assume the cancel failed.
Billing problems and grace periods
When a renewal payment fails, the stores retry for a while, and you can opt into a grace period where the user keeps access during the retry. I turn grace periods on for almost every app. Most failed renewals are an expired card, not a decision to leave, and cutting a paying user off over a card problem is the fastest way to turn a billing hiccup into a churned customer. During grace, the app shows a gentle prompt to update payment details, not a locked screen.
Refunds
A refund should revoke access, and the record should note why. On an AI product this matters more than usual: if the expensive feature is still unlocked after a refund, you are paying model costs for a user who is no longer paying you.
Restore purchases and account changes
Every store-billed app needs a working restore button, and both stores expect one. The harder case is a user who bought on one account and logs into another, or who signs up again with a new email. I tie the purchase to the original transaction and let the backend decide whether to move it, rather than letting the app attach the same purchase to several accounts.
Price changes, trials and promotions
On a small app you will want to experiment with pricing. The cleanest way I have found is to keep pricing in the stores and access in your backend:
- New price, new product ID, same access level. Old subscribers stay on their price unless you deliberately migrate them through the store's own flow.
- Trials as a state, not a separate system. The store tells you it is a trial; your entitlement record says
prowith a trial flag and expiry. Paid features do not need to know the difference. - The paywall itself behind a remote config or feature flag, so you can change copy, layout or which plans are shown without an app release and store review.
On an AI app, where the paid tier usually unlocks the expensive step, I also cap usage in units the user understands even for paid users. A subscription that promises unlimited use of a per-call model is a bet you can lose.
Testing it before real money moves
Both stores have sandbox and test environments where subscriptions renew on an accelerated clock, so a monthly plan renews every few minutes. I use that to walk through every state above before launch: buy, renew, cancel, let it lapse, fail a payment, refund, restore on a second device. If a state cannot be reached in sandbox, I write a test that feeds the backend a recorded notification instead.
Two things that catch people out:
- Old app versions. Subscription logic often changes after launch, and old app versions never fully disappear. If entitlement checks live on the server, old versions keep working. If they live in the app, every fix needs every user to update.
- Test purchases leaking into metrics. Tag sandbox transactions and exclude them from revenue and conversion numbers, or your first week of MRR will look better than it was.
What I would set up on day one
If I were adding subscriptions to a new app tomorrow, this is the order:
- Confirm which billing the store rules require for your product, per platform.
- An entitlement record on the backend with access level, expiry, state and original transaction.
- App sends the purchase to the backend, backend verifies with the store and links it to the user.
- A verified, idempotent notification endpoint for each store that updates the record.
- Grace periods on, a clear "plan ends on" message for cancelled users, refunds that revoke access.
- A restore button, and every paid feature checking the server rather than the device.
- A full sandbox walkthrough of every state, plus an alert if notifications stop arriving.
None of this is clever. It is a day or two of careful work that saves months of "I paid and it still says free" emails, and it is one of the first things I look at when inheriting a codebase for a paid app.
I build mobile apps, AI products and the backends behind them for startups in the US, UK and Europe, including the billing plumbing that decides whether a paying user actually gets what they paid for. If you are adding subscriptions to an app, or untangling ones that already misbehave, read more about my background or book a call.