Fix StoreKit 2 & Play Billing v8 Restore Purchases & 3-Day Refund Bugs

Stop Guideline 3.1.1 rejections and Play Billing v8 3-day auto-refunds using AppStore.sync(), acknowledgePurchase, and offline-safe IAP caching.

Checked 4 Dec 2026·Published 4 Dec 2026·9 min read·Raw .md
In brief
  • Apple App Review Guideline 3.1.1 requires a visible Restore Purchases button for non-consumables and subscriptions even though StoreKit 2 syncs Transaction.currentEntitlements automatically; wire that button to AppStore.sync().
  • Google Play Billing Library v8 automatically refunds any one-time non-consumable purchase after 72 hours unless you explicitly call acknowledgePurchase once PurchaseState == PURCHASED.
  • Cache verified entitlements in UserDefaults and SharedPreferences and never overwrite true with false when BillingResponseCode != OK or the device boots in airplane mode.

A $2.99 (₩3,900) Remove Forced Ads non-consumable IAP is the highest-margin monetization lever in hybrid casual games and utility apps, often contributing 18%–35% of net studio revenue alongside AdMob rewarded video. Yet two subtle SDK bugs routinely wipe out that revenue or stall store launches: iOS App Review Guideline 3.1.1 rejections over missing restore flows in StoreKit 2, and Google Play Billing Library v8 silently refunding 100% of one-time purchases exactly 72 hours after checkout. Before projecting your hybrid conversion curve in the App Store, Google Play & AdMob Revenue Calculator, lock down these cross-platform entitlement invariants in Swift and Kotlin.

Why does apple reject StoreKit 2 apps under guideline 3.1.1 for restore purchases?

Even though StoreKit 2 automatically refreshes signed JWS transactions via Transaction.currentEntitlements, Apple App Review Guideline 3.1.1 still mandates a visible, tappable Restore Purchases button on your paywall and Settings screen that explicitly calls try await AppStore.sync(). Omitting the button (or wiring it to a no-op reload of local cache) triggers immediate binary rejection during human sandbox review.

When Apple introduced StoreKit 2 (Product, Transaction.updates, and Transaction.currentEntitlements), many iOS engineers read that entitlements sync automatically across devices signed into the same Apple Account and deleted their legacy SKPaymentQueue.default().restoreCompletedTransactions() button. In production, two edge cases break silent restoration:

  1. Fresh device migration & App Review sandbox lag: When a user restores an iCloud backup onto a brand-new iPhone, or when an App Reviewer signs into a clean sandbox Apple Account right before tapping your paywall, the local on-device StoreKit receipt database may not yet hold every historical non-consumable JWS token.
  2. User expectation & support deflection: Paying customers who reinstall your app and briefly see a banner slot look immediately for a "Restore Purchases" button; if none exists, they assume you deleted their unlock and leave a 1-star review requesting an Apple refund.
Capability / Lifecycle Hook Apple StoreKit 2 (iOS 17+ / Swift) Google Play Billing v8.0+ (Android / Kotlin) Fatal Mistake to Avoid
Cold-launch silent check Iterate Transaction.currentEntitlements + listen to Transaction.updates billingClient.queryPurchasesAsync (ProductType.INAPP) Calling AppStore.sync() on launch (triggers Apple ID login popup!)
User-tapped Restore button try await AppStore.sync() then re-scan currentEntitlements Reconnect BillingClient + queryPurchasesAsync + UI status toast Omitting visible Restore button on paywall/Settings (3.1.1 rejection)
Post-checkout finalization Verify .verified(let tx) JWS signature, grant unlock, await tx.finish() Verify PurchaseState.PURCHASED, grant unlock, acknowledgePurchase Skipping acknowledgePurchase on non-consumables (72h auto-refund)
Pending / Ask-to-Buy state Handle .pending result without granting entitlement; wait on Transaction.updates Configure enableOneTimeProducts() & wait while PurchaseState == PENDING Unlocking ad-free on PENDING before parental approval or cash voucher clears
Offline / Airplane launch Seed initial @Published state from UserDefaults + cached JWS Seed initial StateFlow from SharedPreferences; ignore non-OK errors Overwriting isAdFree = false when SERVICE_UNAVAILABLE returns empty list
Refund / Revocation check Check tx.revocationDate == nil while iterating currentEntitlements Absent from purchasesList when BillingResponseCode.OK succeeds Leaving refunded fraud accounts unlocked forever after verified OK sync

Keep AppStore.sync() strictly inside your button action handler, never inside init() or .task {} on your root view. Calling AppStore.sync() programmatically at cold launch prompts unauthenticated or sandbox-switched users with a system Apple Account sign-in modal before they have even seen your gameplay loop, which itself triggers an App Review rejection under Guideline 5.1.1 / 3.1.1.

How do you implement a guideline-compliant StoreKit 2 non-consumable manager in SwiftUI?

Start a long-lived Transaction.updates listener task at initialization, read UserDefaults synchronously so frame zero renders without banner flicker, iterate Transaction.currentEntitlements checking tx.revocationDate == nil, and bind a dedicated Restore Purchases button on both your Remove Ads sheet and Settings screen to AppStore.sync().

Here is the complete @MainActor StoreKit 2 pattern used across native iOS 17.0+ hybrid puzzle apps for a $2.99 (com.example.game.remove_ads) non-consumable unlock:

import StoreKit
import SwiftUI

@MainActor
final class RemoveForcedAdsStore: ObservableObject {
    @Published private(set) var isAdFree: Bool
    @Published private(set) var displayPrice: String = "$2.99"
    @Published private(set) var isBusy: Bool = false
    @Published var statusMessage: String?

    let productID: String
    private let cacheKey: String
    private var product: Product?
    private var updatesTask: Task<Void, Never>?

    init(productID: String) {
        self.productID = productID
        self.cacheKey = "entitlement.adfree.\(productID)"
        // Synchronous boot read: zero banner flicker during offline cold launch
        self.isAdFree = UserDefaults.standard.bool(forKey: cacheKey)

        // Required for Ask-to-Buy, Strong Customer Auth (3DS), and cross-device buys
        self.updatesTask = Task { [weak self] in
            for await verification in Transaction.updates {
                if case .verified(let tx) = verification {
                    await tx.finish()
                    await self?.refreshCurrentEntitlements()
                }
            }
        }

        Task { [weak self] in
            await self?.loadProductMetadata()
            await self?.refreshCurrentEntitlements()
        }
    }

    deinit { updatesTask?.cancel() }

    func loadProductMetadata() async {
        guard let fetched = try? await Product.products(for: [productID]).first else { return }
        product = fetched
        displayPrice = fetched.displayPrice
    }

    func refreshCurrentEntitlements() async {
        var active = false
        var sawMatchingRecord = false

        for await verification in Transaction.currentEntitlements {
            guard case .verified(let tx) = verification, tx.productID == productID else { continue }
            sawMatchingRecord = true
            if tx.revocationDate == nil {
                active = true
            }
        }

        if active {
            persist(true)
        } else if sawMatchingRecord {
            // Explicit Apple refund revocation detected on device
            persist(false)
        }
    }

    func purchase() async {
        guard !isBusy else { return }
        isBusy = true
        statusMessage = nil
        defer { isBusy = false }

        if product == nil { await loadProductMetadata() }
        guard let product else {
            statusMessage = "App Store is temporarily unreachable. Please try again."
            return
        }

        do {
            switch try await product.purchase() {
            case .success(let verification):
                guard case .verified(let tx) = verification else {
                    statusMessage = "Could not verify purchase signature."
                    return
                }
                await tx.finish()
                persist(true)
                statusMessage = "Unlocked! All banners and forced interstitials are disabled."
            case .pending:
                statusMessage = "Purchase is pending approval (Ask to Buy)."
            case .userCancelled:
                break
            @unknown default:
                break
            }
        } catch {
            statusMessage = "Purchase could not be completed."
        }
    }

    /// Invoked ONLY when the user explicitly taps "Restore Purchases"
    func restorePurchases() async {
        guard !isBusy else { return }
        isBusy = true
        statusMessage = nil
        defer { isBusy = false }

        do {
            try await AppStore.sync()
            await refreshCurrentEntitlements()
            statusMessage = isAdFree
                ? "Purchases restored! Forced ads are disabled."
                : "No previous Remove Ads purchase found for this Apple Account."
        } catch {
            statusMessage = "Could not connect to the App Store to restore purchases."
        }
    }

    private func persist(_ unlocked: Bool) {
        isAdFree = unlocked
        UserDefaults.standard.set(unlocked, forKey: cacheKey)
    }
}

Notice two subtle production details in refreshCurrentEntitlements(). First, Transaction.updates must start listening immediately inside init(): if a child triggers Apple Family Sharing Ask to Buy or a European buyer completes bank 3D Secure (SCA) outside the app, the delayed .verified transaction arrives asynchronously on next launch via Transaction.updates. Second, when Transaction.currentEntitlements returns zero records on an unauthenticated airplane-mode cold boot, we do not wipe out UserDefaults (persist(false) only fires if a revoked record is observed or if you choose to reconcile after an authenticated AppStore.sync()).

Why does Google Play billing V8 silently auto-refund one-time purchases after 3 days?

Google Play requires every non-consumable INAPP purchase (Remove Forced Ads, Pro Upgrade, Level Pack) to be acknowledged within 3 days via billingClient.acknowledgePurchase (or server-side purchases.products.acknowledge); otherwise Google automatically cancels the order, refunds 100% of the customer's payment, and revokes the purchase token.

Engineers migrating from consumables (where consumeAsync implicitly acknowledges delivery) or coming from iOS often set isAdFree = true inside onPurchasesUpdated and stop. Worse, Google Play License Tester accounts compress the unacknowledged refund timer from 3 days to 5 minutes: tricking developers into assuming test purchases simply auto-reset for convenience! In production, customers buy your $2.99 Remove Ads unlock on Friday, and by Monday Play Console fills with Canceled orders and $0.00 net proceeds.

Google Play Billing Library v8 (8.0.0+) adds three mandatory wiring rules alongside acknowledgment:

  1. PendingPurchasesParams builder: The no-arg enablePendingPurchases() is removed in v8. Pass PendingPurchasesParams.newBuilder().enableOneTimeProducts().build() and chain .enableAutoServiceReconnection() so Play Store restarts do not drop queryPurchasesAsync calls.
  2. oneTimePurchaseOfferDetailsList selection: Play Billing v8 returns a list of offers per INAPP SKU. Pick the base offer (offerId == null with non-blank formattedPrice, falling back to the first valid offer) and pass its offerToken to BillingFlowParams.ProductDetailsParams.
  3. Strict PurchaseState.PURCHASED gate: Cash-voucher checkouts (OXXO, Boleto, Konbini) fire onPurchasesUpdated with PurchaseState.PENDING (2). Calling acknowledgePurchase on PENDING throws DEVELOPER_ERROR, and unlocking early grants free upgrades on unpaid vouchers.

How do you build an offline-safe Play billing V8 acknowledgment and restore flow in Kotlin?

Run an idempotent reconcileOwnedPurchases() routine both at app startup and after onPurchasesUpdated that checks purchaseState == PurchaseState.PURCHASED, calls acknowledgePurchase whenever !purchase.isAcknowledged, handles ITEM_ALREADY_OWNED by triggering a restore sweep, and preserves SharedPreferences state whenever billingResult.responseCode != BillingResponseCode.OK.

Here is the battle-tested Kotlin Coroutines implementation for Play Billing v8 (com.android.billingclient:billing-ktx:8.0.0):

class PlayBillingRemoveAdsManager(
    context: Context,
    private val removeAdsProductId: String,
) : PurchasesUpdatedListener {

    private val appContext = context.applicationContext
    private val prefs = appContext.getSharedPreferences("iap_entitlements", Context.MODE_PRIVATE)
    private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)

    private val _isAdFree = MutableStateFlow(prefs.getBoolean(KEY_AD_FREE, false))
    val isAdFree: StateFlow<Boolean> = _isAdFree.asStateFlow()

    private val billingClient: BillingClient = BillingClient.newBuilder(appContext)
        .setListener(this)
        .enablePendingPurchases(
            PendingPurchasesParams.newBuilder().enableOneTimeProducts().build()
        )
        .enableAutoServiceReconnection()
        .build()

    suspend fun reconcileOwnedPurchases(): Boolean {
        val params = QueryPurchasesParams.newBuilder()
            .setProductType(BillingClient.ProductType.INAPP)
            .build()

        val result = runCatching { billingClient.queryPurchasesAsync(params) }.getOrNull()
            ?: return _isAdFree.value // Exception / timeout: keep cached offline state!

        if (result.billingResult.responseCode != BillingClient.BillingResponseCode.OK) {
            // Airplane mode, Play Store updating, or logged-out Play Services: NEVER revoke!
            return _isAdFree.value
        }

        var entitled = false
        for (purchase in result.purchasesList) {
            if (purchase.products.contains(removeAdsProductId) &&
                purchase.purchaseState == Purchase.PurchaseState.PURCHASED
            ) {
                entitled = true
                if (!purchase.isAcknowledged) {
                    val ackParams = AcknowledgePurchaseParams.newBuilder()
                        .setPurchaseToken(purchase.purchaseToken)
                        .build()
                    val ackResult = billingClient.acknowledgePurchase(ackParams)
                    // If network drops mid-ack, next app launch retries automatically
                    if (ackResult.responseCode != BillingClient.BillingResponseCode.OK) {
                        // Log telemetry metric: billing_ack_retry_scheduled
                    }
                }
            }
        }

        // Safe to persist true OR false here because Play returned authoritative OK
        prefs.edit().putBoolean(KEY_AD_FREE, entitled).apply()
        _isAdFree.value = entitled
        return entitled
    }

    override fun onPurchasesUpdated(result: BillingResult, purchases: MutableList<Purchase>?) {
        when (result.responseCode) {
            BillingClient.BillingResponseCode.OK -> {
                val unlockedNow = purchases.orEmpty().any {
                    it.products.contains(removeAdsProductId) &&
                        it.purchaseState == Purchase.PurchaseState.PURCHASED
                }
                if (unlockedNow) {
                    // Optimistic instant UI tear-down of banners, followed by async ack
                    prefs.edit().putBoolean(KEY_AD_FREE, true).apply()
                    _isAdFree.value = true
                    scope.launch { reconcileOwnedPurchases() }
                }
            }
            BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED -> {
                // Reinstalled user tapped Buy instead of Restore: auto-recover seamlessly
                scope.launch { reconcileOwnedPurchases() }
            }
        }
    }

    companion object {
        private const val KEY_AD_FREE = "remove_forced_ads_owned"
    }
}

Why run acknowledgePurchase inside reconcileOwnedPurchases() on every cold launch as well as onPurchasesUpdated? Mobile connections frequently drop right as the Play checkout sheet closes. If a subway commuter buys Remove Ads offline-bound, SharedPreferences collapses banners immediately while the initial acknowledgePurchase network call fails; the next session launch inside the 72-hour window finishes acknowledgment automatically, driving 3-day auto-refunds to 0.0%.

How should remove forced ads interact with rewarded video boosters and offline Play?

Unlocking Remove Forced Ads ($2.99) must immediately collapse bottom Anchored Adaptive Banners and disable forced between-level Interstitials (stopping even background interstitial preload requests) while keeping user-initiated Rewarded boosters (+1 Extra Slot, Revive, Hint) available whenever the player chooses to tap them.

Keep three hybrid UX and telemetry rules aligned:

  • Clear paywall scope: Title the SKU "Remove Forced Ads" rather than "Remove All Ads" and state explicitly on the sheet that bottom banners and between-level interstitials are permanently removed while optional reward boosters remain available on tap.
  • Stop interstitial preloads: Once isAdFree == true, cancel interstitial retry timers and skip InterstitialAd.load() while still preloading RewardedAd. Eliminating unused interstitial bid requests improves your AdMob show rate, protecting auction priority, see our AdMob ad serving limit, UMP & app-ads.txt fix guide.
  • CI test flags: Support a debug-only launch flag (-adFreeDemo / BuildConfig.DEBUG toggle) so UI test suites verify both free and ad-free layouts cleanly alongside our GitHub Actions macOS runner minutes & cache guide.

Once your non-consumable IAP holds a 0% auto-refund rate and cleanly converts 1.5%–4% of active players, remember that a $2.99 checkout does not deposit $2.54 (85%) into your bank account in EU, UK, Korean, or Japanese storefronts. Walk through our App Store & Google Play payout vs gross sales VAT & FX breakdown and plug your regional split into the App Store, Google Play & AdMob Revenue Calculator to forecast exact net cash flow.

Independent engineering documentation: StackQuota is not affiliated with, endorsed by, or sponsored by Apple Inc. or Google LLC. StoreKit 2, App Review Guidelines, and Google Play Billing Library behaviors reflect public developer documentation as of December 2026.

Model your own stack numbersCalculate your net App Store, Google Play, and AdMob + IAP payout

Open Calculator →

Common edge cases

Why did Apple reject my StoreKit 2 app under Guideline 3.1.1 when entitlements sync automatically?

App Review requires an explicit user-facing Restore Purchases control on your paywall or Settings screen for every non-consumable and auto-renewable subscription. Reviewers test restoration on fresh sandbox devices where cached receipts can lag, and tapping your button must invoke try await AppStore.sync() before re-reading Transaction.currentEntitlements.

Why are my Google Play Remove Ads purchases automatically refunded after 3 days?

Google Play treats every unacknowledged INAPP or SUBS transaction as incomplete and triggers an automatic full refund 72 hours after checkout. For non-consumables like Remove Forced Ads, you must verify purchase.isAcknowledged == false and call billingClient.acknowledgePurchase both in your purchase callback and during startup recovery.

Should I call AppStore.sync() automatically on every iOS app launch?

Never call AppStore.sync() on cold launch. Unlike Transaction.currentEntitlements, AppStore.sync() forces a live App Store server round-trip that can trigger an OS-level Apple ID password or Face ID system dialog, ruining onboarding conversion and violating Apple's human interface guidelines.

What changed1
  • 2026-12-04: Verified against GMA SDK / UMP consent requirements, StoreKit 2, Google Play Billing Library v8, and store tax settlement schedules in December 2026.
Sources checked3

Spotted a provider quota or SDK change since 4 Dec 2026? Send a verification note →

Related troubleshooting runbooks