In order to use in-app purchases, your app must provide a list of Products for sale. You can do this through scripting, or using the Codeless IAP Catalog (Window > Unity IAPAbbreviation of Unity In App Purchase
See in Glossary > IAP Catalog). Whichever implementation you use, you must define the appropriate attributes for each Product. This page covers these attributes in detail.
Enter a cross-platform unique identifier to serve as the Product’s default ID when communicating with an app store.
Important: The ID may only contain lowercase letters, numbers, underscores, or periods.
Each Product must be of one of the following Types:
Type | Description | Examples |
---|---|---|
Consumable | Users can purchase the Product repeatedly. Consumable Products cannot be restored. | * Virtual currencies * Health potions * Temporary power-ups. |
Non-Consumable | Users can only purchased the Product once. Non-Consumable Products can be restored. | * Weapons or armor * Access to extra content |
Subscription | Users can access the Product for a finite period of time. Subscription Products can be restored. | * Monthly access to an online game * VIP status granting daily bonuses * A free trial |
Note: For more information on Subscription type support, see the section on Subscription Product support.
This section defines the metadata associated with your Product for use in an in-game store.
Use the following fields to add descriptive text for your Product:
Field | Data type | Description | Example |
---|---|---|---|
Product Locale | Enum | Determines the app stores available in your region. | English (U.S.) (Google Play, Apple) |
Product Title | String | The name of your Product as it appears in an app store. | “Health Potion” |
Product Description | String | The descriptive text for your Product as it appears in an app store, usually an explanation of what the Product is. | “Restores 50 HP.” |
Add Translations for the Title and Description fields by clicking the plus (+) icon and selecting an additional locale. You can add as many translations as you like.
Use this section to add local, fixed definitions for the content you pay out to the purchaser. Payouts make it easier to manage in-game wallets or inventories. By labeling a Product with a name and quantity, developers can quickly adjust in-game counts of certain item types upon purchase (for example, coins or gems).
Note: This functionality is only available in Unity 2017.2 or higher.
Field | Data type | Description | Example |
---|---|---|---|
Payout Type | Enum | Defines the category of content the purchaser receives. There are four possible Types. | * Currency * Item * Resource * Other |
Payout Subtype | String | Provides a level of granularity to the content category. | * “Gold” and “Silver” subtypes of a Currency type * “Potion” and “Boost” subtypes of an Item type |
Quantity | Int | Specifies the number of items, currency, and so on, that the purchaser receives in the payout. | * 1 * >25 * 100 |
Data | Use this field any way you like as a property to reference in code. | * Flag for a UI element * Item rarity |
Note: You can add multiple Payouts to a single Product.
For more information on the PayoutDefinition class, see the Scripting Reference. You can always add Payout information to a Product in a script using this class. For example:
using UnityEngine.Purchasing;
new PayoutDefinition (PayoutType.Currency, "Gold", 100)
Note that the IAP Catalog acts as a Product catalog dictionary, not as an inventory manager. You must still implement the code that handles conveyance of the purchased content.
By default, Unity IAP assumes that your Product has the same identifier (specified in the ID field, above) across all app stores. Unity recommends doing this where possible. However, there are occasions when this is not possible, such as when publishing to both iOS and Mac stores, which prohibit developers from using the same product ID across both.
In these cases, use the override fields to specify the Product’s correct identifier where it differs from the cross-platform ID.
You can also do this programmatically, as follows:
using UnityEngine;
using UnityEngine.Purchasing;
public class MyIAPManager {
public MyIAPManager () {
var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
builder.AddProduct("100_gold_coins", ProductType.Consumable, new IDs
{
{"100_gold_coins_google", GooglePlay.Name},
{"100_gold_coins_mac", MacAppStore.Name}
});
// Initialize Unity IAP...
}
}
In this example, the Product identifies as “100_gold_coins_google” to Google Play and “100_gold_coins_mac” to the Apple App Store.
Note: Overrides only change the identifier Unity IAP uses when communicating with app stores. You should still use the Product’s cross-platform identifier when making API calls.
Important: The ID may only contain lowercase letters, numbers, underscores, or periods.
Provide either a Product price, or an ID for a Pricing Template created in Google Play.
Select a Pricing Tier from the dropdown menu. Unity supports predefined Apple price points, but not arbitrary values.
Select a screenshot to upload.
For information on screenshot specs, see Apple’s publisher support documentation.
You can also declare your Product list programmatically using the Purchasing Configuration Builder. You must provide a unique cross-store Product ID and Product Type for each Product:
using UnityEngine;
using UnityEngine.Purchasing;
public class MyIAPManager {
public MyIAPManager () {
var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
builder.AddProduct("100_gold_coins", ProductType.Consumable);
// Initialize Unity IAP...
}
}
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
More information
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising. Some 3rd party video providers do not allow video views without targeting cookies. If you are experiencing difficulty viewing a video, you will need to set your cookie preferences for targeting to yes if you wish to view videos from these providers. Unity does not control this.
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.