restorePurchases

Restore completed transactions. Use this to implement a "Restore Purchases" button for users who reinstall the app.

iOS: Triggers AppStore.sync() to refresh StoreKit's transaction state; restored purchases are then read via getAvailablePurchases (or directly via Transaction.currentEntitlements). Asks the user to authenticate. Apple docs. Android: Calls queryPurchasesAsync for both INAPP and SUBS. No system-level UI prompt — Play has no concept of an explicit "restore" action. Google docs.

Signature

swift
func restorePurchases() async throws

Returns#

Promise<void> — Resolves once the platform finishes the restore. The restored purchases are emitted via purchaseUpdatedListener / surface as getAvailablePurchases results, depending on platform. In MAUI/C#, RestorePurchasesAsync returns Task<VoidResult>. Godot returns a VoidResult; check success because a failed store query must not be treated as a successful restore.

Example

swift
try await OpenIapModule.shared.restorePurchases()