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. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    Hi @bgakiya, previous versions of Simple IAP System are not available through the Asset Store. Please send an email with your Asset Store invoice number to info [at] rebound-games [dot] com.
     
  2. bgakiya

    bgakiya

    Joined:
    Jul 2, 2015
    Posts:
    11
    thanx mate, but In asset store you can download the latest version and i need a previous one, i al ready sent the invoice to rebound games, Cheers!
     
  3. bgakiya

    bgakiya

    Joined:
    Jul 2, 2015
    Posts:
    11
    Thanx Baroni, I already sent the email, hope to hear from you (reboundgames) soon, Cheers!
     
  4. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi @Baroni ,

    I have a urgent issue, I just buyed in my game for real money and I get threefold (x3) more items, how is this possible ?

    Code (CSharp):
    1. int coins= DBManager.GetPlayerData("coins").AsInt;
    2.                     DBManager.SetPlayerData("coins", new SimpleJSON.JSONData(coins+ 20));
    3.                     ShowMessage("20 " + GameManager.Instance.coinsText);
     
  5. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    @D0R1N depends on the implementation you did... You could have more than 1 IAPListener script in the scene, or accessing DBManager methods at multiple points. Is there a reason why you are not using the virtual currency system (SetFunds, GetFunds) and use PlayerData instead? This will also result in not getting any currency substracted if your players buy a product in exchange for coins, for example. Having an additional integer is not required either, because there's DBManager.IncreaseFunds/IncreasePlayerData.
     
  6. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    @Baroni I don't have multiple IAPListner in the scene I tried this method:
    Code (CSharp):
    1. DBManager.IncrementPlayerData("revives", 20);
    => I buyed 20 => get 40 ...really don't know how or why :(

    I will try to make my "revives" as currencies and increase the number by DBManager.IncreaseFunds , because this method seems to work properly ;)
     
  7. Tarzan111

    Tarzan111

    Joined:
    Oct 8, 2014
    Posts:
    72
    Hi, i'm working for wp8.1 and have the following error when I'm trying to build :

    Assets\SimpleIAPSystem\Extensions\SimpleJSON.cs(389,64): error CS0234: The type or namespace name 'FileInfo' does not exist in the namespace 'System.IO' (are you missing an assembly reference?)

    Assets\SimpleIAPSystem\Scripts\MiniJson.cs(628,29): error CS1061: 'System.Type' does not contain a definition for 'IsPrimitive' and no extension method 'IsPrimitive' accepting a first argument of type 'System.Type' could be found (are you missing a using directive or an assembly reference?)

    I tried to build without those lines. Seems to work but when I'm on the payment screen I have this :
    "Fake title - myidproduct
    $123.5000000"
    It's a simulation payment, I don't know why it's showing this..

    I'm using Unity IAP
    I'm working in windows 10 - Unity 5.3.0f4 - SimpleIAP 3.0.1

    Thanks
     
  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    Hi @Tarzan111,

    the System.IO.FileInfo and System.Type.IsPrimitive classes should be available on WP8.1. Unity IAP shows simulation payments with $123 only when running in the Unity editor, not on the device. Did you debug the device already to make sure it is connected to your dev account properly?

    Addition: see this thread for a similar issue others are having with Unity IAP on Windows Phone.
     
    Last edited: Jan 22, 2016
  9. Tarzan111

    Tarzan111

    Joined:
    Oct 8, 2014
    Posts:
    72
    I'm having the 123$ screen on my wp8 phone which is connected to my dev account, i published my app to test it on an other phone and i have the same screen once the app is published.

    There is my test app for IAP. Click on the leaderboard button (bottom right) to acces the IAP screen.
    http://windowsphone.com/s?appid=17451db2-d3fb-4402-b15a-a7435f7f9a9a
     
  10. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    @Tarzan111
    According to Unity and the thread I linked earlier, test IAPs should not be present when you beta test your app. If you experience something different, could you please prove it in that thread.
     
  11. ruigouveia

    ruigouveia

    Joined:
    Feb 2, 2016
    Posts:
    3
    Hi @Baroni ,

    I've bought SIS and implemented it in Unity 5.1.
    It works perfect in the editor but I'm having an error on android. The price on the buy button doesn't get updated and nothing happens when i press it.
    I also get this log error when debugging on android-> VirtualItemNotFoundException: Virtual item was not found when searching with itemId=goo_02
    I Published the product in Google Developer Console as alpha and created an In App product(which is active).
    I've created a new object on IAP Setting with the correct ID, matching the one from googlePlay.
    I've created a SOOMLA Secret, pasted the Google Play API Key in soomla setting.
    I've pasted Game Key and Env key in Grow settings.
    My Unity Bundle Identifier matches the one in google console, so do the Bundle Version and Bundle Version Code.
    Is there something i'm missing?
    I've tried all i could think off but cant get it to work!
     
    Last edited: Feb 2, 2016
  12. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    Hi @ruigouveia, thank you for your purchase and the detailed explanation.

    Are you logged in with a test account on your device? Also could you monitor the device log when starting the app, as SOOMLA's initialization could fail - which would lead to a faulty Google Play connection. Please post questions related to SIS for SOOMLA in our designated thread next time.
     
  13. cradiff

    cradiff

    Joined:
    Feb 7, 2015
    Posts:
    66
    Many of my players complain, the payment always unavailable on Samsung Galaxy note 5. How can I fix it?
     
  14. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    My crystal ball says that you are using OpenIAB which has not been updated for ages and that's why I've stopped supporting it last year. Upgrade Simple IAP System to the latest version to use it in combination with Unity IAP or another supported billing plugin (see first page).
     
  15. cradiff

    cradiff

    Joined:
    Feb 7, 2015
    Posts:
    66
    Thank you very much, Baroni
     
  16. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    I can't seem to add Virtual items when using Unity IAP, the options are not in the drop down list. Any ideas please?
     
  17. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    @derkoi Virtual and real items are combined in one view. Press on the add product button, it's a dropdown. Otherwise, screenshot please.
     
  18. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Thanks for the quick reply.

    On the demo scene I noticed it said Consumable Virtual & Non Consumable Virtual in the Type dropdown list but this isn't the case when I install the Unity IAP plugin.



    Are you saying I should select Virtual Economy when creating a product & the Type refers to virtual type only?
     
  19. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    That's correct. I'll update the documentation where necessary, thanks for the feedback.
     
  20. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Ah right, that makes sense now. At least it's working.

    How can I find out if an item is owned, so i can enable it in my game?

    Thanks
     
  21. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    DBManager.isPurchased("your product ID"). Please see the scripting reference for more useful public methods.

    The first time a product gets bought, the IAPListener script will get invoked. So you can also unlock one-time things there (such as adding coins).
     
  22. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Thanks!
     
  23. Salson

    Salson

    Joined:
    Mar 30, 2016
    Posts:
    4
    Hello! I just bought your plugin, and I have a question, If I want to make purchose with real money, i can do it with the Stan's Assets plugin? Or I need prime31 plugin?

    Thanks.
     
  24. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    @Salson Hi, we support multiple billing plugins and each plugin has the same functionality in SIS (as you can see on the supported plugin matrix on the first page). You can use either, or Unity IAP which is free.
     
  25. Salson

    Salson

    Joined:
    Mar 30, 2016
    Posts:
    4
    Ok, I am testing the pluging, and when I try to add a product in a category, and select 'In App Purchose' appear the next error:

    "Can't create products for real money. You need to import a billing plugin first! Open 'Window > Simple IAP System > Plugin Setup' if you want to use one."

    I don't know why appear this error.
     
  26. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    @Salson the error tells you exactly what to do. You did not read the first page of the documentation.
     
  27. Salson

    Salson

    Joined:
    Mar 30, 2016
    Posts:
    4
    Yes, I read, but i just find the error, i haven't the right unity version, i am updating now.
    Thanks for the help
     
  28. yuq229

    yuq229

    Joined:
    May 14, 2013
    Posts:
    4
    hi Baroni!

    Please tell me how to change price, description of item in c#?
     
    Last edited: Mar 31, 2016
  29. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    Hi, for real money products you either do that in the IAP Settings editor or on the App Store dashboard. For virtual products you can get an IAPObject via IAPManager.GetIAPObject and modify its virtualPrice variable, which is a list of IAPCurrency.
     
  30. yuq229

    yuq229

    Joined:
    May 14, 2013
    Posts:
    4
    Thanks @Baroni !

    i want change price & description of virtual products. please help me write more example script? :)
     
  31. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    @yuq229
    IAPManager.GetIAPObject("your product id").virtualPrice[0].amount = 500;
     
  32. yuq229

    yuq229

    Joined:
    May 14, 2013
    Posts:
    4
  33. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi Baroni,

    I got a question for you, in my game I got a product (for real money) that can be purchased during the gameplay, the issue is by purchasing the items, the player needs to restart the level scene to get the items :( , my code:

    Code (CSharp):
    1. IAPManager.PurchaseConsumableProduct("prod_revives");
    2.             if (DBManager.isPurchased("prod_revives"))
    3.             {
    4.                 IAPManager.purchaseSucceededEvent += PurchaseSucceded;
    5.             }
    6.             else
    7.             {
    8.                 IAPManager.purchaseFailedEvent += PurchaseFailed;
    9.  
    10.   private void PurchaseSucceded(string _prod)
    11.     {
    12.     if(_prod== "prod_revives")
    13.         {
    14.             DBManager.IncreaseFunds("revives", 20);
    15.             IAPManager.purchaseSucceededEvent -= AchizitieInvieriSucces;
    16.         }
    17.     }
    18.  
    19.     private void PurchaseFailed(string _prod)
    20.     {
    21.         if (_prod== "prod_revives")
    22.         {
    23.           //DISPLAY ERROR
    24.             IAPManager.purchaseSucceededEvent -= AchizitieInvieriEsuata;
    25.         }
    26.     }
    27.             }
    Please guide me how to make them update instantly. Thanks in advance!
     
  34. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    @D0R1N is that the code you are using or is it from multiple scripts you wrote?
    1. The brackets don't match
    2. If you call the purchase (line 1) and check for its purchase in the same frame right after that (line 2), you ignore the whole purchase workflow the user has to go through and DBManager.isPurchased will return false. If he comes back later and really purchased the product, it could return true.
     
  35. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi @Baroni ,

    The code is from one single script, I copied and translate it for you this is why the brackets don't match.
    Can you please give me an example how to solve this issue, how to make the process to work correctly?

    Thanks,
     
  36. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    @D0R1N I can't give advices for your custom scripts, because it is not possible for me to see every detail and execution logic of your game. Maybe I should ask why you are hacking ways around the included scripts instead of using them?
     
  37. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    @Baroni

    In my case I want to buy a product not from my shop scene, I thought this is the right approach for this :( my full code:
    Code (CSharp):
    1. public void PlayerRevive()
    2.     {
    3.         if (canRevive)
    4.         {        
    5.             DBManager.IncreaseFunds("revives", -1);
    6.  
    7.         }else if (!canRevive) {
    8.             IAPManager.PurchaseConsumableProduct("prod_revives");
    9.             if (DBManager.isPurchased("prod_revives"))
    10.             {
    11.                 IAPManager.purchaseSucceededEvent += PurchaseSucceded;
    12.             }
    13.             else
    14.             {
    15.                 IAPManager.purchaseFailedEvent += PurchaseFailed;
    16.             }
    17.         }
    18.     }
    19.  
    20.     private void PurchaseSucceded(string _product){
    21.     if(_product == "prod_revives")
    22.         {
    23.             DBManager.IncreaseFunds("revives", 20);
    24.             IAPManager.purchaseSucceededEvent -= PurchaseSucceded;
    25.             canRevive = true;
    26.         }
    27.     }
    28.  
    29.     private void PurchaseFailed(string _product)
    30.     {
    31.         if (_product == "prod_revives")
    32.         {
    33.             //ERROR MESSAGE
    34.             canRevive = false;
    35.             IAPManager.purchaseSucceededEvent -= PurchaseFailed;
    36.         }
    37.     }  
    What is wrong :( ?
     
  38. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    @D0R1N As I said, the way you are listening to the events does not make much sense. For example you are listening to the PurchaseSucceded method if the product is purchased already, so this will never get called. Another error is that you've added the PurchaseFailed method to the successfulEvent at the bottom of your script. Or you didn't add both events every time.

    Code (CSharp):
    1. public void PlayerRevive()
    2.     {
    3.         if (canRevive)
    4.         {    
    5.             DBManager.IncreaseFunds("revives", -1);
    6.         }else if (!canRevive) {
    7.             IAPManager.PurchaseConsumableProduct("prod_revives");
    8.         }
    9.  
    10. IAPManager.purchaseSucceededEvent += PurchaseSucceded;
    11. IAPManager.purchaseFailedEvent += PurchaseFailed;
    12.     }
    13.  
    14.     private void PurchaseSucceded(string _product){
    15.     if(_product == "prod_revives")
    16.         {
    17.             DBManager.IncreaseFunds("revives", 20);
    18.             canRevive = true;
    19.         }
    20.  
    21. IAPManager.purchaseSucceededEvent -= PurchaseSucceded;
    22. IAPManager.purchaseFailedEvent -= PurchaseFailed;
    23.     }
    24.  
    25.     private void PurchaseFailed(string _product)
    26.     {
    27.         if (_product == "prod_revives")
    28.         {
    29.             //ERROR MESSAGE
    30.             canRevive = false;
    31.         }
    32.  
    33. IAPManager.purchaseSucceededEvent -= PurchaseSucceded;
    34. IAPManager.purchaseFailedEvent -= PurchaseFailed;
    35.     }  
     
    Last edited: Apr 1, 2016
    Fronne likes this.
  39. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi @Baroni ,

    So I can't buy and verify the purchase only if it's fired from shop with IAPListener, or can achieve this another way ? Thanks!
     
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    I'm not sure I understand your question. The code I've posted in my last reply is a corrected version of what you've wanted to do.
     
  41. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    OK I will testing the code you posted, only think I want to know if I will get the products if purchase succeded right the way, not to leave the scene? Thanks!
     
  42. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    @D0R1N The response from the IAPManager (purchaseSucceededEvent) can be fired in any scene.
     
  43. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    @Baroni ,

    I tried the code that you provided, and I still not get the products after real purchase, I need to restart my scene, is there a solution to make it work :( ?
     
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    @D0R1N did you notice that in the default shop scenes delivered with SIS, the products get updated after a purchase? Without switching scenes or anything - just staying in the shop scene. If you are not using prefabs/shop scenes, you will also have to update the product yourself after the purchaseSucceededEvent has fired. I think that's as much as I can help without knowing what you are actually doing or what you've modified in the default workflow.
     
  45. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    @Baroni , I got this error after purchasing :
    Code (CSharp):
    1. 04-04 23:24:50.375  11562-11620/? I/Unity﹕ NullReferenceException: Object reference not set to an instance of an object
    2.             at SIS.IAPListener.HandleSuccessfulPurchase (System.String id) [0x00000] in <filename unknown>:0
    3.             at (wrapper delegate-invoke) System.Action`1<string>:invoke_void__this___string (string)
    4.             at (wrapper delegate-invoke) System.Action`1<string>:invoke_void__this___string (string)
    5.             at (wrapper delegate-invoke) System.Action`1<string>:invoke_void__this___string (string)
    6.             at SIS.IAPManager.ConsumeSucceeded (.BillingResult result) [0x00000] in <filename unknown>:0
    7.             at (wrapper delegate-invoke) System.Action`1<BillingResult>:invoke_void__this___BillingResult (BillingResult)
    8.             at AndroidInAppPurchaseManager.OnConsumeFinishedCallBack (System.String data) [0x00000] in <filename unknown>:0
    9.     (Filename:  Line: -1)
     
  46. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    The error shows that the consume was successful but canceled in the IAPListener HandleSuccessfulPurchase method. You are somehow referencing an object which does not exist in there.
     
  47. XCO

    XCO

    Joined:
    Nov 17, 2012
    Posts:
    380
    Does this plugin support PLAYMAKER ?
     
  48. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    This is an event driven system that requires little, basic Unity coding knowledge. Playmaker support won't come anytime soon.
     
    XCO likes this.
  49. XCO

    XCO

    Joined:
    Nov 17, 2012
    Posts:
    380
    Thanx for the fast response my man, does this just mean thats its super easy to use ? lol cause that sounds great :D

    - Also if its easy you should consider adding Play maker :)
     
  50. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    @XCO
    Yes, it is (at least I think so). You can watch our YouTube video for an overview. You will have to put code at only one place and all methods are documented.
     
    XCO likes this.