Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Simple In-App Purchase System (SIS) - Shop solution

Discussion in 'Assets and Asset Store' started by Baroni, Aug 8, 2013.

?

Which billing plugin are you using in combination with Simple IAP System?

  1. Unity IAP

    178 vote(s)
    86.8%
  2. Voxel Busters

    10 vote(s)
    4.9%
  3. Stans Assets

    13 vote(s)
    6.3%
  4. Prime31

    4 vote(s)
    2.0%
  1. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    Hello @Foxxman, before answering your post, could we please clarify the comments in your review on the Unity Asset Store first? I am genuinely wondering why I deserve that review and what led you to posting it.

    There is no single document, the Online Documentation contains several chapters which are all (to my knowledge) up to date. Could you please specify which chapter you mean?

    In an example scene? Which one and what buttons? In the Unity Editor or on a device? Did you look at the Console to see any relevant errors in your project or with the setup?

    I am confused where you submitted your invoice to, at what page? And by mentioning "they erased it", who is "they"? This is your first post on this support thread, there is no other support channel.

    You posted your first message here on a Sunday night, at the same time as your review, saying I do not provide support although I reply here every day except on weekends. Note that it is still Sunday. I really do not know where your review is coming from but would like to clear it up.
     
  2. ewagstaff

    ewagstaff

    Joined:
    Apr 21, 2017
    Posts:
    13
    These docs are so good! It was pretty easy to get everything set up in the Steam store, I don't know how I would've done it without your step-by-step. I think I'm stuck on one last thing...

    This URL works great to open up the purchase page for my new consumables: https://store.steampowered.com/buyitem/appid/itemid/

    And the Steam Shift+Tab menu opens when I run a test build of my game. However, when I click the purchase button, I get this error:
    Product single_token not found in IAP Settings.


    "single_token" is defined inside the Project Settings for Simple IAP System as a Product within a Category. Should the ID be something else? The ID in Steam is 100 (since the IDs must be numeric) but I followed the guide to use the overrides to link the two (screenshot included). What's missing here?


    ^ Scratch all that, I didn't realize IAPManager had to be added to the scene! So now I'm following the 01 Button example, but when the scene initializes, I'm getting a Steam-specific error:

    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.Purchasing.PurchasingManager.OnProductsRetrieved (System.Collections.Generic.List`1[T] products) (at Library/PackageCache/com.unity.purchasing@4.8.0/Runtime/Purchasing/PurchasingManager.cs:227)
    SIS.SteamStore.OnProductsRetrieved (UnityEngine.Purchasing.ProductDefinition[] list) (at Assets/SimpleIAPSystem/Scripts/Extensions/Steam/SteamStore.cs:185)


    Clicking on the button to purchase after that error results in
    Unity IAP is not initialized correctly! Please check your billing settings.


    I did a little debugging and the error is coming from

    callback.OnProductsRetrieved(products.Values.ToList());
    ... Guessing that means Steam didn't return any valid items?

    Update: The above error was because I still had a few of the starting template purchase items that did not correspond to anything in Steam! Sorry for the stream of consciousness as I continue to debug.
     

    Attached Files:

    Last edited: May 7, 2023
  3. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22
    See the scene as attached.

    Your colleague confirmed on Discord that the 1st invoice is verified, but still didn’t allow me to send message in the chat room. He then removed it and I had to request to create a new ticket room for me to send you again the invoice no. I still not in the room.

    Do I have to explain everything and get accepted by you before getting support for what I mentioned in my previous post?
     

    Attached Files:

  4. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    @Foxxman I do not have a Discord server. "gleygames" is not my "colleague", I think you are referring to "Easy IAP" which is a completely different asset.

    Unfortunately, yes, since you are obviously requested support on the wrong asset, but put me under pressure with your 1-star review. I would appreciate if you could remove your review first, before I answer your question. Which again, I will do as a first thing tomorrow morning, since it is still Sunday evening.
     
  5. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22
    For now, the plug-in works independently as when I buy coins by clicking on a button, the amount goes to the balance bar.

    however, I need the amount to return to the existing virtual currency that I created separately in the core asset, how to do that?

    if you can help, I will remove that comment and rate you a 5 stars.
     
  6. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22
    The comment has been removed, you may provide your answer here now.
     
    Last edited: May 7, 2023
  7. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    Thanks and good morning / day. If you do not want to save currency in Simple IAP System, but your own shop solution, you would want to either subscribe to the IAPManager.purchaseSucceededEvent which provides the product ID in your own script, or add your own code in the IAPListener.HandleSuccessfulPurchase method.

    In that method, you can add a switch-case for the product ID and modify your own currency storage. However, note that it is advised to do it the other way around - migrate your own currency storage to Simple IAP System instead. Because if you manipulate your own currency storage amount, Simple IAP System does not know this, and users will not be able to spend e.g. coins in a Simple IAP System shop, because it thinks you have 0 coins. Therefore if you still want to use your own currency storage, you also need to keep the Simple IAP System currency in sync manually calling DBManager.SetCurrency(ID, amount).

    Regarding the error message you have posted above stating "Purchase not correctly processed...", this comes from Unity IAP and not Simple IAP System. As written in the linked thread, it seems that you are using an older version of Unity IAP and have enabled automatic initialization in the IAP Catalog. You cannot mix Unity IAP Codeless and coded, therefore automatic initialization in the IAP Catalog needs to be disabled.
     
  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    Thanks for the kind words and your Unity Asset Store review, much appreciated! Sooo... I'm a bit confused by your error history, do you still need help with something? Having more products in Unity / Simple IAP System than in Steam Economy should actually not throw any initialization errors, but only display a "Product not available" message when you try to purchase it.

    Just make sure that the SteamManager is present in your scene too, at the time the IAPManager tries to initialize, and that you are actually starting the game from within your Steam application with the developer account signed in (Unity Editor or outside Steam app does not work).
     
  9. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22

    Hi do you have the step by step document for exactly how to “subscribe to the IAPManager.purchaseSucceededEvent which provides the product ID in your own script, or add your own code in the IAPListener.HandleSuccessfulPurchase method”?
     
  10. Rafael-Barbosa

    Rafael-Barbosa

    Joined:
    Apr 14, 2013
    Posts:
    288
    Hey, awesome asset, I do have a question.

    Background for the question:
    I'm implementing Steam IAP for a client, tested the same project on my personal steam game using a closed beta branch. Everything worked great, however I'm not uploading it to the client's steamworks page and everytime I try to purchase an item, I get the purchase without errors, but I also don't get the steam overlay, I just receive the reward for free. The only difference I see is that their game is not yet released. I tried to access that url https://store.steampowered.com/buyitem/appid/100/
    in the browser it returns an error, but using steam browser from inside the client's game, it returns the correct IAP page.

    Actual question:
    Does SIS require the Steam game to have actually been released to be able to test it using the final flow ? If not, could my issue be something else?

    Thank you!
     
  11. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    @Foxxman If you are unfamiliar with C# events / delegates or coding in general I would just recommend using the HandleSuccessfulPurchase method in the IAPListener script. Open it and add your own product IDs and code. This method gets called whenever a purchase is finished or restored.

    Hey! No, SIS does not require a released Steam game for testing. They function the same, the only difference is that with an unreleased game, in the purchase popup you do not have to spend real money. Steam disables this sandbox mode in a released game.

    The purchase popup should definitely be shown, regardless of the release state. If you are using the Steam native implementation you would also want to compare your and your clients Steam Economy Settings and the product catalog json.
     
  12. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22

    Thanks.
    So what if I remain using your preset product ID “coins_pack” and name of my virtual currency “coins”, what codes should I add to IAPListener?
     
  13. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    @Foxxman If I understand correctly you are asking what code should you write for your own virtual currency? Previously you have mentioned "existing virtual currency that I created separately in the core asset". I do not know what "core asset" you mean, if that is a different asset only you know your game code.
     
  14. ewagstaff

    ewagstaff

    Joined:
    Apr 21, 2017
    Posts:
    13
    I did get the purchase modal to appear! Currently struggling with adding Storage Encryption -- I'm following the encryption walkthrough and I added a simple 8-letter obfuscKey, but having a value in that field triggers a new error that prevents billing from working.


    FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
    System.Convert.FromBase64_Decode (System.Char* startInputPtr, System.Int32 inputLength, System.Byte* startDestPtr, System.Int32 destLength) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    System.Convert.FromBase64CharPtr (System.Char* inputPtr, System.Int32 inputLength) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    System.Convert.FromBase64String


    The traceback showed that this issue is happening here:
    byte[] keyArray = UTF8Encoding.UTF8.GetBytes(obfuscKey);
    byte[] toDecryptArray = Convert.FromBase64String(toDecrypt);


    I even tried with the "abcd1234" example text but I still get the error. Any thoughts to point me in the right direction?
     
  15. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    If you have launched the application without an encryption key set before, it has written data without encryption already. So by enabling it, it tries to decrypt the unencrypted data, which fails. Therefore, when toggling encryption you have to clear the local storage to start fresh. Open the Project Settings > Simple IAP System > Tools section, enter Unity Editor runtime (the same error will show up) and then press the Database "Clear" button. Next time you enter runtime or launch the application the error should be gone and your data encrypted. Let me know if you need further help :)
     
  16. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22
    Thanks for the reply.

    So if the ID of my virtual currency is “coins”, where should I put it in DBManager.SetCurrency?
    (Where and which script should I change?)

    For the issue "Purchase not correctly processed....", I can't find the IAP Catalog window from Window > Unity IAP > IAP Catalog, any ideas?
     
    Last edited: May 9, 2023
  17. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22
    I am really confused about all the functionalities, any chance to have a clear step by step document (script, no jargons)?

    Or do you do customization service for this?
     
    Last edited: May 9, 2023
  18. Rafael-Barbosa

    Rafael-Barbosa

    Joined:
    Apr 14, 2013
    Posts:
    288

    I managed to fix the issue, just to provide some context for anyone coming here from google. The issue was that at some moment, the products lost the pricing configuration. They were configured as free. I had to change it in project settings, inside the SIS catalog so that they had a cost of real money. After that it worked on steam.

    Sorry to bother you guys with this silly issue
     
    Baroni likes this.
  19. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    I think you misunderstood the concept. To clarify, if you are using a different asset or your own system for virtual currency - not the virtual currency system built into Simple IAP System - you need to account for these things in your game:
    1. If a user buys a virtual currency package in Simple IAP System, you have to add the amount to your currency system too.
    2. If a user buys a product in exchange for virtual currency in Simple IAP System, you have to reduce the amount from your currency system too.
    3. If a user earns currency in your currency system, you have to add that amount to Simple IAP System as well.

    1. and 2. is done in the IAPListener.HandlePurchaseSuccessful method. To repeat, you do not have to add currency to Simple IAP System here - that is done automatically, if you defined the currency as a reward in the Project Settings (see the existing coins products as a sample). Instead, you have to add or reduce coins from your system. Since I do not know what system you are using, I am not able to help on this part.

    3. At the end of a game round (or whatever game type you are developing) where the user is able to earn coins by playing, and you added it to your currency system, call DBManager.AddCurrency (or DBManager.SetCurrency with the total amount) to keep Simple IAP System in sync.

    There is private support available for purchase on my website. I am not sure what else I would have to explain though - I cannot provide code for code that you have written. Basic knowledge of programming is required to successfully integrate Simple IAP System in an existing project.

    As mentioned by the Unity employee, you might have used Unity IAP Codeless in your project. It could be that you have a Unity IAP Codeless "IAP Listener" or "IAP Button" component somewhere in your scene. Simple IAP System does not use this, so I cannot really tell. If you would be able to reproduce the error in a new project, I can try to investigate.
     
  20. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22

    Thanks for your explanation, and yes, my trouble comes from 2. - adding and reducing amount from my own system (reacting with Simple IAP). I am desperately in need of completing this, do you do customization service?

    I don't think 3 would be needed as I only wanted to add a purchase button (card payment) to my existing system.
     
  21. ewagstaff

    ewagstaff

    Joined:
    Apr 21, 2017
    Posts:
    13
    Thank you! This definitely worked for the Unity Editor. However when I create a build in Steam, and download it as if I was a user, I get the same
    The input is not a valid Base-64 string as it contains a non-base 64 character
    ... I tried fully uninstalling and re-installing the app, reuploading a new build too, but it seems to be stuck on this.

    Is there some programmatic way of doing the same local storage clear for the downloaded app that I did in the editor using the UI? Thanks again for all your help on this!
     
  22. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    Leaving Simple IAP System aside, you are saying that you do not know how to add or reduce virtual currency from your own system? I am confused, why are you using it then? If you are not familiar with your own system, wouldn't it make more sense to use the currency system in Simple IAP System instead? Or, if your system is a different asset, ask its developers for help.

    You could try to build example scene 11 and launch that from the Steam app, which contains a button to clear the local database too. I can only assume that Steam saves PlayerPrefs somewhere else than the Unity Editor...
     
  23. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22
    Frankly speaking I am not very familiarized with Unity environment -

    I know how to add and reduce coins in my own asset, but don't know how to relate Simple IAP with mine. To be clear, I do not what to do with the script:

    1) I have installed Simple IAP inside my asset folder
    2) I have configured the currency in Simple IAP as "coins" (in project setting)
    3) I can successfully open 02 Vertical Scrolling under folder Scene
    4) I have successfully created an object as a button on the screen
    5) I know there is an "on click" function for buttons in Unity

    The problem is, the amount displayed at the top bar does not relate to my own virtual currency "coins", even if a purchase is made.

    What challenges me:

    1) What are the next steps?
    2) What to do with those scripts (you mentioned about IAPManager.purchaseSucceededEvent, IAPListener.HandleSuccessfulPurchase, IAPListener script, DBManager.SetCurrency(ID, amount))
    3) You mentioned about adding my own codes to IAPListener and DBManager.SetCurrency, what codes should I add?

    These questions may be silly but would be much appreciated if you can save me from these:(:(
     
  24. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    Could you post what code you are using to add or remove coins in your own asset?

    I will answer 2) and 3) after your reply then.
     
  25. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22
    Hi Baroni,

    not sure if this script is what you need:

    public string GetCoinsString()
    {
    return coins.ToString();
    }

    Thanks.
     
  26. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    That script only returns coins as a string, how do you set the coins value? Do you have a "coins" integer value in one of your scripts? How do you persist that value between app sessions?
     
  27. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22
    MOD EDIT: Do NOT post code from the Asset Store (or any commercial software really), it is a violation of copyright and our rules.
     
    Last edited by a moderator: May 13, 2023
  28. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    @Foxxman Thanks, could you please put the code above in [ code ] tags so it does not clutter the whole page? Also, thank you very much for the Asset Store review.

    Looking through your code, basically you would want to watch out for each code line where you modify udata.coins. Be it for selling cards, ending a game, or straight up buying coins. Some examples:

    1. Buying coins from Simple IAP System
    Code (csharp):
    1. public void HandleSuccessfulPurchase(string productID)
    2. {
    3.    switch (productID)
    4.    {
    5.       case "coin_pack":
    6.          AddCoins(1000); //<---------
    7.          break;
    8.    }
    9. }
    10.  
    11. //new, added below that method <---------
    12. private async void AddCoins(int amount)
    13. {
    14.    UserData udata = Authenticator.Get().UserData;
    15.    udata.coins += amount;
    16.    await Authenticator.Get().SaveUserData();
    17. }
    2. Spending coins in your game and syncing them with Simple IAP System
    E.g. in "Script 2", BuyPackTest() method. The same would apply to "Script 6", BuyCardTest() method.
    Code (csharp):
    1. private async void BuyPackTest()
    2. {
    3.    int quantity = GetBuyQuantity();
    4.    int cost = (quantity * pack.cost);
    5.    if (quantity <= 0)
    6.    return;
    7.  
    8.    UserData udata = Authenticator.Get().UserData;
    9.    if (udata.coins < cost)
    10.    return;
    11.  
    12.    udata.AddPack(pack.id, quantity);
    13.    udata.coins -= cost;
    14.    await Authenticator.Get().SaveUserData();
    15.    DBManager.SetCurrency("coins", udata.coins); //<---------
    16.    PackPanel.Get().ReloadUserPack();
    17.    Hide();
    18. }
    3. Getting coins in your game. This is similar to the last point.
    E.g. in "Script 6", SellCardTest() method.

    Code (csharp):
    1. private async void SellCardTest()
    2. {
    3.     //...the content of this method until udata.coins is modified...
    4.  
    5.     udata.coins += cost;
    6.     await Authenticator.Get().SaveUserData();
    7.     DBManager.SetCurrency("coins", udata.coins); //<---------
    8.     CollectionPanel.Get().ReloadUserCards();
    9.     Hide();
    10. }
    4. Earning coins by playing your game. I assume this happens in "Script 7", but I cannot see where the "target_coins" value is actually applied to the user via Authenticator.Get().SaveUserData(). Anyway, if that happens, you should call DBManager.SetCurrency again, like above.

    Hope this helps.
     
  29. ewagstaff

    ewagstaff

    Joined:
    Apr 21, 2017
    Posts:
    13
    Copied that function into a button in my scene, updated the build, and it cleared correctly! Thanks so much.
     
  30. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22
    Thanks Baroni,

    will check accordingly!
     
  31. FairyMental

    FairyMental

    Joined:
    Apr 26, 2016
    Posts:
    5
    Hello @Baroni,

    Recently bought the package, tried integrating as per documentation here: https://flobuk.gitlab.io/assets/docs/sis/install
    Using unity 2021.3.23f, tried installing with exactly same package versions (4.4.0 for purchasing and 1.4.2 core services) and when tick the "Enable Integration" in project settings, I'm getting this:

    Assets\SimpleIAPSystem\Scripts\IAPManager.cs(24,46): error CS0246: The type or namespace name 'IDetailedStoreListener' could not be found (are you missing a using directive or an assembly reference?)

    Checked the packages, are imported all fine, seems that interface comes from Unity.Purchasing which is definitely there... any ideas :/ ?

    Managed to fix the script error by changing the IDetailedStoreListener to IStoreListener to get the code to compile, would that be okay on the long run? Thanks so much!
     
  32. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    Hi @FairyMental, thanks for writing here. The install instructions state to use the latest package of Unity IAP, which is 4.8.0 (the screenshot with 4.4.0 is an example). SIS is compatible with 4.8.0 and above currently.
     
  33. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22

    Hi Baroni,

    May I know where should I put these codes at?
    Thanks.
     
  34. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22
    I tried to put the codes in IAPListener, it turns out showing this message:

    Assets\CCG\Scripts\Network\TcgNetwork.cs(315,34): warning CS0618: 'Object.FindObjectOfType<T>()' is obsolete: 'Object.FindObjectOfType has been deprecated. Use Object.FindFirstObjectByType instead or if finding any instance is acceptable the faster Object.FindAnyObjectByType'
     
  35. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    Erm.. that's your code, I wrote the script name (like you called it e.g. "Script 2") before each modified code snippet I provided.

    Disregarding the fact that this is coming from your script and is completely unrelated to my asset, the warning exactly tells what to do.
     
  36. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22

    Thanks, do I need to create a new button for that? (e.g. a button in the lobby page)
     
  37. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    @Foxxman I cannot answer that, because I do not know what type of button or lobby page you are referring to. There are no such things in Simple IAP System. You posted scripts and I added code lines highlighted with an arrow "//<---------" to them as an example on how to interact with Simple IAP System. The rest is up to you, I am not able to provide support for any of your own game code or behavior.
     
  38. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22
    Hi, I got this problem after adding the 1st code into Script 1, the 2nd code to Script 2 & 6, and the 3rd code to Script 6::


    Scripts\Menu\PackZoomPanel.cs(151,28): error CS0111: Type 'PackZoomPanel' already defines a member called 'BuyPackTest' with the same parameter types

    Scripts\Menu\CardZoomPanel.cs(267,28): error CS0111: Type 'CardZoomPanel' already defines a member called 'SellCardTest' with the same parameter types
     
  39. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22

    Thanks.
    So how would the code interact with Simple IAP - like clicking on a button (coin_pack) from 02 Vertical Scroll and it will add values to my existing "coins"?
     
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    I would recommend looking into basic programming tutorials. You have copy-pasted the same methods you already have, so now the error tells you you have two methods with the same name. You should replace the methods, not add them again.

    I wrote how to do that above, in the same post, point 1: "Buying coins from Simple IAP System", which describes how to modify the IAPListener and add coins to your existing coins in a new method.
     
  41. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22

    Hi, unfortunately it doesn't work:
    It shows:
    All compiler errors have to be fixed before you can enter playmode!
    UnityEditor.SceneView:ShowCompileErrorNotification ()


    The code I input in IAPlistener.cs:

    Code (CSharp):
    1.  public void HandleSuccessfulPurchase(string productID)
    2.         {
    3.             if (IAPManager.isDebug) Debug.Log("IAPListener reports: HandleSuccessfulPurchase: " + productID);
    4.  
    5.             //differ between ids set in the IAP Settings editor
    6.             switch (productID)
    7.             {
    8.                 //section for in app purchases
    9.                 case "coins_small":
    10.                 case "coin_pack":
    11.                 case "big_coin_pack":
    12.                     AddCoins(1000); //<---------
    13.                     //the user bought some "coins", get reward amount and show appropriate feedback
    14.                     IAPProduct product = IAPManager.GetIAPProduct(productID);
    15.                     ShowMessage(product.rewardList[0].amount + " coins were added to your balance!");
    16.                     break;
    17.                 case "no_ads":
    18.                     //You can now check DBManager.IsPurchased("no_ads") before showing ads and block them
    19.                     ShowMessage("Ads disabled!");
    20.                     break;
    21.                 case "abo_monthly":
    22.                 case "abo_weekly":
    23.                     //same here, the user can now access subscription content
    24.                     ShowMessage("Added subscription!");
    25.                     break;
    26.                 case "bundle":
    27.                     ShowMessage("Thank you for buying the bundle!");
    28.                     break;
    29.  
    30.                 //section for in game content
    31.                 case "health":
    32.                     //this product does not have a usage count and therefore is consumed instantly
    33.                     ShowMessage("Health was consumed instantly!");
    34.                     break;
    35.                 case "energy":
    36.                     //if you define a usage count in the Project Settings, then the amount
    37.                     //has been added to your inventory already. No need to call something like
    38.                     //DBManager.AddPlayerData("energy", new SimpleJSON.JSONData(100)) manually
    39.  
    40.                     /*
    41.                     //another use case: for example the product was bought not in the shop,
    42.                     //but during the game to receive more energy directly
    43.                     if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "MyGameScene")
    44.                     {
    45.                         //try to consume product immediately
    46.                         IAPManager.Consume("energy", 1);
    47.                     }
    48.                     else
    49.                     */
    50.                     ShowMessage("Energy was added to your inventory!");
    51.                     break;
    52.  
    53.                 case "speed":
    54.                     ShowMessage("Speed boost unlocked!");
    55.                     break;
    56.                 case "speed_1":
    57.                 case "speed_2":
    58.                 case "speed_3":
    59.                     ShowMessage("Speed boost upgraded!");
    60.                     break;
    61.                 case "bonus":
    62.                     ShowMessage("Bonus level unlocked!");
    63.                     break;
    64.  
    65.                 case "weapon_1":
    66.                 case "weapon_2":
    67.                 case "weapon_3":
    68.                     ShowMessage("New weapon unlocked!");
    69.                     break;
    70.  
    71.                 case "gear_1":
    72.                 case "gear_2":
    73.                 case "gear_3":
    74.                     ShowMessage("New gear unlocked!");
    75.                     break;
    76.  
    77.                 case "secret_1":
    78.                 case "secret_2":
    79.                     ShowMessage("Secret product unlocked!");
    80.                     break;
    81.  
    82.                 default:
    83.                     ShowMessage("Product (" + productID + ") bought!");
    84.                     break;
    85.             }
    86.         }
    87.  
    88.  
    89.  
    90.  
    91.  
    92.  
    93.  
    94.  
    95.         //new, added below that method <---------
    96.         private async void AddCoins(int amount)
    97.         {
    98.             UserData udata = Authenticator.Get().UserData;
    99.             udata.coins += amount;
    100.             await Authenticator.Get().SaveUserData();
    101.         }
    102.  
    103.  


    Or do I have to put it in Script 1?
     
  42. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22
    Hi, I retested all the codes and finally got this from Simple IAP:

    Assets\Samples\In App Purchasing\4.8.0\Apple App Store - 03 Handling Deferred Purchases\HandlingDeferredPurchases.cs(33,13): warning CS0618: 'UnityPurchasing.Initialize(IStoreListener, ConfigurationBuilder)' is obsolete: 'Use Initialize(IDetailedStoreListener, ConfigurationBuilder)'

    But what I found in your code is:

    UnityPurchasing.Initialize(this, builder);

    Any ideas?
     
  43. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    This is not from Simple IAP System, it is coming from Unity IAP. Delete the sample (or all of them in the Assets\Samples\In App Purchasing\4.8.0 folder), you do not need it.

    Please understand that it is Friday evening for me already, this will be my last reply and I will be back on Monday. Thanks!
     
  44. Foxxman

    Foxxman

    Joined:
    Feb 21, 2023
    Posts:
    22
    Understood. I got these messages:

    1)
    Assets\TcgEngine\SimpleIAPSystem\Scripts\IAPListener.cs(125,13): error CS0246: The type or namespace name 'UserData' could not be found (are you missing a using directive or an assembly reference?)

    2)
    Assets\TcgEngine\SimpleIAPSystem\Scripts\IAPListener.cs(125,30): error CS0103: The name 'Authenticator' does not exist in the current context

    3)
    Assets\TcgEngine\SimpleIAPSystem\Scripts\IAPListener.cs(127,19): error CS0103: The name 'Authenticator' does not exist in the current context

    4) error CS0103: The name 'pack' does not exist in the current context

    5) error CS0103: The name 'DBManager' does not exist in the current context

    Much appreciated if you can help next Monday
     
  45. cgutierrez71

    cgutierrez71

    Joined:
    Oct 15, 2013
    Posts:
    69
    Hi, I bought the Simple IAP System for my Unity game "Space Conquest 3D" a long time ago. Now have to update my Unity platform from Unity 2017.3.1f1 (64-bit) to the last one stable but when I do it, I got many error asociated to the Simple IAP System. What can I do? Can you help me? Best regards.
     
  46. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    Good day,

    errors 1-3 come from using the TCGEngine classes in the script without including their namespace at the top. Since I do not own that asset, I do not know what namespace they are using - you should look this up in their scripts.

    Error 4 does not provide any useful information for helping you, it seems like you've just copy-pasted the word "pack" somewhere in a script.

    Error 5 once again comes from namespaces, but this time the Simple IAP System namespace. If you are using Simple IAP System classes in your own scripts, you have to put "using SIS;" at the top of your scripts.

    If you do not know what namespaces are or need further coding assistance, please note that my support for external assets is limited (or rather, actually does not exist in the first place, but I tried to help). Please have a look on my website for purchasing a coding assistance ("Project Setup") package or smaller donations.

    Hi Carlos, nice to see you're having a lot of downloads for your app! Hopefully lots of in-app purchases too. If you've used Unity 2017 and bought SIS at that time, I assume you are referring to Simple IAP System 1. Simple IAP System 2 was first released in April 2021 and due to actually being a paid upgrade, brought a lot of changes internally, making the workflow easier and providing support for more platforms and functionality. SIS 1 was deprecated with the end of Unity 2019.

    So, if you are using SIS1, you would want to upgrade to SIS2. Then, either go over the 2-3 upgrade guides on the Release page and do the changes accordingly, or let me know if you need (paid) help with the process. Thanks!
     
  47. Stacksunited48

    Stacksunited48

    Joined:
    Jan 17, 2023
    Posts:
    5
    Good day, I bought the Simple IAP System for my Unity game.
    It is built on IOS.
    I added the Simple IAP System in the project settings. After I pressed apply an error code appeared.


    Assets\SimpleIAPSystem\Scripts\IAPManager.cs(24,46): error CS0246: The type or namespace name 'IDetailedStoreListener' could not be found (are you missing a using directive or an assembly reference?)

    I don't know what the error is. I ask for help!!
     
  48. Stacksunited48

    Stacksunited48

    Joined:
    Jan 17, 2023
    Posts:
    5
    Good day, I bought the Simple IAP System for my Unity game.
    It is built on IOS.
    I added the Simple IAP System in the project settings. After I pressed apply an error code appeared.


    Assets\SimpleIAPSystem\Scripts\IAPManager.cs(24,46): error CS0246: The type or namespace name 'IDetailedStoreListener' could not be found (are you missing a using directive or an assembly reference?)

    I don't know what the error is. I ask for help!!
     
  49. Stacksunited48

    Stacksunited48

    Joined:
    Jan 17, 2023
    Posts:
    5
    Good day, I bought the Simple IAP System for my Unity game.
    It is built on IOS.
    I added the Simple IAP System in the project settings. After I pressed apply an error code appeared.


    Assets\SimpleIAPSystem\Scripts\IAPManager.cs(24,46): error CS0246: The type or namespace name 'IDetailedStoreListener' could not be found (are you missing a using directive or an assembly reference?)

    I don't know what the error is. I ask for help!!
     
  50. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,291
    Hello @Stacksunited48 , no need to spam the thread - your reply has been recorded three times now. You are not using the latest version of Unity IAP, currently being 4.8.0. Please select this version in the Package Manager, or if you do not see it, install it manually as described in the Install Instructions.