💰Unity In App Purchases Wrapper
Install In App Purchase package in Package Manager before importing package below.
Unity IAP requires UnityServices in order to work, so enable it.

Select organization and Create project ID if you see the same window as above. Then toggle ads to "ON".
For Android:
Add billing permission in AndroidManifest:
<uses-permission android:name="android.permission.BILLING" />Then upload aab with added permission to store. When it's done you can setup products in google console (if you have already setupped finance info in google console)
Add products in google console
!!! if unity IAP package < v4.9 -> Go in top bar to Services/In App Purchasing/Configure.. and "Automatically initialize Unity Gaming Services" must be turned off! because IAP.cs do it.
Add all product ids from google console to IAP_Products.cs with product types, you will refer them then. By default added NO_ADS with id "no_ads" from google console as example.
Add to IAP.cs function InitializePurchasing() all your products. for example I have PRO_VERSION product:
builder.AddProduct(IAP_Products.PRO_VERSION, IAP_Products.PRO_VERSION_TYPE);
To test IAP purchases you need to add testers in Google play console in tab "Test Licences" (Настройка > Тестирование лицензий)
Now you can call methods from IAP.cs by instance (IAP.instance.IsInitialized and etc). Below will be some snippets.
if (IAP.instance.IsNonConsumableOwned(IAP_Products.PRODUCT_ID)) {
// player has it - handle
}
else {
// player doesn't own this product
}private void OnIAP_ProductBought(string id) {
if (String.Equals(id, IAP_Products.NO_ADS, StringComparison.Ordinal)) {
// player has bought no ads!
}
}var product = IAP.instance.GetProduct(IAP_Products.PRODUCT_ID);
Debug.Log(product.metadata.localizedPriceString); // $4,99 or $4.99 (culture depends)
Debug.Log(product.metadata.localizedPrice); // 4,99 or 4.99 (culture depends)
Debug.Log(product.metadata.isoCurrencyCode); // USDLast updated