Introduction to the IAP AI skill
Understand what the In-App Purchasing AI skill does, which AI assistants support it, and how to prompt it safely.
Read time 5 minutesLast updated a day ago
Starting in IAP version 5.3.0, the In-App Purchasing (IAP) package includes an AI skill that helps you migrate to and integrate Unity IAP v5. A skill is a set of instructions that a compatible AI assistant loads when your request matches the task the skill describes. As a result, a general-purpose assistant follows Unity's current v5 procedures instead of writing code from memory.
You install the skill into a compatible AI assistant, then prompt it in plain language to perform a migration or integration. The skill inspects your project to identify the billing system already present and selects one task path. For the full list of tasks the skill supports, refer to IAP AI skill capabilities reference.
To install the skill and run it, refer to Install and use the IAP AI skill.
How the skill works
Every task follows the same principles.
- Scan first: Before the skill writes anything, it inspects files such as , C# scripts, and Gradle templates to identify the billing system already present, then selects one task path.
manifest.json - Report before changes: For migrations and conversions, the skill produces a report that describes what it found, what it changes, any blockers, and the manual steps you must complete. It doesn't edit code until you approve the report.
- Guard and verify: The skill places risky changes behind compiler flags so you can roll them back, and it rechecks the generated code against the v5 API.
#if
Compatible AI assistants
You can use the skill with any AI assistant that supports the skill format. How you make the assistant aware of the skill depends on the assistant:
SKILL.md- Unity AI Assistant and Unity AI Desktop: If you subscribe to either product, the skill is built in and you don't need to install it. Prompt the assistant with a keyword such as or
in-app purchase, and the assistant activates the skill automatically. Use Agent mode when you want the assistant to create or modify scripts and scenes.migrate native billing - Claude Code: Install the skill directly from the Unity Editor. Claude Code activates the skill automatically when your request matches its description, so you don't need to name any file.
- Other AI assistants: For assistants such as OpenAI Codex, copy the skill into your project from the skill folder, then either reference the file at the start of each prompt or register it in the assistant's configuration file so that it loads for every session.
SKILL.md
For the install steps for each option, refer to Install and use the IAP AI skill.
Best practices for safe use
Purchase code handles real transactions, so review the skill's output before you release your game. Follow these practices for every task:
- Work on a branch: Keep a clean rollback so you can revert the skill's changes with Git.
- Read the report before you approve it: Every migration and conversion produces a report of changes, blockers, and manual steps. Review it rather than approving it unread.
- Grant and save before you confirm: Unity IAP v5 delivers each purchase as a pending order that you fulfill and then confirm, so grant and persist the reward before you call . An unconfirmed purchase re-delivers safely, but a confirmed purchase that you didn't save is lost. For more information, refer to Purchases.
ConfirmPurchase - Handle success and failure events: Subscribe to both the success and failure events for every purchase, and to for Ask to Buy.
OnPurchaseDeferred - Confirm that the code targets v5: The v4 types ,
IStoreListener, andUnityPurchasing.Initializedon't exist in v5, so reject any output that uses them and confirm that the assistant loaded the skill. To check the rest of the output, compare it against the API mapping tables in Upgrade from IAP v4 to v5.ConfigurationBuilder - Test on a real device: Compile, then test purchases on a device with a sandbox or test account. The Editor doesn't reproduce pending, deferred, or restore purchase behavior.
Example prompts
Prompt the assistant in plain language. The following table shows a starting prompt for each common goal. For the details that every prompt needs to produce accurate results, refer to Write an effective prompt.
Goal | Example prompt |
|---|---|
| Add IAP to a project | |
| Migrate v4 to v5 | |
| Convert a Google Play billing integration | |
| Integrate D2C payment providers | |
| Edit the Codeless catalog | |