Restore Previous Purchases
Last updated
Restore non-consumables and subscriptions (for example after reinstall or on a new device).
BillingServicesInitializeStore
Load product catalog
BillingServicesRestorePurchases
Trigger restore process
BillingServicesOnRestorePurchasesComplete
Listen for restore completion
BillingServicesGetRestorePurchasesSuccessResult
Get restored count
BillingServicesGetRestoredTransactionInfo
Read restored transaction details
BillingServicesFinishTransactions
Finish restored transactions
BillingServicesGetRestorePurchasesError
Read cached restore error after failure (optional)
restoredCount (Int)
transactionIndex (Int)
productId (String)
receiptVerificationState (Enum: BillingReceiptVerificationState)
Run BillingServicesInitializeStore and wait for successEvent.
Run BillingServicesOnRestorePurchasesComplete in a state that stays active (for example in your settings scene while the restore flow runs).
This action is what fires the completion events and caches data for the extractor actions.
Run BillingServicesRestorePurchases (forceRefresh optional).
Your BillingServicesOnRestorePurchasesComplete listener will fire:
successEvent → GetRestoreResult
failureEvent → (Optional) BillingServicesGetRestorePurchasesError
Run BillingServicesGetRestorePurchasesSuccessResult → restoredCount.
Loop transactionIndex = 0..restoredCount-1:
BillingServicesGetRestoredTransactionInfo(transactionIndex) → productId, transactionState, receiptVerificationState
Grant content only when:
transactionState == Purchased
receiptVerificationState == Success
If verification failed, do not restore the entitlement
Run BillingServicesFinishTransactions (either finish all cached/pending, or only the restored IDs you collected).
Consumables are not restorable (by design).
Prefer showing restore from a Settings screen rather than auto-restoring every launch.
Restored purchases should still pass local verification. A restored transaction that is not ReceiptVerificationState.Success should not grant content.
Last updated