Search Unity

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

    173 vote(s)
    86.5%
  2. Voxel Busters

    10 vote(s)
    5.0%
  3. Stans Assets

    13 vote(s)
    6.5%
  4. Prime31

    4 vote(s)
    2.0%
  1. XCO

    XCO

    Joined:
    Nov 17, 2012
    Posts:
    380
    Thanx my man! :D
     
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Version 3.1

    With this version, we are now one of the very few (if not the first) Unity billing asset publishers supporting the Amazon App Store in a user-friendly, customizable way for IAP storefronts directly in the Unity editor (using Unity IAP)! Also in this version: due to its complexity in setup requirements and going forward, the server-side receipt verification scripts have been replaced with client-side receipt verification when using Unity IAP. We will work on rolling it out to other billing plugins as well. Server-side receipt verification is now considered an advanced feature and still available as a flat fee service on our website.

    Release notes, in short:
    - Unity IAP: added Amazon App Store support.
    - Unity IAP: added client-side receipt verification validator script, see documentation PDF on how to use it on the IAPManager prefab.
    - All packages: removed server-side receipt verification. This will be replaced by a more versatile component system in the future.
     
  3. kujo

    kujo

    Joined:
    Aug 19, 2013
    Posts:
    106
    I've just updated to the latest version of SIS for Amazon App store, but I'm missing IAmazonConfiguration. I've had a look through the documentation, but can't find anything relating to Amazon.
     
  4. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Update your Unity IAP plugin in Unity's services panel.
     
  5. kujo

    kujo

    Joined:
    Aug 19, 2013
    Posts:
    106
    Wonderful - thank you for the speedy response. Thats fixed it :)
     
    Baroni likes this.
  6. reese01

    reese01

    Joined:
    Oct 21, 2014
    Posts:
    21
    Is the restore in-app purchases button also implemented?
     
  7. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Yes.
     
  8. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Hi I recently purchased the Simple In-App Purchase System.

    I'm learning to use it and so far everything seems to work. The player can buy items and in the IAPListener I am able to activate the items that have been purchased. Basicly changing playerprefs values that my game has.

    But I have one question. In my game you can buy for example a sword. You can buy the sword or find the sword in the game. So when the player found the sword, how do I change the shop that player can't buy that item since he already has it? So somehow I need to send info to the SIS database that the item already available for the player so the player won't accidently buy it.
     
  9. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi @Nadan,

    you can use DBManager.SetToPurchased("your product ID") for that. Please have a look at the scripting reference for a lot of other useful database-related methods.
     
    Nadan likes this.
  10. Simon_says

    Simon_says

    Joined:
    Oct 19, 2013
    Posts:
    141
    Can this plugin work without using any purchases with real money so it only works with virtual currency? This virtual currency would be earned through game.
     
  11. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Yes. Just don't import any billing package in our "Plugin Setup" window.
     
    Simon_says likes this.
  12. Simon_says

    Simon_says

    Joined:
    Oct 19, 2013
    Posts:
    141
    What about anti-cheat? Is it supported by default? If not, is it possible to integrate assets like Anti-Cheat Toolkit by replacing the value types to prevent user modifications?
     
  13. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    @Simon_says Anti-Cheat is not supported by default. Simple IAP System saves all shop data in one, optionally encrypted, JSON string on the device using PlayerPrefs. If you don't want to use our encryption or use 3rd party tools like Anti-Cheat toolkit instead, all you have to do is to replace our PlayerPrefs call (in the DBMananager class) with whatever Anti-Cheat toolkit is using to save and load the data.
     
    Last edited: May 13, 2016
    Simon_says likes this.
  14. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    So far I've got everything working on Google Play. Even the first purchase was made two days ago!

    I'm having problems with iOS version. When I run the game on Unity editor it works, I can buy product. Status for my products are approved in iTunes Connect. I have made iTunes sandbox test user account and logged in with my iPad. When I run the game from xCode with Developement Build and try to buy product it says:

    Code (csharp):
    1. NullReferenceException: A null value was found where an object instance was required.
    2.  
    3.   at SIS.IAPItem.Purchased (Boolean state) [0x00000] in <filename unknown>:0
    4.  
    5.   at UnityEngine.UI.Button.Press () [0x00000] in <filename unknown>:0
    6.  
    7.   at UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00000] in <filename unknown>:0
    8.  
    9.   at UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) [0x00000] in <filename unknown>:0
    10.  
    11.   at UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchPress (UnityEngine.EventSystems.PointerEventData pointerEvent, Boolean pressed, Boolean released) [0x00000] in <filename unknown>:0
    12.  
    13.   at UnityEngine.EventSystems.StandaloneInputModule.Process () [0x00000] in <filename unknown>:0
    14.  
    15. UnityEngine.Logger:LogException(Exception, Object)
    16.  
    17. UnityEngine.Debug:LogException(Exception)
    18.  
    19. UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
    20.  
    21. UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
    22.  
    23. UnityEngine.EventSystems.StandaloneInputModule:Process()
    24.  
    25. (Filename: currently not available on il2cpp Line: -1)
     
    Last edited: May 14, 2016
  15. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    @Nadan there's not much I can help you with here, as I obviously can't look into your project settings. Could you please also state the billing plugin you are using (I don't keep track of which customer uses which billing plugin) :)
    If you're using Unity IAP, the first thing to check is whether the connection to the App Store works. You can do that by putting a Debug.Log in the OnInitialized method of the IAPManager script.
     
  16. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    I'm using Unity IAP.

    So what line do I add here in IAPManager script?

    Code (csharp):
    1. //Optionally:verifyoldpurchasesonline.
    2. //Oncewe'vereceivedtheproductlist,we overwrite
    3. //theexistingshopitemvalueswiththisonline data
    4. public void OnInitialized(IStoreController ctrl, IExtensionProvider ext)
    5. {
    6. controller = ctrl;
    7. extensions = ext;
    8.  
    9. if (validator && validator.shouldValidate(VerificationType.onStart))
    10. validator.Validate();
    11.  
    12. if (ShopManager.GetInstance())
    13. ShopManager.OverwriteWithFetch(controller.products.all);
    14. }
    I started the game in xCode and looked at the Debug Log and found out these.

    Code (csharp):
    1. UnityIAP:Received 4 products
    2. UnityIAP:No App Receipt found
    3.  
    4. Warning: Unknown product identifier: {0}: coins
    5. UnityEngine.Purchasing.AppleStoreImpl:ProcessMessage(String, String, String, String)
    6. UnityEngine.Purchasing.<MessageCallback>c__AnonStorey0:<>m__0()
    7. UnityEngine.Purchasing.Extension.UnityUtil:Update()
    8.  
    9. Unavailable product consumable -com.unity3d.test.services.purchasing.consumable
    10. UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    11. UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    12. UnityEngine.Purchasing.AppleStoreImpl:ProcessMessage(String, String, String, String)
    13. UnityEngine.Purchasing.<MessageCallback>c__AnonStorey0:<>m__0()
    14. UnityEngine.Purchasing.Extension.UnityUtil:Update()
    Are there any different settings in SIS for Android and iOS versions? I made the IAP store with Android version and it works with Google Play. Then I copied the project to my Mac and changed the game to iOS version. The product identifiers are same in Google Play and iTunesConnect.

    Danke schön!
     
  17. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    @Nadan
    If you're getting the "Received 4 products" message and you actually have 4 IAPs set up on the store, then the App Store connection seems to be working fine. What about the coins message, do you have a "coins" ID set up on both sides?

    Please check the iOS guide on our forums if you haven't already, there is a section at the bottom for common errors and a quick checklist.
     
  18. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    iTunesConnect

    Product ID: coins
    Cleared for Sale: Yes

    (SIS) IAP Settings:

    Identifier: coins

    So they should be set up on both sides. I have checked the iOS guide on your forum but haven't found solution yet.
     
  19. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    @Nadan looks fine to me! One last thing is make sure to fully remove your app from the device before deploying it again, as this deletes the local storage. Unfortunately I'm unable to debug this further...
     
  20. portgalaxy

    portgalaxy

    Joined:
    Dec 9, 2011
    Posts:
    55
    I'm receiving the exact same error, and unable to fix it.
     
  21. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Being handled via email.
     
  22. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Have you found any solution yet?
     
  23. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    I've been waiting for a project that reproduces this to test against my iTunes settings, but never heard back. Could you send me yours via email? If I can't reproduce it when building against my account, then the issue is not with Unity or SIS.
     
  24. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708
    @Baroni
    Really like the asset so far.
    I'm currently having one issue so far. If I set a price of coins to< $0 > for a virtual Non Consumable product, it will automatically unlock even if the Lock setting have yet to be met. ie level 2. is there something I'm missing here ?

    My thoughts here are that I would like some items automatically unlocked as the player progresses his level, while other items will need to be purchased.

    Thanks
     
  25. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi @JBR games,

    the DBManager unlocks products with a price set to 0 on app launch. It does not check for requirements, or knows when a requirement changed so it could do the check again. That's because requirements are meant to unlock products which can be purchased afterwards, not products which are free by definition.

    If you would like to give an item to the user for free, you could call this at any time, e.g. after a game round ended:
    Code (csharp):
    1. if (DBManager.isRequirementMet("product ID"))
    2. DBManager.SetToPurchased("product ID");
     
  26. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708
    Good to know thanks for the Quick response..
     
  27. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708


    I'm unable to add the string Name, Any ideas why ?
     
    Last edited: May 23, 2016
  28. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Sorry, you have to get the IAPObject of the IAPManager first, then pass over its requirement variable.

    Code (csharp):
    1. IAPObject obj = IAPManager.GetIAPObject("product id");
    2. if(DBManager.isRequirementMet(obj.req))
    3. {
    4.   //...
    5. }
     
    JBR-games likes this.
  29. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708
    Thanks for all the help so far, One last question and hopefully I can stop bothering you for a while. Once I check and a requirement is met, I would like to have a pop up on screen with the image, title, and description.
    Code (CSharp):
    1.  public void CHeckAllStats()
    2.     {
    3.         if (!DBManager.isPurchased("Cold_Blooded")){
    4.             IAPObject obj = IAPManager.GetIAPObject("Cold_Blooded");
    5.             if (DBManager.isRequirementMet(obj.req))
    6.             {
    7.                 DBManager.SetToPurchased("Cold_Blooded");
    8.                 if (PopUp != null)
    9.                 {
    10.                     popUpImage.sprite = obj.icon;
    11.                     popUpTitle.text = obj.title;
    12.                     popUpDescription.text = obj.description;
    13.                     PopUp.SetActive(true);
    14.                 } else
    15.                 {
    16.                     Debug.Log("Add a pop up to the scene for scoreManager");
    17.                 }
    18.             }
    19.  
    20.         }
    21.     }

    So now that I have a reference to the IAP object, I should be able to access all of its info this way correct ?
     
    Last edited: May 23, 2016
  30. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Yes, that'll work.
     
  31. Simon_says

    Simon_says

    Joined:
    Oct 19, 2013
    Posts:
    141
    Is it possible to extend the database to support "item types"? I have multiple virtual items which are some of the same type, means that user can select 1 item from 1 group and also select some other item from the other group at the same time, but not 2 items from the same group. Or preferably is it maybe possible to make it in UI to have multiple selection group?

    Also, how to start with some virtual items as "purchased" already? Even if I put price 0, still user has to click on the buy button to have it.

    And lastly, I don't have real currency IAP, the only way to earn coins is through watching ads, so how can I make it in shop that instead of the price for coin back it says "watch ads" or so? And how to lock/unlock this button based on ad availability(bool)?
     
  32. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Did you check our sample scenes and took a look at the weapon section? You can only select one weapon at the same time. If you buy and select another weapon, the previous weapon gets unselected. By your description, I think that this is what you are looking for?

    Non-consumable products with a price set to 0 currency are starting purchased by default and there is no buy button to press. If you are using a selectable non-consumable product then the user has to press the "Select" button once indeed. If you would like to preselect a product, you can get all selected products via DBManager.GetAllSelected() - to check if a selection exists already - and add DBManager.SetToSelected(string id, bool single) in some Start() method (otherwise you would overwrite the user selection every time).

    I would suggest adding your own UI button to the scene, not a Simple IAP System item prefab, which has a script with your custom logic attached on it. If your user has watched the ad you can give him coins by using our DBManager methods, e.g. IncreaseFunds.
     
  33. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    I finally found the solution.

    What happened was that when I started to add IAP to my game at first I looked at the Unity instructions. So I followed this Unity tutorial: https://unity3d.com/learn/tutorials/topics/analytics/integrating-unity-iap-your-game

    After that I found your asset SIS in the asset store and purchased it. I installed SIS to my android version of the game and everything worked. The mistake that I made however at this point was that I never deleted the Purchaser.cs from Unity tutorial when I moved on to the iOS version. I forgot about the tutorial since SIS was working with Android version and never looked back. But that script broke the SIS with Apple iOS.

    So lesson learned: make sure there are no other IAP scripts in the game messing with SIS.

    Anyway, thanks for the support, I gave your asset 5 stars BTW.
     
    Last edited: May 27, 2016
    Baroni likes this.
  34. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708
    @Baroni
    I wanted to transfer my IAP settings from a demo test project to another project is this possible? And if so what are the basic steps.
    Thanks
     
  35. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    @JBR games
    Set up your project ready for using SIS with a billing plugin as per instructions. All product details are saved on the IAPManager prefab. Export this prefab as a unitypackage on the old project and import it in the new project. Optionally include the IAPListener script too, if you've made changes there. The same routine applies for upgrading to a new version of SIS.
     
  36. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Hi!

    In my game all the coins are in my server. So when the player purchases coins then I add them to the server. You know like this in the IAPListener.cs
    Code (csharp):
    1. WWW hs_post = new WWW(addCoinsUrl);
    2. StartCoroutine(WaitForRequest(hs_post));
    Some players however have purchased coins and then restored the money. The problem here is that they get to keep the coins while I didn't get paid. Is there a way to fix this? I quess the SIS own system does this for it's coins but in a situation like this when the coins are on a server side. I can of course take the coins from server but don't know where to put that code.
     
  37. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi @Nadan, SIS does not observe refunded consumable purchases either. Mainly because if consumed, they're gone. I don't think that Unity IAP offers a way to be informed of such refunds. Thus your question would be better directed at the Unity IAP team, as this is not some specific functionality in SIS.
     
  38. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Hi, I'm using SIS and saving the data string to cloud for player backup. When the player starts the game I load the data string from the cloud if it's changed but then the player has to close the game and reopen it for changes to take effect, is there a way I can refresh SIS to read the new data string after I've downloaded it from the cloud? I tried reloading the scene but that doesn't make a difference.

    Thanks
     
  39. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
  40. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Thanks, I'll give that a try.
     
  41. ResoDev

    ResoDev

    Joined:
    Mar 1, 2016
    Posts:
    2
    Hi, could I use SIS without setting up IAP for real money. I just want to have a virtual currency that would be used for buying skins. Is it possible, or do I have to implement Unity IAP no matter what?
     
  42. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi @ResoDev
    We are providing an option for using virtual products only. Just select 'No Billing' in our IAP Settings editor on setup.
     
  43. ResoDev

    ResoDev

    Joined:
    Mar 1, 2016
    Posts:
    2
    Thank you very much.
     
  44. StenBone

    StenBone

    Joined:
    Dec 21, 2013
    Posts:
    42
    Hello @Baroni

    I am using Simple IAP System and so far everything is working perfectly except for the encryption. With "Encrypt" enabled in the DB Manager component of the IAPManager game object, I get the message below when running the scene. I have tried multiple keys, even simple ones like "abcdefgh" and I still get this error. Do you know why this is occurring?

    IAP error.png
     
  45. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi @BloodHound92,

    did you delete the database after enabling/disabling encryption? There's a button for that in the AllSelection scene. You have to do this, because your old data (unecrypted or encrypted) cant be read anymore if you change the encryption or key.
     
  46. StenBone

    StenBone

    Joined:
    Dec 21, 2013
    Posts:
    42
    It seems like the "Clear Database" button in the AllSelection scene wasn't working correctly. Thankfully I have a plugin called "Advanced PlayPrefs Window" that shows all your project's PlayPrefs. I used that plugin to manually delete the "data" PlayerPref and now everything works perfectly.

    Thank you for your help! I am really enjoying Simple IAP System!
     
  47. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    My game project files got way too big over the years so I started the game from clean slate. Made new project and imported, then exported each scene to new project only keeping those files that are used in the game. Now I noticed that the SIS settings didn't move this way, so is there a specific file that I could copy to the new project that would have the data? Or do I have to enter the settings manually I use in the store from scratch? Any tips?
     
  48. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    FAQ #13
     
    Nadan likes this.
  49. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Works, thank you. What about customers that have bought items before. Is that data stored at Google, Apple etc. Or is that data within sis? Just making sure players are not losing items on my next update.
     
  50. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    @Nadan SIS stores bought purchases on the users device. If you do not rename product identifiers or delete PlayerPrefs, they will still be there after an app update. Additonally, non-consumable purchases exist in Google/Apple's cloud and can be restored by SIS, if needed (i.e. the player deletes your app before installing the update).
     
    Nadan likes this.