Welcome to AdInMo’s SDK docume...
...
IAPBoost
Unity IAP v5 Integration Guide
16 min
requirements unity 2021 3 lts or newer adinmoplugin v3 14 or above unity iap (upm) v5 x x free adinmo developer account sign up here installation prerequisites 1\ install unity iap v5 open package manager window→ package manager select unity registry from the dropdown (top left) search for "in app purchasing" install version 5 x x (latest stable) 2\ create adinmo developer account sign up for a free account at adinmo developer portal login to your developer portal dashboard navigate to downloads section to access the latest sdk 3\ install adinmoplugin download the adinmoplugin package from your adinmo developer portal import the unitypackagefile assets→ import package→ custom package verify installation check that adinmopluginfolder appears in your assets confirm version ensure it's v3 14 or above in the package documentation integration guide for existing unity iap v5 users (recommended) if you already have unity iap v5 working, this is a simple 2 step upgrade step 1 add compiler symbol open player settings edit→ project settings→ player find script compilation section (scroll down) add to scripting define symbols adinmo unity store v5 click apply and wait for recompilation navigation path edit → project settings → player → script compilation → scripting define symbols add adinmo unity store v5 step 2 replace your unity iap controller replace your existing unity iap controller with adinmostorecontroller before storecontroller m storecontroller = new storecontroller(); // or traditional unity iap initialization after adinmostorecontroller m storecontroller = new adinmostorecontroller(); your existing purchase handling logic can be adapted to the new event based system complete implementation example required imports using unityengine; using system threading tasks; using system linq; using system collections generic; using unityengine purchasing; using unityengine purchasing extension; using adinmo; // add this for adinmostorecontroller full implementation public class myiapmanager monobehaviour { private adinmostorecontroller m storecontroller; async void start() { await initializepurchasing(); } private async task initializepurchasing() { if (m storecontroller != null) return; m storecontroller = new adinmostorecontroller(); // subscribe to purchase events m storecontroller onpurchasepending += onpurchasepending; m storecontroller onpurchaseconfirmed += onpurchaseconfirmed; try { // connect to store services await m storecontroller connect(); debug log("unity iap v5 initialization successful adinmo integration active"); // fetch your products fetchproducts(); } catch (system exception e) { debug logerror($"store connection failed {e}"); showinitializationerror(); } } private void fetchproducts() { var products = new list\<productdefinition> { new productdefinition("premium upgrade", producttype nonconsumable), new productdefinition("gold coins 100", producttype consumable), new productdefinition("monthly subscription", producttype subscription) }; m storecontroller fetchproducts(products); debug log("products fetched and ready for purchase"); } \#region purchase event handlers private void onpurchasepending(pendingorder order) { debug log("purchase pending processing "); // reward the player before confirming purchase var productid = order cartordered items() first() product definition id; processpurchasereward(productid); // confirm the purchase (required) m storecontroller confirmpurchase(order); } private void onpurchaseconfirmed(order order) { switch (order) { case failedorder failedorder var failedproduct = failedorder cartordered items() first() product definition id; debug logerror($"purchase failed {failedproduct}, {failedorder failurereason}"); showpurchaseerror(failedproduct, failedorder failurereason tostring()); break; case confirmedorder confirmedorder var confirmedproduct = order cartordered items() first() product definition id; debug log($"purchase confirmed {confirmedproduct}"); showpurchasesuccess(confirmedproduct); break; } } \#endregion \#region purchase processing private void processpurchasereward(string productid) { debug log($"processing purchase reward {productid}"); switch (productid) { case "premium upgrade" unlockpremium(); debug log("premium upgrade unlocked"); break; case "gold coins 100" addcoins(100); debug log("added 100 gold coins"); break; case "monthly subscription" activatesubscription(); debug log("monthly subscription activated"); break; default debug logwarning($"unknown product {productid}"); break; } // adinmo automatically tracks this purchase in the background } \#endregion \#region public purchase methods public void buypremiumupgrade() { buyproduct("premium upgrade"); } public void buygoldcoins() { buyproduct("gold coins 100"); } public void buysubscription() { buyproduct("monthly subscription"); } public void buyproduct(string productid) { if (m storecontroller == null) { debug logerror("store controller not initialized"); return; } var product = m storecontroller getproducts() firstordefault(p => p definition id == productid); if (product != null) { debug log($"initiating purchase {productid}"); m storecontroller purchaseproduct(product); } else { debug logerror($"product not found {productid}"); } } public void restorepurchases() { if (m storecontroller != null) { m storecontroller restoretransactions(ontransactionsrestored); } } private void ontransactionsrestored(bool success, string error) { if (success) { debug log("transactions restored successfully"); } else { debug logerror($"transaction restoration failed {error}"); } } \#endregion \#region game logic (your implementation) private void unlockpremium() { // your game logic for premium unlock playerprefs setint("premiumunlocked", 1); } private void addcoins(int amount) { // your game logic for adding coins int currentcoins = playerprefs getint("goldcoins", 0); playerprefs setint("goldcoins", currentcoins + amount); } private void activatesubscription() { // your game logic for subscription activation playerprefs setstring("subscriptionactive", system datetime now\ tostring()); } private void showinitializationerror() { // your ui logic for showing initialization errors debug logerror("failed to initialize store check internet connection and store setup"); } private void showpurchasesuccess(string productid) { // your ui logic for showing purchase success debug log($"purchase successful {productid}"); } private void showpurchaseerror(string productid, string reason) { // your ui logic for showing purchase errors debug logerror($"purchase failed for {productid} {reason}"); } \#endregion \#region helper methods public bool isstoreinitialized() { return m storecontroller != null; } public string getproductprice(string productid) { if (m storecontroller == null) return "n/a"; var product = m storecontroller getproducts() firstordefault(p => p definition id == productid); return product? metadata localizedpricestring ?? "n/a"; } public bool isproductowned(string productid) { // for non consumable products, check if already purchased return adinmostorecontroller checkalreadypurchased(productid) alreadypurchased; } \#endregion } critical product id matching your unity iap product ids must exactly match your adinmo campaign skus unity code new productdefinition("premium upgrade", producttype nonconsumable); // product id "premium upgrade" adinmo dashboard campaign → sku id "premium upgrade" ← must match exactly (case sensitive) common matching issues "premium upgrade" vs "premium upgrade"(case mismatch) "premium upgrade" vs "premium upgrade"(separator mismatch) "com yourcompany premium upgrade" vs "premium upgrade"(prefix mismatch) key benefits of unity iap v5 + adinmo event based architecture clean onpurchasependingand onpurchaseconfirmedevents async/await support modern async patterns with await connect() enhanced error handling detailed failedorderinformation automatic purchase tracking built in adinmo analytics integration static helper methods checkalreadypurchased(), getprice(), purchaseitem() troubleshooting common issues 1\ compiler symbol not applied symptom adinmostorecontrollernot found solution add adinmo unity store v5to scripting define symbols restart unity editor after adding the symbol wait for full recompilation 2\ sku mismatch symptom purchases work but don't appear in adinmo dashboard solution double check product id spelling (case sensitive) verify sku configuration in adinmo portal check for hidden characters or extra spaces 3\ purchase not completing symptom onpurchasependingcalled but purchase doesn't finish solution always call confirmpurchase() in onpurchasepending ensure you reward the player before confirming check for exceptions in the purchase processing logic 4\ store connection issues symptom connect()fails or times out solution verify internet connection check unity services configuration ensure proper store setup (google play console/app store connect)