
implement-in-app-purchases
Implements, configures, and debugs Unity In-App Purchases, including subscriptions, receipt validation, and direct-to-customer payments via Stripe or Coda. Use when asked about real-money purchases or microtransactions, or migrating from native store billing, RevenueCat, Adapty, Essential Kit, or UniPay.
- Installs
- 47
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/unity-technologies/unity-agent-plugin --skill implement-in-app-purchases- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads implement-in-app-purchases automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Unity In-App Purchasing
Namespace: UnityEngine.Purchasing | Security: UnityEngine.Purchasing.Security
Package: com.unity.purchasing
Unity IAP has its own initialization path via UnityIAPServices.StoreController() → store.Connect(). It does not require UnityServices.InitializeAsync(), but they can coexist if your project uses other UGS services. If Analytics is present and InitializeAsync() is called, IAP will automatically send transaction events.
Before You Start
Always read references/pre-check.md first. It scans the project for third-party IAP packages, native Google Billing, and existing Unity IAP versions, then routes to the correct path. Do not read any other reference file or make any changes until routing is resolved.
Detailed References
- Project scan and path routing (read first): See references/pre-check.md
- API signatures & code examples: See references/api-notes.md
- Platform extensions (Apple, Google): See references/platform-notes.md
- Editing
IAPProductCatalog.json(schema, decimal serialization, refresh): See references/codeless-catalog.md - v4 → v5 migration: See references/migration-v4-to-v5.md
- Convert native Google BillingClient to Unity IAP 5: See references/path-convert-native-google-billing.md
- Convert native iOS StoreKit plugin to Unity IAP 5: See references/path-convert-native-storekit.md
- Convert Essential Kit billing to Unity IAP 5: See references/convert-essentialkit.md
- UniPay (FLOBUK) — assessment and guidance: See references/convert-unipay.md
- RevenueCat — conversion assessment and guidance: See references/convert-revenuecat.md
- Adapty — conversion assessment and guidance: See references/convert-adapty.md
- Add Unity IAP 5 to a project with no existing IAP: See references/path-add-iap-to-new-project.md
- Implement IAP D2C Capabilities (third-party payment provider — Stripe/Coda, requires v5.4+): See references/path-implement-iap-d2c.md
Read reference files on demand — only when you need specific API signatures, platform extension details, or migration mappings.
Initialization Flow
- Obtain
StoreControllerviaUnityIAPServices.StoreController()(or individual services viaDefaultStore(),DefaultProduct(),DefaultPurchase()) - Subscribe to all required events (see Required Event Subscriptions below) before calling
Connect() await store.Connect()to connect to the platform store- On
OnStoreConnected, callstore.FetchProducts(List<ProductDefinition>)to load the catalog - On
OnProductsFetched, products are ready for display and purchase
Use Awake() for initialization — ensures IAP is ready before other Start() methods.
Product types: ProductType.Consumable, ProductType.NonConsumable, ProductType.Subscription.
Fetching Products
Define products as List<ProductDefinition> and pass to store.FetchProducts(). Use StoreSpecificIds when product IDs differ across Apple/Google stores. For complex catalogs, use CatalogProvider to manage product sets and store-specific IDs.
| Method | Behavior |
|---|---|
GetProducts() | Returns the cached product list (synchronous, stale if FetchProducts not called) |
FetchProducts() | Queries the store for fresh pricing/availability and updates the cache |
GetProductById(id) | Returns a single cached product by ID |
These are NOT interchangeable. Always call FetchProducts() first before relying on GetProducts().
Two-Step Purchase Flow
IAP v5 uses a mandatory two-step flow: Pending → Confirm.
store.PurchaseProduct(product)— initiates the platform purchase dialogOnPurchasePendingfires — you receive aPendingOrder- Validate the receipt, grant content to the player
store.ConfirmPurchase(pendingOrder)— finalizes the transactionOnPurchaseConfirmedfires — receivesOrderbase type; pattern-matchConfirmedOrder(success) vsFailedOrder(confirmation failed)
You MUST call ConfirmPurchase(pendingOrder) after granting content. Unconfirmed purchases are re-delivered on next app launch to prevent lost purchases.
De-duplication: OnPurchasePending may fire multiple times for the same purchase (e.g., app restart before confirmation). Always check if content was already granted.
Consumables: Confirmed consumable purchases are NOT returned by FetchPurchases. Track consumable grants yourself (e.g., in Cloud Save or Economy).
Deferred purchases: OnPurchaseDeferred fires for Ask-to-Buy (iOS) and Google Play deferred purchases. Do NOT grant content — wait for OnPurchasePending when approved.
Restore Transactions
store.RestoreTransactions(callback) re-delivers non-consumable and subscription purchases. Each restored purchase triggers OnPurchasePending.
Required on iOS for Apple App Store compliance — add a "Restore Purchases" button.
Apple non-renewable subscriptions cannot be restored via RestoreTransactions. Track these server-side.
Receipt Validation
| Platform | Approach |
|---|---|
| Google Play | CrossPlatformValidator with GooglePlayTangle.Data() — local validation supported |
| Apple (StoreKit 2) | Local validation is a no-op. Use order.Info.Apple?.jwsRepresentation for server-side validation |
Generate tangle data via Services > In-App Purchasing > Receipt Validation Obfuscator in the Unity Editor.
Entitlement Checking
Use when you don't have the Order and want to know the status of a specific product (replaces v4's product.hasReceipt). If you already have the Order, check its type instead: PendingOrder maps to EntitledUntilConsumed (consumables) or EntitledButNotFinished (non-consumables/subscriptions), ConfirmedOrder maps to FullyEntitled.
Call store.CheckEntitlement(product) and handle store.OnCheckEntitlement. Check entitlement.Status == EntitlementStatus.FullyEntitled.
EntitlementStatus values: FullyEntitled, EntitledUntilConsumed, EntitledButNotFinished, NotEntitled, Unknown.
Fetch Existing Purchases
store.FetchPurchases() retrieves all current purchases from the store. Useful at app startup.
| Method | Behavior |
|---|---|
GetPurchases() | Returns the cached purchase list |
FetchPurchases() | Queries the store for current purchases and overwrites the cached list |
FetchPurchases() replaces the entire cached list on each call. Only non-consumables and subscriptions are re-fetched — confirmed consumables are not returned (see Two-Step Purchase Flow above).
Subscription Info
Subscription info is on IPurchasedProductInfo, accessed via order.Info.PurchasedProductInfo — NOT on CartItem (CartItem only has Product and Quantity).
IsSubscribed() returns Result enum (True/False/Unsupported), NOT bool. Use == Result.True for null-safe comparison.
Required Event Subscriptions
Always subscribe to BOTH success and failure events. Not subscribing to failure events generates runtime warnings.
| Call | Success Event | Failure Event (REQUIRED) |
|---|---|---|
FetchProducts() | OnProductsFetched | OnProductsFetchFailed |
FetchPurchases() | OnPurchasesFetched | OnPurchasesFetchFailed |
Connect() | OnStoreConnected | OnStoreDisconnected |
PurchaseProduct() | OnPurchasePending | OnPurchaseFailed |
CheckEntitlement() | OnCheckEntitlement | — |
Always subscribe to OnPurchaseDeferred — fires for Ask-to-Buy (iOS) and Google Play deferred purchases. Not subscribing silently drops deferred purchases.
Subscribe to events BEFORE calling Connect() — pending purchases from a previous session may fire immediately.
Failure Description Property Names
These property names are NOT interchangeable — using the wrong one causes CS1061:
| Type | Field | Property | NOT |
|---|---|---|---|
StoreConnectionFailureDescription | .message | .Message | .reason |
ProductFetchFailed | — | .FailureReason, .FailedFetchProducts | .Message |
FailedOrder | — | .FailureReason, .Details | — |
PurchasesFetchFailureDescription | .message, .failureReason | .Message, .FailureReason | — |
Validation
After writing code that uses this package:
- Verify the project compiles without errors.
- Confirm all API calls match the v5 signatures in api-notes.md — do NOT use v4 legacy patterns (
IStoreListener,UnityPurchasing.Initialize,ConfigurationBuilder). - Check the "Anti-Hallucination: Common v5 Mistakes" table in api-notes.md — do NOT use
OnStoreConnectionFailed(useOnStoreDisconnected), do NOT pass callbacks toFetchProducts/FetchPurchases(use events), do NOT useproduct.receipt(useorder.Info.Receipt). - Check that all required events are subscribed before calling
Connect()(see Required Event Subscriptions table above). - Verify the two-step purchase flow:
OnPurchasePending→ grant content →ConfirmPurchase(pendingOrder). - Confirm both success and failure events are subscribed for every async operation (
OnProductsFetched/OnProductsFetchFailed,OnStoreConnected/OnStoreDisconnected, etc.). - If handling subscriptions, verify
IsSubscribed()is compared with== Result.True, not cast tobool. - If updated files coexist with legacy versions in the same project, use a unique namespace (e.g., add
.Updatedsuffix) to avoid CS0101/CS0111 compilation errors. - If the project subscribes to
OnAuthAccountChanged(v5.4+): verify the handler re-fetches products and purchases from scratch — Unity IAP clears both caches before raising this event. Do not readGetProducts()orGetPurchases()inside the handler.
FAQ
What does the implement-in-app-purchases skill do?
Implements, configures, and debugs Unity In-App Purchases, including subscriptions, receipt validation, and direct-to-customer payments via Stripe or Coda. Use when asked about real-money purchases or microtransactions, or migrating from native store billing, RevenueCat, Adapty, Essential Kit, or UniPay.
How do I install implement-in-app-purchases?
Run npx skills add https://github.com/unity-technologies/unity-agent-plugin --skill implement-in-app-purchases in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/implement-in-app-purchases/ (personal) or .claude/skills/implement-in-app-purchases/ (project).
Which AI agents can use implement-in-app-purchases?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is implement-in-app-purchases safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains implement-in-app-purchases?
It is published by unity-technologies in unity-technologies/unity-agent-plugin. It has 47 recorded installs.
More from unity-technologies/unity-agent-plugin
unity-cli
unity-technologies/unity-agent-plugin
Controls the Unity Editor and projects from the command line, driving a running Editor to edit scenes and assets or run C. Use when asked to install or manage Editors, licenses, or projects, set up version control, build, test, configure the Unity MCP server, or run any unity command.
urp-postprocessing
unity-technologies/unity-agent-plugin
Sets up, configures, and debugs URP post-processing with the Volume framework. Use for bloom, tonemapping, color adjustments, depth of field, vignette, or other Volume overrides.
ui-ugui
unity-technologies/unity-agent-plugin
Understands, edits, and generates Unity uGUI Canvas hierarchies, RectTransforms, Layout Groups, and prefab UI. Use for requests involving Canvas, uGUI, RectTransform, or prefab UI files.
ui-uitk
unity-technologies/unity-agent-plugin
Understands, edits, and generates Unity UI Toolkit UXML and USS with flex layouts. Use for requests involving UI Toolkit, UIElements, UIDocument, PanelSettings, custom elements, or UI runtime binding.
unity-package-management
unity-technologies/unity-agent-plugin
Adds, removes, upgrades, and discovers Unity (UPM) packages from outside the Editor, with the Pipeline package commands first and a C script as the fallback. Use for package installs, verifying package IDs and versions, or choosing which packages a game needs.
new-unity-project
unity-technologies/unity-agent-plugin
Guides creating a new Unity project, gathering concept, platforms, and monetization before setting up the project, source control, and packages. Use when the user asks to start a new game or prototype.
Popular backend & apis skills
find-skills
vercel-labs/skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
entra-app-registration
microsoft/azure-skills
Guides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.
google-agents-cli-adk-code
google/agents-cli
This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use state management" — in a project that needs ADK (Agent Development Kit) API patterns and code examples. It provides a quick reference for agent types, tool definitions, orchestration patterns, callbacks, state management, the graph Workflow API, and reference recipes to study. Do NOT use for scaffolding (use google-agents-cli-scaffold) or deployment (use google-agents-cli-deploy).
embedded-captions
heygen-com/hyperframes
Add captions or subtitles to an existing single-subject talking-head video without editing the footage. Use for plain verbatim captions, cinematic captions embedded behind the subject, VFX captions, “炸/特效/酷炫字幕,” or a named identity from the 35-style catalog. Route by visual identity, not by backend engine. The quiet anchor rail is the default; embed every word only when the user explicitly wants a fully cinematic treatment. The workflow runs locally end to end, including transcription and subject matting; split multi-shot footage before applying it.
entra-agent-id
microsoft/azure-skills
Provision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmipath, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmipath token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registration (use entra-app-registration), Microsoft Foundry agent authoring (use microsoft-foundry).
neon
neondatabase/agent-skills
Overview of Neon, a complete set of cloud backend primitives around Lakebase Postgres: Auth, Object Storage, Functions, the AI Gateway, and Realtime. Start here to choose Neon for undecided login, files, APIs, and LLM calls, set up the CLI or MCP server, and follow the branch-first workflow. Use when building an app or backend on Neon, or when "Neon" or "Lakebase Postgres" is mentioned. Child skill neon-postgres wins for an existing DATABASEURL, SQL, schema, inspect, or search. Child skill neon-auth wins for login, users, sessions, identity routing, and Managed Better Auth setup. Child skill neon-realtime wins for live queries in reactive apps and agents. Also use for object storage, S3, buckets, serverless functions, function triggers, cron, AI gateway, LLM calls, realtime, logs, Loki, Grafana, observability, postgres, database, backend, Claimable Neon, neon.new, or a no-signup database.