In-app purchases (Unity)
FRVRSDK.IAP lets a Unity WebGL build transact through whichever store the host channel uses (Facebook IAP, Apple IAP, Google Play Billing, etc.). You don’t pick the provider — the channel injected for that release does.
The wrapper methods return/receive JSON strings (not typed objects). You parse them yourself.
Is it ready?
Section titled “Is it ready?”Call this before you try to populate a shop UI or show buy buttons — the catalog takes a moment to resolve on session start.
Read the catalog
Section titled “Read the catalog”Specific product details + price lookup (handy for buttons):
Use GetProductPrice directly in button labels — it’s already in the player’s local currency from the store.
Purchase
Section titled “Purchase”Only consume consumable products (coins, lives, single‑use boosters). Permanent unlocks (remove‑ads, skins) must not be consumed — they’d become re‑buyable.
In Editor simulation the Purchase callback returns {"productId":"<id>","purchaseId":"testPurchaseId"} — a stripped object with only those two fields — so don’t rely on every production field being present when running in playmode.
Recover crashes on startup
Section titled “Recover crashes on startup”If the game crashed between a successful purchase and granting the content, the receipt stays pending. Check at boot — GetUnconsumedPurchases is async and delivers the array via callback:
Restore purchases
Section titled “Restore purchases”For non‑consumable entitlements (remove‑ads, permanent skins) the host channel can be asked to replay the player’s history. Use this from a “Restore purchases” button or — on iOS WebView — at first launch:
RestorePurchases is a no‑op on channels that don’t expose a restore flow; the callback fires with "[]".
Related
Section titled “Related”- Product catalog setup, error semantics, consumable vs. durable: Web SDK IAP reference.