Restoring Purchases
Let users restore App Store and Google Play purchases with Superwall: add a Restore button to a paywall, call restorePurchases() from your app, customize the failure alert, and restore with a purchase controller.
Restoring gives a user back access they already paid for, for example after they reinstall your app or move to a new phone. Superwall can restore from a button on your paywall, or from anywhere in your app with one SDK call. Apple requires apps with in-app purchases to offer a way to restore them.
Add a Restore button to a paywall
- In the paywall editor, select the button or text you want users to tap.
- Under Tap Behavior, choose Restore.
- Publish the paywall.
When the user taps it, the SDK shows a loading state and restores their purchases with the App Store or Google Play:
- If the restore gives the user an active entitlement, the SDK tracks a
restoreCompleteevent and dismisses the paywall. To keep the paywall open, setautomaticallyDismisstofalseinSuperwallOptions.paywalls. - If it doesn't, the SDK tracks a
restoreFailevent and shows an alert: "No Subscription Found. We couldn't find an active subscription for your account."
A restore counts as successful only when the user ends up with an active entitlement, so a user whose subscription has expired gets the alert.
Restore from your app
To restore from your own settings screen or purchase UI, call restorePurchases():
let result = await Superwall.shared.restorePurchases()val result = Superwall.instance.restorePurchases()final result = await Superwall.shared.restorePurchases();const { restorePurchases } = useSuperwall();
const result = await restorePurchases();The result says whether the restore itself succeeded, not whether the user is subscribed. Check the user's subscription status after it returns. If you don't use a purchase controller and the user has no active entitlement, the SDK shows the same alert as the paywall's Restore button.
Restoring can ask the user to sign in to their App Store or Google account, so only restore when the user asks to.
Customize the failure alert
Change the alert's text with restoreFailed in SuperwallOptions.paywalls:
let options = SuperwallOptions()
options.paywalls.restoreFailed.title = "No purchases found"
options.paywalls.restoreFailed.message = "Sign in with the account you used to subscribe."
options.paywalls.restoreFailed.closeButtonTitle = "OK"
Superwall.configure(apiKey: "MY_API_KEY", options: options)val options = SuperwallOptions()
options.paywalls.restoreFailed.title = "No purchases found"
options.paywalls.restoreFailed.message = "Sign in with the account you used to subscribe."
options.paywalls.restoreFailed.closeButtonTitle = "OK"
Superwall.configure(this, apiKey = "MY_API_KEY", options = options)For the other SDKs, see SuperwallOptions.
Restore with a purchase controller
If you handle purchases yourself with a purchase controller, the SDK calls your controller's restorePurchases() when the user taps Restore. Restore with your own code, update the user's subscription status, and then return the result:
func restorePurchases() async -> RestorationResult {
// Restore with StoreKit or your purchase SDK, then set
// Superwall.shared.subscriptionStatus before returning.
return .restored // Or .failed(error)
}override suspend fun restorePurchases(): RestorationResult {
// Restore with Google Play Billing or your purchase SDK, then set
// Superwall.instance.setSubscriptionStatus(...) before returning.
return RestorationResult.Restored() // Or RestorationResult.Failed(error)
}Set the subscription status before you return restored. The SDK checks it right away, and if the user has no active entitlement yet, it treats the restore as failed and shows the alert.
If you use RevenueCat, see Using RevenueCat.
Restoring web checkout purchases
If your app sells through Web Checkout, a store restore doesn't find web purchases. When the store restore doesn't cover the paywall's products, the SDK asks the user whether they'd like to restore on the web. Turn this alert off with shouldShowWebRestorationAlert in SuperwallOptions.paywalls. For how web purchases are restored, see Restoring & Managing Purchases.
Test a restore
- In test mode (iOS, Android), tapping Restore lets you pick which entitlements to restore, without a sandbox account.
- On iOS, sandbox purchases can stay active after you reset a test account. See Sandbox Entitlements Persist After Reset.
- If a free trial doesn't show after reinstalling in sandbox, restore first. See Sandbox Free Trial Isn't Appearing.
Related
- Tracking Subscription State
- Customer Center, a screen where users can restore and manage their purchases
- Styling Elements: Tap Behaviors
How is this guide?
Free Trials and Introductory Offers on Paywalls
Show free trials and introductory offers on Superwall paywalls: check trial eligibility with products.hasIntroductoryOffer, write trial copy with product variables, override eligibility, remind users before a trial ends, and target users who cancelled.
Monthly Billing Plans for Annual Subscriptions
Sell an annual App Store subscription as 12 monthly payments with Superwall. Add Apple's monthly billing plan to the product, choose monthly installments or up-front billing per paywall, and compare the two in charts.