Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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

    171 vote(s)
    86.4%
  2. Voxel Busters

    10 vote(s)
    5.1%
  3. Stans Assets

    13 vote(s)
    6.6%
  4. Prime31

    4 vote(s)
    2.0%
  1. fmarkus

    fmarkus

    Joined:
    May 22, 2010
    Posts:
    181
    Baroni, great news for the uGUI update! Do you have an ETA for the ability to read an excel file?
     
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Version 2.3: uGUI integration is ready!

    THIS VERSION IS NOT BACKWARDS COMPATIBLE. You can already download it from the Asset Store or our online store (using Unity 4.6). Please contact me if you still need a NGUI-compatible version.

    Features
    - replaced NGUI with Unity uGUI released in Unity 4.6
    - full rebuild of all UI prefabs and shop templates to be compatible with uGUI

    Fixes & Changes
    - script changes have been made in ShopManager, IAPManager, IAPItem, IAPEditor
    - renamed some variables on IAPItem to make their purpose more obvious
    - rewrote UIPanelStretch for uGUI and removed UIUpdateCollider
    - updated documentation with respect to uGUI changes and references



    Happy uGUI-ng!

    @fmarkus
    I've spent a lot of time on the last versions fixing bugs, adding platforms and platform overrides (and now uGUI support), but your request about CSV import is still on my list. I don't have an ETA to share at the moment.
     
  3. fmarkus

    fmarkus

    Joined:
    May 22, 2010
    Posts:
    181
    Awesome version! Thanks!
    No problem. I will wait patiently :)
     
  4. fmarkus

    fmarkus

    Joined:
    May 22, 2010
    Posts:
    181
  5. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Hi Baroni,

    I have a question about restoring purchases on the Apple App Store.

    Right now I have 5 in-app purchases: a no-ads nonconsumable purchase, and 4 "virtual cash bundle" consumable purchases that all include the no-ads feature as part of the bundle.

    Apple rejected my app because they said any no-ads purchase must be restorable. That's not a problem with the simple no-ads purchase. But it's a problem if the no-ads was obtained as part of a consumable purchase (consumable purchases cannot be restored).

    So I was wondering if there's a way to automatically purchase the nonconsumable no-ads purchase "behind the scenes" if the user buys a consumable virtual cash bundle, without any user intervention. In other words, automatically set the nonconsumable no-ads purchase to "purchased" on the Apple servers without the user doing anything or knowing anything.

    I am using OpenIAB but there is hardly any documentation regarding this issue. Please advise! Thanks!!
     
  6. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hey eridani,

    StoreKit doesn't work like that. A product can only be set to purchased on Apple's servers by actually going through the purchase and verification process. I have found a similar question on stackoverflow.

    Another approach would be to add a free non-consumable in-app purchase to your app, which is hidden in your store. When the user buys one of your consumable items, you also let him purchase the free item directly after that. You could then use this free item id for not showing the ads anymore (and also set the other no-ads item to purchased locally).
     
  7. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi Baroni, I figured out what is my problem with this:
    Code (CSharp):
    1. Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
    2. C:\Program Files (x86)\Java\jdk1.8.0_05\bin\java.exe -Xmx1024M -="C:/Program Files/AndroidSDK/sdk\tools" -Dfile.encoding=UTF8 -jar "C:/Program Files (x86)/Unity/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar" -
    3.  
    4. stderr[
    I'm using Android Native Plugin and there is an conflict between IAP SYSTEM and ANP ...can you help me with this please ?!

    P.S Full error log: http://www.filedropper.com/errorlog
     
    Last edited: Sep 4, 2014
  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hi there,

    Simple IAP System does not include any platform specific files for Android. It could be that the combination of the billing plugin you are using (OpenIAB?) and Android Native Plugin is the reason for this to happen. The first three exceptions already give you a short description on what's wrong:

    Code (csharp):
    1. java.lang.IllegalArgumentException: already added: Lcom/android/vending/billing/IInAppBillingService$Stub$Proxy;
    2. java.lang.IllegalArgumentException: already added: Lbolts/AggregateException;
    3. java.lang.IllegalArgumentException: already added: Lcom/facebook/AccessToken$SerializationProxyV1;
    It looks like you are using plugins which provide the same functionality or even use the same SDK, so I would start looking at duplicates in your .jar files and try to remove them.
     
  9. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    HI Baroni, yes I'm using OpenIAB I tried a lot of things to fix this issue :( O.K I will wait patiently your fixes ;) thanks
     
  10. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    There's nothing I could do to remove dependencies in OpenIAB - I don't have Android Native Plugin. Sorry, I meant you should try finding duplicates in your .jar files and try to remove them.
     
  11. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    O.K but can you guide me where to find and how to remove that lines of code?
     
  12. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    These are not lines of code you can find anywhere, these are errors for duplicate files in the .jar files in your project. Each plugin comes with its own .jar file, which contains native code for Android. Let's take this exception as an example:
    Code (csharp):
    1. java.lang.IllegalArgumentException: already added: Lcom/android/vending/billing/IInAppBillingService$Stub$Proxy;
    To fix it, you need to find one of the corresponding .jar files that could contain it. In this case it's simple, because /vending/billing/IInAppBillingService clearly corresponds to an in-app billing plugin, e.g. OpenIAB.
    In your project, navigate to Plugins > Android. There you'll find the OpenIAB-plugin.jar file. Open it with an archiver software (e.g. WinRAR or 7zip), so you can look at its contents. Navigate to com > android > vending > billing within the file, and delete the three files you find there. These were the duplicate files in some other .jar file in your project.

    Now you will still get the other two errors:
    Code (csharp):
    1. java.lang.IllegalArgumentException: already added: Lbolts/AggregateException;
    2. java.lang.IllegalArgumentException: already added: Lcom/facebook/AccessToken$SerializationProxyV1;
    But I have absolutely no clue where to find them. They are not included in the OpenIAB jar file, so they are not even related to it. They could be found in some other plugin you are using.
     
  13. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Hey Baroni, do you think you will ever release an Unreal Engine 4 version of this asset?
     
    uni7y likes this.
  14. uni7y

    uni7y

    Joined:
    Jul 23, 2012
    Posts:
    287
    I would like that too! :)
     
  15. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Never say never, but I don't have any plans to do this at the moment.
     
  16. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Well if you do, you will capture the whole market, because nobody else is doing an IAP system for UE4 right now. And I would be your first customer ;)
     
  17. Banky

    Banky

    Joined:
    Sep 10, 2014
    Posts:
    24
    Hi Baroni,

    I just bought your asset and I'm trying to implement it in my project. I am having a problema (I'm sure it's my mistake, but I don't know what else to do). For the moment, as a test, I am using the vertical template (without changes).

    The problem is: if I open my store scene and edit IAP settings to add more items to the store, then :

    - if I play the game from the store scene, the new products are there, everything's fine
    - but if I play my game from the first scene, the new products added are not in the list, I can see just the default ítems
    from vertical scene.

    I am testing in my computer, not in the mobile device

    What am I doing wrong?

    Thanks!
     
  18. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi Baroni, I have a question about increasing funds when the players finishes the level adding funds COINS he collected in game ....I tried: DBManager.IncreaseFunds("coins", curCoins); but I get this error: The name `DBManager' does not exist in the current context ! How can I fix this issue ?! Thanks in advance !!!
     
  19. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    @Banky
    Heya, did you save your shop scene before switching to the first scene? The IAP editor can't save your data to the IAPManager prefab automatically, you will have to either save your scene or close the IAP editor window in order to save your changes. Let me know.

    @D0R1N
    Hi, all scripts of SIS are in a separate namespace called "SIS". You have to put: using SIS; (C#) or: import SIS; (UnityScript) at the top of your script to access it.
     
    RoyalCoder likes this.
  20. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Is there a way to change the fonts used by SIS easily in one step?

    I want to use SIS in multiple games but want to it to use different fonts for each game (medieval font for rpg, military font for shooter, space font for sci-fi shooter), and I don't want to go changing dozens of fonts on individual prefabs.

    Thanks!
     
  21. Banky

    Banky

    Joined:
    Sep 10, 2014
    Posts:
    24
    Hi Baroni,

    Well, the data is saved, because if I close and reopen Unity, the behaviour is the same:

    if I play the store scene, the data is there, but if I play the game starting from first scene, then I don't see the added data. It seems that store is reading different info

    Any ideas?

    Thanks!
     
  22. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    @eridani
    This is more a question about NGUI/uGUI than SIS-related, but I don't think so. You could write an editor script that instantiates all of your prefabs, sets the fonts and applies them back to the prefab, though.

    @Banky
    Could you please send me a private message or email with a small repro project and your data (operating system, Unity version, repro steps, IAP editor open or closed) to reproduce this issue?
     
  23. Banky

    Banky

    Joined:
    Sep 10, 2014
    Posts:
    24
    Hi Baroni,

    I imported the package again and also the OpenIAB package and it seems it's working now :)

    Thanks!
     
  24. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Interesting, good to know!
     
  25. Banky

    Banky

    Joined:
    Sep 10, 2014
    Posts:
    24
    Hi Baroni,

    Any chance you support Ultimate Mobile? It includes an Unified API for in App Purchasing for IOS, Android & WP8
     
  26. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    @Banky
    Our OpenIAB integration already supports these platforms, and it's free. I have no plans to support other billing plugins at the moment.
     
  27. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi Baroni, I reinstalled SIS and now I get this error: Assets/SIS/Scripts/IAPManager.cs(11,7): error CS0246: The type or namespace name `OnePF' could not be found. Are you missing a using directive or an assembly reference?
    How to fix this issue ?
     
  28. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Follow the instructions and import OpenIAB.
     
  29. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Thanks Baroni, I forgot to import the OpenIAB :p now works'
     
  30. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Question about consumable item packs, such as bullets. Does SIS handle maximum item amounts, and pro-rated pack pricing?

    For example, let's say I'm selling bullets for $50 for a pack of 25 bullets. I want to set the maximum number of bullets purchasable to 99.

    So I would ideally like SIS to only allow the purchase of 4 bullet packs; after that, the buy button should be temporarily disabled, until the number of owned bullets drops below 99 again.

    The first 3 packs of 25 bullets will be charged $50 dollars each. But the last pack of bullets only consists of 24 bullets, so it should be charged $48 dollars for that pack only.

    Is what I want too complicated for SIS? Please advise. Thanks Baroni!
     
  31. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    You can add this kind of logic to your game by checking the current amount of bullets (DBManager.GetPlayerData), then accessing the corresponding shop item (ShopManager.GetIAPItem) and disabling/enabling its buyButton. Also subscribe to IAPManager's purchaseSucceededEvent to get notified when the player buys bullets and handle that as desired.

    The $48 pack needs to be a separate product with its own id, as dynamic pricing is not supported on the App Stores.
     
  32. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,977
    This looks awesome, but I'm working on a PC game right now, not mobile. My game requires the user to go into the browser to purchase virtual currency, items, etc. and I'd like to allow them to do it from inside the game instead. As far as I can tell, this add-on wouldn't work for that, or would it?
     
  33. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Sorry I wasn't clear. I meant virtual consumable products using virtual dollars - no connection to the App Stores... SIS doesn't support dynamic pricing for virtual consumable packs? Thanks!
     
  34. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Thanks for your interest. On standalone platforms, this asset can be used to sell virtual items for virtual currency (e.g. swords for coins, earned in-game). Buying products for real money requires a connection to online payment processors (such as paypal or stripe), which are currently not supported.

    It does. In that case you could just alter the virtualPrice property of an IAPObject (IAPManager.GetIAPObject()) at runtime.
     
  35. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    But I would have to calculate the price of the partial pack by writing some code myself right? SIS doesn't have any feature built-in that does this?

    P.S. I don't mind modifying assets by writing small pieces of code like this, but it just makes it more hectic when upgrading the asset. So I was wondering if there is enough demand for this sort of thing to officially add it as part of SIS. Thanks Baroni!
     
  36. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Your request about purchase limitations/price adjustments is very game-specific and better handled by your own code, no generic design in SIS could do that for you. Regarding your P.S.: You don't have to modify any scripts of SIS in order to add these things. As I wrote in my previous replies, you can just call public methods of DBManager/IAPManager/ShopManager to check and alter items at runtime. I don't think that this would need more than 50 lines of code.
     
  37. TWaanders

    TWaanders

    Joined:
    Mar 27, 2013
    Posts:
    46
    Hi Baroni, quick question with regard to non consumable virtual items.
    As soon as I purchase such item, the corresponding IAPListener case gets called, which works great.
    However, as soon as the item is purchased and I select it again, I want the same action to happen again but this is not the case.

    This is why I created another switch(id) statement under "void HandleSelectedItem(string id)". This works, as soon as the items is selected (after being bought), I get the desired action, but I do face one problem with this method.
    As soon as the GUI Menu is activated, the last selected item is activated (makes sense) and thus the corresponding custom methods get called.
     
  38. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Purchasing and selecting an item should definitely have different results code-wise. Especially for non-consumable items, the purchase callback should only happen once (by design). On the other hand, selecting an item should not have any consequences to game data, except choosing the active character for example, which could happen multiple times. What are you trying to do exactly?
     
  39. TWaanders

    TWaanders

    Joined:
    Mar 27, 2013
    Posts:
    46
    In my case the non consumable items are clothing items for the game's character. When purchased, animations, sound effects etc. play, and the right model + textures are activated, which works great. When selected, I want the exact same stuff to happen, which does if I add another switch(id) statement under the HandleSelectedItem(string id) method. By default, however, the are no cases for the select button, so I added my own under HandleSelectedItem(string_id), as this is the method that is called when an already purchased item is selected (if I am correct).

    Problem is that this method (HandleSelectedItem) seems to be called as soon as the Scroll view of non consumables is rendered, the currently active item (clothing) is automatically selected an thus the effects play as soon as the scroll view is shown. I only want this to happen if the item, or preferably an inactive item is explicitly selected by clicking on the select button.

    I initially assumed that the Select button would automatically call the corresponding case under the HandlePurchase method in the listener, but it makes sense that there is a different method for selected items as opposed to purchased items (no effect on currency etc.), as you pointed out as well.
     
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Thanks for the detailed description. If the "select button" should do something, I think it would be better to hook it up to your custom method directly, rather than using "selected" callbacks (which are indeed being fired upon entering the shop scene).

    You could also modify the SetToSelected() method in ShopManager.cs to only fire selected callbacks for newly selected items, if that's what you prefer (not tested, but should work). I'll have to think about adding this the official version.

    Code (csharp):
    1. public static void SetToSelected(IAPItem item)
    2. {
    3.        bool single = item.deselectButton ? false : true;
    4.        Dictionary<string, List<string>> selection = DBManager.GetAllSelected();
    5.        string group = IAPManager.GetIAPObjectGroupName(item.productId);
    6.        //only fire callback if the item could not be found in the current selection
    7.        if(!selection.Contains(group) || !selection[group].Contains(item.productId))
    8.        {
    9.            DBManager.SetToSelected(item.productId, single);
    10.            if(itemSelectedEvent != null)
    11.               itemSelectedEvent(item.productId);
    12.        }
    13. }
     
  41. TWaanders

    TWaanders

    Joined:
    Mar 27, 2013
    Posts:
    46
    Makes sense. I am going to try both approaches tomorrow. Thanks again for you excellent support and have a good night!
     
  42. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,977
    Can the system tie into a mySQL database on my server to see how much virtual currency a user logged into my game has in their account? If so, that would work perfectly for me. The users would buy the virtual currency on my web site via PayPal, etc. (which they do currently) and then be able to access that virtual currency while in-game to purchase items. If it can do that then perfect. :)
     
  43. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    @Ony
    Player data is being stored in a single, compact JSON string and which gets loaded when the application starts. With little modifications, you could save this string to your database and load it when the user logged in - or check the amount each time they want to buy an item, but that would be up to you. I'm doing something similar in a game I'm working on, where players log into their Google+ account and their player data is stored using Google Play Games Cloud Save.
     
  44. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Hi Baroni, I've been using SIS for my IAPs in my game and I just got an email from Google stating:

    "The In-app Billing Version 2 API has been deprecated in favor of the Version 3 API. If your app is using In-app Billing, please make sure that it is using the Version 3 API. If your app is still using the Version 2 API, you must migrate to the Version 3 API as soon as possible.

    We plan to turn off the In-app Billing Version 2 service on January 27, 2015, after which time users will no longer be able to purchase in-app items and subscriptions through the Version 2 API."

    Do I need to upgrade SIS to a newer version or is this something related more to changes I have to make in the Google Play Store? Thanks!
     
  45. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    @eridani
    SIS (better: the billing plugins it supports) uses In-app billing API v3 since the beginning, no need to update anything.
     
  46. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,977
    Fantastic. Ok well I'm a month or so away from implementing the store for my new game but I think I I've found what I'm looking for. :)
     
  47. KeeLo

    KeeLo

    Joined:
    Nov 1, 2013
    Posts:
    76
    Hello! Could you send me NGUI-compatible version please as fast as you can!!!
    Thank you!
     
  48. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Please send the "invoice no." you received in the Asset Store email after your purchase to info [at] rebound-games.com.
     
  49. KeeLo

    KeeLo

    Joined:
    Nov 1, 2013
    Posts:
    76
    OK i sent
     
  50. Arashikage

    Arashikage

    Joined:
    Dec 8, 2013
    Posts:
    14
    Hi Baroni,
    I just purchased your plugin, using Unity 4.6 beta and OpenIAB, and I followed your YouTube tutorial. I put IAPManager in my main menu scene and a button in that scene leads to one of the included shop scenes. I only have a single IAP which unlocks the game but when I click on it the screen goes blank and nothing happens. I press the (hardware) back button to go back to the store scene and there's window waiting which says:
    3, Cannot start purchase process. Billing unavailable. (response: 3: Billing Unavailable)

    Any idea what the problem is?