IAP API Reference
IAP API
Namespace: MobileCore.IAPModule
IAPManager Class
The static manager handles all purchase flows and product queries.
Properties
| Property | Description |
|---|---|
IsInitialized | Returns true if the IAP service is connected to the store. |
Methods
| Method | Description |
|---|---|
BuyProduct(ProductKeyType key) | Initiates a purchase for the product enum. |
RestorePurchases() | Restores transactions (Critical for iOS). |
IsSubscribed(ProductKeyType key) | Checks if a subscription is currently active. |
GetProductData(ProductKeyType key) | Returns metadata (Price, ISO Code, Title). |
GetProductLocalPriceString(ProductKeyType key) | Returns formatted price (e.g. “$4.99”). |
Events
// Successful Purchase
IAPManager.OnPurchaseComplete += (productKey) => {
Debug.Log($"Bought: {productKey}");
};
// Failed Purchase
IAPManager.OnPurchaseFailded += (productKey, reason) => {
Debug.LogError($"Failed: {reason}");
};
// Initialization
IAPManager.OnPurchaseModuleInitted += () => {
Debug.Log("Store Ready");
};
Data Structures
ProductKeyType
An enum you define in the code to map to your specific products.
PurchaseFailureReason
Standard Unity IAP failure reasons (UserCancelled, PurchasingUnavailable, etc.).