/unity-dev:unity-iapfrom unity-dev
Guides Unity developers through In-App Purchasing v5: catalogue setup, purchase flow, receipt validation, restore, subscriptions, and migration from v4. Includes symptom-to-reference routing and platform-specific notes.
Ships in unity-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Every v5 purchase arrives as a question. The store hands you a
PendingOrder; you grant the content, save it, and only then answer withConfirmPurchase. A question you never answer comes back on the next launch — which is the safe failure. A question you answer before the grant is saved is money the player spent on nothing, and the store will not ask again.
| Symptom | Go to |
|---|---|
| "add IAP to this game"; deciding what to do at all — existing SDK, native bridge, v4, nothing | reference/pre-check.md, then The working contract |
| Converting a native BillingClient or StoreKit bridge, or a third-party billing SDK | reference/pre-check.md routes to the path-convert-* / convert-* file |
OnStoreConnectionFailed or product.hasReceipt does not compile | §8 — shapes that do not exist |
| Products list is empty, or prices are stale | §2 |
| The same purchase is granted twice | §3 |
| A purchase re-appears on every launch | §3 — it was never confirmed |
| Player paid, got nothing | §3 — confirmed before the grant was saved |
| Ask-to-Buy purchases never arrive | §1 — OnPurchaseDeferred was not subscribed |
| Non-consumables lost after reinstall | §4 |
| Apple receipt validates to an empty array | §5 |
IsSubscribed() will not cast to bool | §6 |
CS1061 on a failure description | §7 |
IStoreListener / ConfigurationBuilder code | reference/migration-v4-to-v5.md |
| Apple promotions, Ask-to-Buy simulation, Google subscription upgrades | reference/platform-notes.md |
Assets/Resources/IAPProductCatalog.json edits, codeless race | reference/codeless-catalog.md |
| A third-party payment provider: Stripe / Coda / webshop checkout | reference/path-implement-iap-d2c.md |
Scan, then route. Two billing systems on one device fight over the same callback slot and one of them silently loses purchases, so the first job is finding out what is already there: third-party SDK, native bridge, IAP v4, IAP v5, a codeless catalogue.
reference/pre-check.mdis the scan and the routing table. Resolve it before opening any other file here, and report what you found and where it routes before writing code.
com.unity.purchasing changes the
Android dependency graph. Say which version is needed and let them do it through Package Manager.com.unity.purchasing in Packages/manifest.json (namespaces
UnityEngine.Purchasing, .Security); without it UnityIAPServices and StoreController do
not resolve. 5.4 is the floor for the payment-provider and OnAuthAccountChanged features.IAP has its own entry point: no UnityServices.InitializeAsync() needed, though it coexists with
one; with Analytics initialized, transaction events are forwarded automatically.
m_Store = UnityIAPServices.StoreController(); // or DefaultStore/DefaultProduct/DefaultPurchase
// ... every event subscribed here ...
await m_Store.Connect(); // OnStoreConnected → FetchProducts → OnProductsFetched
Connect()can raise handlers before it returns. A purchase left unconfirmed by a previous session is re-delivered as soon as the store connects. Subscribe inAwake(), beforeConnect(), or that re-delivery lands on nobody and the player's content is gone until the next launch.
Subscribe both halves of every asynchronous call (reference/api-notes.md): a missing failure
handler only logs a runtime warning, and the failure disappears.
OnPurchaseDeferred has no failure twin and is easy to skip. It carries Ask-to-Buy (a child
account waiting on a parent) and Google Play's deferred payments; unsubscribed, those purchases are
dropped without a trace. Subscribe it, show a pending state, and grant nothing — the approved
purchase arrives later through OnPurchasePending.
OnAuthAccountChanged (v5.4+) empties both caches before it fires. Held Product and Order
references are stale and GetProducts() / GetPurchases() return nothing inside the handler, so
re-run the fetch sequence from the start. Full initialization and the handler:
reference/api-notes.md.
| Call | What it reads |
|---|---|
GetProducts() / GetProductById(id) | The local cache. Synchronous. Empty or stale until a fetch has landed |
FetchProducts(List<ProductDefinition>) | The store. Refreshes prices and availability, then updates the cache |
GetPurchases() | The cached order list |
FetchPurchases() | The store, and replaces the cached list wholesale |
Display prices from product.metadata.localizedPriceString after OnProductsFetched, never a
hard-coded string — the store owns currency, formatting and tax.
Types are Consumable, NonConsumable, Subscription; per-store IDs go in StoreSpecificIds, a
large mapping in a CatalogProvider (reference/api-notes.md).
PurchaseProduct(product)
→ OnPurchasePending(pendingOrder)
→ validate → grant → SAVE
→ ConfirmPurchase(pendingOrder)
→ OnPurchaseConfirmed(order) // Order, not ConfirmedOrder — pattern-match it
Confirm after the save, never before. If the save fails, do not confirm. An unconfirmed order is re-delivered on the next launch and costs the player nothing; a confirmed order that was never persisted is unrecoverable.
OnPurchasePending may fire more than once for the same purchase — a crash between grant and
confirm guarantees it. Grant idempotently: keep a ledger of processed order IDs and skip a repeat
rather than crediting twice.
OnPurchaseConfirmed receives the Order base type: ConfirmedOrder stuck, FailedOrder
(with FailureReason, Details) did not — assuming success treats a failure as a sale.
Confirmed consumables never come back. FetchPurchases() returns non-consumables and
subscriptions only, so the store cannot tell you how many coin packs a player has bought. Consumable
balances are yours to persist — see unity-live-services for where that state belongs.
ProcessPendingOrdersOnPurchasesFetched(false) turns off the re-delivery that makes the flow safe;
leave it unless asked by name. The grant contract: reference/path-add-iap-to-new-project.md §5.
RestoreTransactions(callback) is required on iOS — Apple's review guidelines expect a
visible "Restore Purchases" button. Each restored purchase arrives through OnPurchasePending,
so the same grant path handles it. Offer the button only when the catalogue actually contains a
NonConsumable or Subscription.FetchPurchases() at startup is the routine path, and it re-delivers anything unconfirmed.
Explicit restore is for the button.CheckEntitlement(product) + OnCheckEntitlement is the ownership question when you have a
product but no order. Where you do hold the order, its type already answers.Code for each, the EntitlementStatus values and the order-type mapping:
reference/api-notes.md.
| Store | Where validation happens |
|---|---|
| Google Play | Locally, with CrossPlatformValidator(GooglePlayTangle.Data(), Application.identifier) |
| Apple App Store | On your server, from order.Info.Apple?.jwsRepresentation |
Under StoreKit 2 the Apple half of
CrossPlatformValidatordoes nothing. It returns an empty array without throwing or warning, which reads as "no receipts" or, depending on the caller, as "valid".AppleTangle.Data()is deprecated for the same reason. On Apple, the only real check is a server verifyingjwsRepresentationagainst Apple's App Store Server API.
Google tangle data is generated in the Editor under Services > In-App Purchasing > Receipt
Validation Obfuscator; it is per-project and belongs in the repo. An IAPSecurityException from
Validate means grant nothing. Both halves in code: reference/api-notes.md.
Subscription state hangs off order.Info.PurchasedProductInfo, not off CartItem — a
CartItem carries only Product and Quantity, and reaching for subscriptionInfo there is a
compile error.
IsSubscribed() returns a Result (True / False / Unsupported), not a bool. Compare with
== Result.True: null-safe through the whole order.Info…?.subscriptionInfo?. chain, and
Unsupported — a platform that does not know — never reads as active. ?? false does not compile.
Check subscription state at launch, not only at purchase: lapses, cancellations from the store's own
UI and refunds are not reported to your app when they happen. The access path and every state
method: reference/api-notes.md; platform differences in the dates:
reference/platform-notes.md.
Some failure-description types carry lowercase public fields alongside the PascalCase read-only
properties; where both exist, prefer the properties. Guessing across types is where CS1061 comes
from: StoreConnectionFailureDescription has .Message and no .reason; ProductFetchFailed has
.FailureReason and .FailedFetchProducts and no .Message. The full table:
reference/api-notes.md.
The compile is the only local gate. Then read for what still compiles or never existed:
[Obsolete] v4 shapes (IStoreListener, ConfigurationBuilder, GetExtension<T>()); names that
do not exist (OnStoreConnectionFailed → OnStoreDisconnected, product.receipt →
order.Info.Receipt, product.hasReceipt → CheckEntitlement, pendingOrder.OrderInfo →
.Info); every subscription before Connect(); an idempotent grant with ConfirmPurchase after
the save; IsSubscribed() compared to Result.True. The full list and the hand-back report:
reference/done-checklist.md. Sandbox testing is on the developer; nothing here proves a purchase works.
| Not here | Go to |
|---|---|
| Shipping seams: what the package adds to the merged Android manifest and the Gradle or CocoaPods build, store declarations, release-build sandbox behaviour — read before you submit | unity-live-services → reference/monetization.md |
Server-side entitlement: off-device receipt checks, the idempotent grant behind a retried request, consumable balances, the identity a purchase attaches to (this skill stops at sending order.Info.Receipt or jwsRepresentation) | unity-live-services |
| Environments, project linking, Editor deployment of a remote catalogue (the D2C path assumes both) | unity-ugs |
| Ad revenue and mediation · shop layout, price display, button states | unity-ads-levelplay · unity-ui-ugui or unity-game-ui |
| Pricing and monetisation design, store-side product creation, tax and compliance, a real payment | Not covered |
reference/pre-check.md is read first and routes to every path file: path-add-iap-to-new-project
(greenfield), migration-v4-to-v5, path-implement-iap-d2c, path-convert-native-google-billing,
path-convert-native-storekit, convert-essentialkit, convert-unipay, convert-revenuecat,
convert-adapty. API, platform and catalogue references are linked above.
reference/api-notes.md (opens in a new tab)reference/codeless-catalog.md (opens in a new tab)reference/convert-adapty.md (opens in a new tab)reference/convert-essentialkit.md (opens in a new tab)reference/convert-revenuecat.md (opens in a new tab)reference/convert-unipay.md (opens in a new tab)reference/done-checklist.md (opens in a new tab)reference/migration-v4-to-v5.md (opens in a new tab)reference/path-add-iap-to-new-project.md (opens in a new tab)reference/path-convert-native-google-billing.md (opens in a new tab)reference/path-convert-native-storekit.md (opens in a new tab)reference/path-implement-iap-d2c.md (opens in a new tab)reference/platform-notes.md (opens in a new tab)reference/pre-check.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub tipoli5890/game-studio --plugin unity-dev51 skills in this plugin
/unity-2d-animationSkeletal 2D characters: PSB rig, bones and weights, sprite swaps, 2D IK (2D Animation package)./unity-2d-controllerMove a 2D character: platformer jump, slopes, coyote time, moving platforms, top-down movement./unity-2d-gridGrid tactics and tile puzzles, hex or square: move range, A* paths, line of sight, turns, undo./unity-2d-level2D level layout as data: Tiled/LDtk import, rooms, endless chunks, seeded levels, jump reachability.