Renewals made while the app was closed never reach Transaction.updates
Transaction.updates isn't a complete renewal history. It emits transactions created while your app runs, plus unfinished ones once at launch. A renewal that happened while the app was closed may never show up there. Read access from Transaction.currentEntitlements at launch and when the app returns to the foreground. Have your server listen to App Store Server Notifications v2, so it hears about renewals even if the app is never opened.
Symptom
- A subscriber whose plan renewed overnight is shown as expired until they tap Restore.
- Your server's expiry date is out of date for users who haven't opened the app.
- In the sandbox, renewals that happen every few minutes don't all appear in your
updatesloop. - Calling
finish()on a renewal seems not to stick, and the renewal appears again later.
Why it happens
| Cause | How to tell |
|---|---|
| Access is decided from the last transaction your listener saw | The code stores an expiry date when a transaction arrives and never re-checks |
| The listener starts late, or only on the paywall screen | Unfinished renewals delivered once at launch are missed |
| No server notifications | Your server only learns about renewals when the app posts a receipt |
| Renewal transactions aren't finished | They come back at each launch through Transaction.unfinished |
| Sandbox's accelerated renewals | Several renewals land between two launches, and you see only some of them |
Apple describes updates as emitting transactions that happen outside the app or on other devices while the app is running. Unfinished transactions are delivered once right after launch. Apple's currentEntitlements gives the latest transaction for each product the user is entitled to now.
Confirm it
- At launch, print what the user is entitled to:
for await result in Transaction.currentEntitlements {
if case .verified(let t) = result {
print("Entitled: \(t.productID) expires \(String(describing: t.expirationDate))")
}
}
If this shows the renewed expiry date while your app thinks the user is expired, your app is reading state from the wrong place.
- Search your code for where it decides “subscribed”. If that's only inside the
updatesloop, that's the cause. - Check App Store Connect → your app → App Information → App Store Server Notifications. If no URL is set, your server isn't told about renewals.
Fix
- Decide access from
currentEntitlements(orProduct.SubscriptionInfo.status) at launch and when the app returns to the foreground. Don't decide it from a stored expiry date. - Start the
updateslistener at app launch, and use it to refresh state when something changes. Don't treat it as the only source. - Finish every verified transaction after handling it, including renewals.
- Set up App Store Server Notifications v2 for production and sandbox, so your server updates expiry dates without the app.
- Sandbox testing: expect renewals every few minutes. Test the closed-app path by closing the app for a couple of renewal periods, then relaunching.
Stop it coming back
- Add a test: subscribe in the sandbox, close the app for two renewal periods, relaunch, and check access without tapping Restore.
- Compare your server's expiry dates with Apple's
Get All Subscription Statusesendpoint for a sample of users each week.
If you use BillDog
BillDog's iOS SDK covers the closed-app path:
- It starts
Transaction.updatesinsideconfigure. - It records
Transaction.unfinishedat launch and on every return to the foreground. - It sweeps
Transaction.currentEntitlementsat launch, and at most every five minutes when the app comes back to the foreground.
Entitlements come from BillDog's server, which also hears renewals through App Store Server Notifications once you add your project's notification URL in App Store Connect. See App Store Connect setup. This was checked against the source of the published iOS SDK 1.1.1-beta.5. It hasn't yet been reproduced on a device for this page.
Related
Sources
Did this fix it?
Frequently asked questions
Is Transaction.updates guaranteed to deliver every renewal?
No. It emits transactions created or updated while your app is running, plus unfinished transactions once at launch. For what a user owns right now, ask Transaction.currentEntitlements.
How does my server learn about renewals if the app is never opened?
From App Store Server Notifications version 2. Apple calls your server for renewals, failed renewals, refunds and expirations, whether or not the app runs.
Why does the sandbox renew so often?
Sandbox subscriptions run on an accelerated clock: a monthly subscription renews every few minutes, for a limited number of renewals. Renewals then really do happen while your app is closed.