Implement In App Purchases logo

Implement In App Purchases

OrganizationPopular
Unity-Technologies
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.

Overview

PublisherUnity-Technologies
Repositoryskills
Skill nameimplement-in-app-purchases
Stars
1K
Forks
61
Bundled files
13
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 13 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by Unity-Technologies on GitHub. Read the source before you install it.

Installation

Install the Implement In App Purchases AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Unity-Technologies/skills/tree/main/skills/implement-in-app-purchases
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Unity-Technologies/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/implement-in-app-purchases .claude/skills/implement-in-app-purchases
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Implement In App Purchases in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Implement In App Purchases on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Implement In App Purchases is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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

Read reference files on demand — only when you need specific API signatures, platform extension details, or migration mappings.

Initialization Flow

  1. Obtain StoreController via UnityIAPServices.StoreController() (or individual services via DefaultStore(), DefaultProduct(), DefaultPurchase())
  2. Subscribe to all required events (see Required Event Subscriptions below) before calling Connect()
  3. await store.Connect() to connect to the platform store
  4. On OnStoreConnected, call store.FetchProducts(List<ProductDefinition>) to load the catalog
  5. 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.

MethodBehavior
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.

  1. store.PurchaseProduct(product) — initiates the platform purchase dialog
  2. OnPurchasePending fires — you receive a PendingOrder
  3. Validate the receipt, grant content to the player
  4. store.ConfirmPurchase(pendingOrder) — finalizes the transaction
  5. OnPurchaseConfirmed fires — receives Order base type; pattern-match ConfirmedOrder (success) vs FailedOrder (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

PlatformApproach
Google PlayCrossPlatformValidator 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.

MethodBehavior
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.

CallSuccess EventFailure Event (REQUIRED)
FetchProducts()OnProductsFetchedOnProductsFetchFailed
FetchPurchases()OnPurchasesFetchedOnPurchasesFetchFailed
Connect()OnStoreConnectedOnStoreDisconnected
PurchaseProduct()OnPurchasePendingOnPurchaseFailed
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:

TypeFieldPropertyNOT
StoreConnectionFailureDescription.message.Message.reason
ProductFetchFailed—.FailureReason, .FailedFetchProducts.Message
FailedOrder—.FailureReason, .Details—
PurchasesFetchFailureDescription.message, .failureReason.Message, .FailureReason—

Validation

After writing code that uses this package:

  1. Verify the project compiles without errors.
  2. Confirm all API calls match the v5 signatures in api-notes.md — do NOT use v4 legacy patterns (IStoreListener, UnityPurchasing.Initialize, ConfigurationBuilder).
  3. Check the "Anti-Hallucination: Common v5 Mistakes" table in api-notes.md — do NOT use OnStoreConnectionFailed (use OnStoreDisconnected), do NOT pass callbacks to FetchProducts/FetchPurchases (use events), do NOT use product.receipt (use order.Info.Receipt).
  4. Check that all required events are subscribed before calling Connect() (see Required Event Subscriptions table above).
  5. Verify the two-step purchase flow: OnPurchasePending → grant content → ConfirmPurchase(pendingOrder).
  6. Confirm both success and failure events are subscribed for every async operation (OnProductsFetched/OnProductsFetchFailed, OnStoreConnected/OnStoreDisconnected, etc.).
  7. If handling subscriptions, verify IsSubscribed() is compared with == Result.True, not cast to bool.
  8. If updated files coexist with legacy versions in the same project, use a unique namespace (e.g., add .Updated suffix) to avoid CS0101/CS0111 compilation errors.
  9. 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 read GetProducts() or GetPurchases() inside the handler.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Implement In App Purchases AI 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.

Why use Implement In App Purchases on TypingMind?

Because you install it once and use it with any model. Implement In App Purchases is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Implement In App Purchases in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Unity-Technologies/skills/tree/main/skills/implement-in-app-purchases. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Implement In App Purchases?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Implement In App Purchases?

As many as you like. As long as a model supports skills, you can use Implement In App Purchases with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Implement In App Purchases AI skill free?

It is published on GitHub by Unity-Technologies. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇