Expand description
StoreKit 2 in-app purchases as Bevy resources + messages.
Flow:
- On iOS, read
AppStoreEnvironmentto choose non-production service configuration for Xcode, sandbox, or unavailable execution. Wait while it isAppStoreEnvironment::Pending. The resource is absent off iOS. - Insert
StoreConfigwith your product ids. The plugin calls into the backend once, which fetches products and the current entitlements. - Read
StoreProductsfor prices/titles to render your store UI. - Send
PurchaseRequest/RestoreRequestto act. - React to
PurchaseCompleted/EntitlementsChanged, or just read theEntitlementsresource —owns(id)is the source of truth and covers fresh purchases, restores, and already-owned-on-relaunch alike.
Structs§
- Entitlements
- The set of currently-entitled product ids (non-consumables + active subs).
owns(id)is the gate to use everywhere — it stays correct across purchase, restore, and relaunch. - Entitlements
Changed - Emitted when the entitlement set changes. Read
Entitlementsfor the new state. - Product
Info - One purchasable product, as reported by StoreKit (localized price/title).
- Products
Updated - Emitted when the catalogue state or contents change.
- Purchase
Completed - Emitted once per purchase attempt when it reaches a terminal state.
- Purchase
Request - Request a purchase of the given product id.
- Restore
Request - Request restoration of past purchases (
AppStore.sync()). - Store
Config - The product ids to offer. Insert before or after adding the plugin; the store initializes on the first frame it sees a non-empty config.
- Store
Plugin - Store
Products - The fetched catalogue. Mirrors the backend; read-only to consumers.
Enums§
- AppStore
Environment - The environment reported by the verified StoreKit 2 app transaction.
- Products
State - Loading state of the product catalogue.
- Purchase
Outcome - Terminal result of a purchase attempt.