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. Shaolin-Dave

    Shaolin-Dave

    Joined:
    Apr 3, 2015
    Posts:
    32
    Just watched your video tutorial, it's very good but leaves me with a couple questions.

    I see that you could have in-app purchases with real or virtual currencies. What I would like is to know is about having something that can be bought/unlocked with real and virtual currencies, or neither (explanation/examples below)...

    Like, what if I have a sword in my game that sells for $0.99 or 100 in-game coins, but the player can also unlock it by finding it hidden in the game (I'd still want it to be tracked like an IAP so it shows it as "owned" and can be restored as a purchase).

    Or, using Crossy Road as an example, you can pay $0.99 for an animal, or win it in the prize machine, or encounter it in-game to unlock. Could this asset be used to track unlockables in this way?

    These questions apply to consumables as well. Could the player buy 100 coins for $0.99, find them in game, or win them by watching ads, while all being tracked the same?
     
    Last edited: Jul 12, 2016
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    You are running into different scenarios here which also need different approaches:
    - pay $0.99: basic non-consumable for real money
    - pay 100 coins: basic non-consumable for virtual currency
    - win/unlock it in game: call DBManager.SetToPurchased("product ID") in your code

    Note that non-consumable purchases for real money are tracked by the App Stores, neither real money consumables nor virtual purchases are. Crossy Road is no exception here. They require you to log into Google Play Games for syncing your local device progress to Google Cloud. If you don't do that, your prize machine wins are lost. Simple IAP System saves in-app purchase data in one (encrypted) string, so you can implement that too.

    Yes to all, except the last part. As I said, consumables are never tracked. This would go against the App Store guidelines explained by Apple/Google on their IAP docs. If you want to save all user data, use cloud save or your own database server.
     
    Shaolin-Dave likes this.
  3. Shaolin-Dave

    Shaolin-Dave

    Joined:
    Apr 3, 2015
    Posts:
    32
    So, I'd have to create two items, one for real money and one for virtual?
     
  4. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Yes. In the listener for one product, you could unlock the other. Only the tracking is different then.
     
  5. wahaca

    wahaca

    Joined:
    Oct 12, 2015
    Posts:
    5
    I'm looking for a simple solution to be able to unlock scenes with IAP. I like your 'Simple IAP", but I haven't found any documentation on how this is done with your program. So I'm not sure if this product would make this process any easier.

    If so, please let me know...and maybe you can steer me in the right direction on how I would set this up?
     
  6. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Thanks for your interest @wahaca. You can definitely sell scenes for real money or virtual currency. There are multiple ways on how you could approach this, for example adding an UI button for each level which loads it, that gets enabled / disabled after checking the purchase state of that level product in our database manager class (DBManager.isPurchased("level product identifier")).
     
  7. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    @wheretheidivides I'm not sure if an app that gets blocked after a certain amount of time is allowed on all app stores so you will have to check that separately.

    Non-consumable (lifetime) purchases as in this case are stored on the users account. Players can restore their purchases across different devices so you don't have to create a separate variable for the purchase itself, because SIS does this already. It's also encrypted if you want to. What you need a variable for is your timer checking for the remaining play time until the popup should show. After the full purchase, you can check the in-app purchase validity to not show the timer or popup again. SIS provides methods for that.

    The timer variable can also be stored encrypted by SIS, but be aware that deleting the app and reinstalling it clears all user data (including the timer) which likely defeats the whole purpose of this. You would need to check a server entry for the validity instead - that is totally out of scope of this asset.
     
  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Yes. It doesn't work though because of the reasons I mentioned above. How do you ensure your timer works between app installs if the cache is cleared? Or the user modifying his device clock?
     
  9. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    The issue is with that. Imagine: user downloads your free app, the timer starts. Timer reaches zero -> popup apppears. User uninstalls app, downloads it from app store again. Timer starts from the beginning.

    The issue is not with the purchase but with your timer. The purchase is synced to the player account and players can restore that at any times (with internet connection). But the timer could reset because it is only on the device.
     
  10. Orfen

    Orfen

    Joined:
    Aug 3, 2013
    Posts:
    8
    Hello, we're considering purchasing your IAP solution for our game. The only thing we really need is the capability to validate if a user has an active subscription with IAP, does your package offer this functionality? Our current IAP implementation can only tell us if the user has purchased a subscription IAP in the past, but not if it's currently active. We re using Unity 4.x
     
    Last edited: Aug 24, 2016
  11. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Thanks for your interest @Orfen. I can say for certain that our asset supports checking active subscriptions on Android, via the additional receipt verification service offered on our website. It is a separate service because there are a lot of requirements and preparations going on in order to be able to use server-side receipt verification. I haven't tested iOS subscriptions with our verification script in a while, but I will make sure to test that again if you made a decision.
     
  12. Orfen

    Orfen

    Joined:
    Aug 3, 2013
    Posts:
    8
    I see, thanks for your reply. If i understand correctly, on Unity 5.3+ this process can be done client-side(only contacting the corresponding store API for the verificaton, e.g. with a simple web request)? Also, does your plugin store the receipts when they occur in some form of local storage, and then retrieves them from there to verify them?
     
  13. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    I am having issues trying to get started with simpleiap.
    The main issue comes down to this message: "Couldn't get funds, currency: '636f696e73' not found."

    I just can't seem to get past it. I have downloaded a number of times.
    I have restarted Uity a number of times.
    After I have imported I run a demo scene and I don't get the message, but all the data in the IAP Settings windows just looks corrupt. That number is shown as the currency.
    So, I delete all of the entries, including the currency. Add a new currency and the errors start.
    I delete playerpref from the registry. Does not help.
    I have tried just renaming the currency, but that does not work.
    I have tried deleting the 636f696e73 currency and running. I get a message that there is no currency as expected.
    I add a currency with no name. I get a message saying that the currency has no name as expected.
    I add a name.. Eg. coins... Bam... I get the same error message... "Couldn't get funds, currency: '636f696e73' not found."
    I had deleted playerprefs after each step in the test.

    I added a IAP plugin.. Unity IAP. I tried again. Delete player prefs and run. Same message.. "Couldn't get funds, currency: '636f696e73' not found." because the currency in the example is now coins.

    This same thing happens on a blank install project.
    I am in Unity 5.4.0f3

    What can I try now?
     
  14. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    @Orfen client-side receipt verification is a feature by Unity IAP which checks for valid purchases locally on the device, but not valid live subscriptions. Simple IAP System stores receipts in an encrypted file on the device for a later verification, if you tell it to do so (that's a dropdown in the inspector).

    @Baraff clearly there's something wrong with the serialization on import. You said that you've "downloaded a number of times", did you delete the unitypackage on your local harddrive and redownloaded from the Asset Store? The download button on the Asset Store is only visible after you've deleted the package locally, that's why I'm asking.
     
  15. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    @Baroni I didn't delete the package before, but I did it again just now.
    Deleted the local package.
    Deleted package from the project.
    Closed unity and opened again.
    Downloaded SIS again and imported
    Ran a scene. I see this.

    upload_2016-8-26_20-42-41.png
     
  16. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    Additionally, if I do the above from a clean project, the names seem to come in ok. ie not garbled like in my own project, but if I delete coins, I get the error message like above, but now saying can't find coins. I had deleted prefs again too.
    If I even try to just rename coins to something else I get the error message. Deleting player prefs before each run to be sure.
     
  17. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Thanks for the additional information @Baraff. Could you please try to set your asset serialization mode to something other than 'Mixed', e.g. 'Force Binary' or vice-versa (Editor > Project Settings > Editor). Delete the SIS folder before doing that and reimport it afterwards.

    That's expected. The scenes have an UpdateFunds script in the scene looking for the coins balance. So if you delete that, it can't find it anymore thus the error. If you want to use another currency name you would have to enter the new currency name in the UpdateFunds script inspector. Or remove the script from the scene, if you don't want to use any currency at all.
     

    Attached Files:

  18. Baraff

    Baraff

    Joined:
    Aug 16, 2014
    Posts:
    255
    Thanks for that. I normally have it set to Force Text, so I just changed it to mixed and it imported ok. I was also able to change it back to force text after the import.
    OK.. Got it with the currency. I think I had just worked my head into a hole chasing the garbled import.

    Thanks for the assistance.
     
    Baroni likes this.
  19. TrickShinobi

    TrickShinobi

    Joined:
    Aug 31, 2016
    Posts:
    17
    How do I get the currency to appear in real money items? Like "0,99 €". It only appears as "0,99" without the currency, which is confusing, since I've got virtual money as well. Thanks!
     
  20. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hi @TrickShinobi,

    the Euro symbol is correctly showing in my tests after the price value when using Unity IAP. Do you use a different billing plugin? Did you modify the font and does it contain the € symbol?
     
  21. TrickShinobi

    TrickShinobi

    Joined:
    Aug 31, 2016
    Posts:
    17
    Hi Baroni,
    I switched the font. But just tested the old Font, still no € sign appearing. I am using Unity IAP. I remember that it used to show the € sign, but after a while it disappeared. I am not sure why. Is there an option to turn it off? What should I look for? I modified the Item Prefabs, but I can't seem to find anything related the issue. I am also using the option "fetch" in the settings, if that has anything to do with it.
    Thanks!
     
    Last edited: Sep 2, 2016
  22. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    No, there is no option to do that. If you are using the 'fetch' option, Unity IAP pulls localized prices from the app stores including the currency symbol. It is definitely included, as you mentioned or can be seen in our video.

    Maybe your price UI text is too short to display the full currency including its currency symbol? It's hard to guess. You could also debug the price string value on the device and read it in the log, to check if it is actually retrieved and just an issue of displaying it on your buy button.
     
  23. TrickShinobi

    TrickShinobi

    Joined:
    Aug 31, 2016
    Posts:
    17
    Alright thanks for the tips. I will be experimenting and letting you know afterwards.
    Another question though: I am modifying the class IAPItem, but I can't seem to find an attribute, which says if the item is virtual or real. Any hints? (I am trying to make a coin image appear behind the price of only virtual currency items)
     
  24. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    @TrickShinobi there is no attribute on the IAPItem indeed, because they are universal for both types. The IAPManager knows whether a product is virtual though, so you can check that via IAPManager.GetIAPObject(productId).isVirtual.
     
  25. TrickShinobi

    TrickShinobi

    Joined:
    Aug 31, 2016
    Posts:
    17
    I think I know what's wrong now. It is not fetching the data correctly any more. It is just displaying whatever I typed in the IAP settings. It used to work though. I have no idea what went wrong all of a sudden. Do you have a suggestion where to look at? I set up the Google Store Key and double checked it. Should be working, because it already has once. Also when I click on it, it still works and shows the Google purchase popup with the correct price.
     
  26. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    @TrickShinobi from the outside, it is impossible for me to know what's wrong with your Google Play settings or even if that's the reason. Especially if you modified prefabs or code already. Please have a look at our summary of things that might go wrong in the process of testing in-app purchases on Google Play in the guide. Also, debug the device to see if there are any error messages preventing a successful initialization.
     
  27. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    @wheretheidivides Would you please remove that second screenshot, you are not allowed to share our source code in any form - as the additional note of the script says at the top. Going to investigate the error shortly.
     
  28. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    I had a look at it, the Security namespace and the full content of the ReceiptValidatorClient script should actually be enclosed in the official verification #ifdef directive, like so:

    Code (csharp):
    1. #if RECEIPT_VALIDATION
    2. using UnityEngine.Purchasing.Security;
    3. #endif
    Will be added to the next update. Thanks for the report @wheretheidivides!
     
  29. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Simple IAP System does not use 'Type' anywhere as it is a C# system object. Did you create a class and named it 'Type'?
     
  30. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    It is coming from the MiniJson script because you could have a class in your project with the same name (Type), which is not in a separate namespace, so the script gets confused and throws that error. I can't reproduce this in a new project so this is definitely something on your end. You could easily search for this name in all of your scripts. Visual Studio provides the "search in solution" selection for example.

    Noted but nothing to be concerned about just yet. Unity changed this callback starting with Unity 5.4.
     
  31. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Correct.
    I am looking into how to explicitly specify that the MiniJson script in SIS should use System.Object.Type instead of the Type class in one of your plugins. This is like a black box for me, because I am fixing something I cannot reproduce. Note that once that is fixed on my end (should be live later today), if you are ever using another asset that uses System.Object.Type too, you will get that error again. So the only real fix is to find that class and let the developer know to rename it or put it in its own namespace to not clash with the default C# classes.
     
  32. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Version 3.2.1
    - All packages: added clear database editor helper under Window > SIS
    - All packages: added Unity 5.4+ overload for OnLevelWasLoaded
    - All packages: added Camera to scenes to avoid "no rendering" message
    - Unity IAP: added validation #ifdef to avoid compile errors on WinStore
    - Unity IAP: fixed MiniJson conflicts on WinStore System.Object.Type
    - Unity IAP: removed inventoryRequestFailedEvent because it is not used
    - All packages: moved all scripts to the SIS namespace

    @wheretheidivides Please try this version, I was able to reproduce the compiler error when deploying to Windows Store and did some minor changes to the MiniJson. Also the receipt validation and OnLevelWasLoaded stuff is in here.
     
    Fronne likes this.
  33. Fronne

    Fronne

    Joined:
    Sep 25, 2014
    Posts:
    112
    Hi Baroni,

    I like to Upgrade to 3.2.1 (currently 3.1.1) but added or changed a few lines of code here and there...
    IAPManager is in the first scene, I changed some code in IAPListener and DBManager, can I Upgrade without importing these files or not? I also changed som names code in SimpleJSON because of a conflict with another plugin...

    Is the SimpleJSON part of the SIS namespace too or not?
    What happens to the IAP Settings DB after upgrading, are the products lost or not?

    Thnx in advance!
    Franco Palmieri - Fronne
     
  34. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hey @Fronne,

    please have a look at entry #13 in our FAQ. If you've changed files you probably want to compare them via version control.

    It is.

    The FAQ entry explains how a general upgrade without losing your products works.
     
    Fronne likes this.
  35. Fronne

    Fronne

    Joined:
    Sep 25, 2014
    Posts:
    112
    Hi Baroni,

    I tried to Upgrade to 3.2.1 (with IAPManager prefab and the IAPListener script unchecked) but the prices of the Virtual Groups wont show up, however all IAP Groups are fine... Any idea what goes wrong or where to look?
    I use different prefabs for IAP and Virtual but basicly these are the same except for the colors...

    Unity 5.4.1p4
    SIS 3.1.1
    Win10

    Cheers!,
    Franco
     
  36. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hi @Fronne,

    nothing has changed in regards to price variables between 3.1 and 3.2. Do you mean virtual products (not virtual groups) are missing all prices? They are stored in the IAPManager prefab too, so as long as you are not switching billing plugins nothing should actually go missing on minor version upgrades (after importing both the new SIS and the compatible SIS billing package afterwards).
     
    Last edited: Oct 8, 2016
    Fronne likes this.
  37. Fronne

    Fronne

    Joined:
    Sep 25, 2014
    Posts:
    112
    Hi Baroni,
    Thanks for the fast reply!

    Yes, I mean all prices from the virtual products are missing but I didn't re-install "the compatible SIS billing package afterwards", perhaps this is the problem. I'll try again tomorrow or in the beginning of next week and let you know...

    Cheers,
    Franco
     
  38. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hi all,

    is someone still using Prime31 billing in Simple IAP System? If so, why - considering Prime31 billing plugins can't do anything else and Unity IAP has the same functionality for free? Prime31 plugins have been a great start when Unity IAP didn't exist, but I'm thinking about removing support for it in a major update.

    Also, please vote which billing plugin you are using in the poll at the top of this thread. Thanks!
     
  39. TrickShinobi

    TrickShinobi

    Joined:
    Aug 31, 2016
    Posts:
    17
    I'm having trouble with the apple submission process. It tells me ipv6 is not supported. Could this be a problem of SIS? I am trying to figure out what causes it.
     
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
  41. TrickShinobi

    TrickShinobi

    Joined:
    Aug 31, 2016
    Posts:
    17
    Hi Baroni,
    I am using Unity IAP and Stans Asstes (but only the share function, not the IAP feature. Not sure if it somehow interferes still). I have seen that Unity IAP is supposed to ipv6 ready, so I'm kinda lost right now. I have created a ipv6 network, connected my phone with it and the inapp purchases won't work any more.
     
  42. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    @TrickShinobi There is nothing I could do about that - as I said, Simple IAP System only calls methods provided by billing plugin developers. If billing does work fine except on an IPv6 network, then that's eventually something that needs to be handled natively. I am not aware of any other issues on IPv6 networks with Unity IAP, but as you can see in the thread I've posted, there actually are other people having the same problem with it.
     
  43. alexsan75

    alexsan75

    Joined:
    Feb 6, 2012
    Posts:
    95
    Hi there,
    I updated Simple IAP to the latest version, but have some questions (didn't upgrade up until now):
    -as I understood correctly NGUI is no longer supported? so.. now I have to rebuild my whole in-game-shop with new UI system?
    -how do I modify new prefab(s) in editor (graphics, text, etc)? when I drag one to the scene - nothing shows ..
     
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hi @alexsan75,

    Yes. NGUI support has been dropped 2 years ago.

    Please see the official Unity UI tutorials for an introduction to all components. You have to drag & drop UI elements under a Canvas gameobject which renders them.
     
  45. alexsan75

    alexsan75

    Joined:
    Feb 6, 2012
    Posts:
    95
    Well.. I see now, thanks for help!
     
  46. Nikolasio

    Nikolasio

    Joined:
    Dec 6, 2014
    Posts:
    59
    Hi @Baroni,

    There are different shop menu templates available in SIS. Is it possible to change them? For example, I would like to display the main character in the shop and when items are selected, showing that immediately on the character.

    Cheers
    Nikola
     
  47. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hi @Nikolasio,

    sure - the templates are provided for you to customize them so they fit into your game. They are built with the standard Unity UI which should be familiar to you. Additionally, you have access to full source code of SIS, where only your imagination (or coding skills ;) ) could be the limit.

    P.S.: Our database manager offers methods for getting the currently selected products, namely IsSelected or GetAllSelected.
     
    Last edited: Nov 15, 2016
  48. Nikolasio

    Nikolasio

    Joined:
    Dec 6, 2014
    Posts:
    59
    great, thanks for your reply!
     
  49. christougher

    christougher

    Joined:
    Mar 6, 2015
    Posts:
    558
    Hi, I'm having a little trouble with this system. For some reason I can no longer get IAPItems to populate the in game currency price. It still works with real world currency but all my In game Currency items just show up as blank. I do have the "Price" text assigned in the inspector. I have only one in-game currency Merits but none of the IgcItems populate the price. The text components are just made blank at run time. Any Idea what could cause the price not to show up? It used to work just fine. If I re-import the IapManager prefab it goes back to working fine, but when I revert to my own IapManager as the prefab it simply won't populate the prices.

    *edit* never mind, I figured this part out, I believe when I recently updated of the plugin I had not noticed I needed them changed to "non consumable virtual" in the IAP settings window. I hope this helps someone else. *edit*

    Also I can't seem to find an easy way to get the price of an item manually. Could you point out a simple way of getting an individual IgcItem's virtual currency cost? I only have one type of in game currency. Thx.

    Also I have several real currency purchases that should unlock all of the IgcItems in certain categories. My programming skills are poor. Could you help me to unlock all of the IgcItems within certain groups?

    And... a suggestion to improve workflow...

    When adding items to an IAP category it would be nice if there was a button to clone another entry. That way you could easily add similar IAPs with similar settings.
     
    Fronne likes this.
  50. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,264
    Hi @christougher,

    If you did a major version upgrade, it could be that there were upgrade-breaking changes that you had to adjust. Usually these changes are indicated in the changelog, e.g. the IGCs list has been merged into the IAPs list some time ago.

    IAPManager.GetIAPObject("your product id").virtualPrice[0].amount

    In the IAPListener script, when a purchase for a certain real currency product happens:

    Code (csharp):
    1. string groupName = "your group name to search for";
    2. IAPGroup groupResult = null;
    3. foreach(IAPGroup group in IAPManager.GetInstance().IAPs)
    4. {
    5.    if(group.name == groupName)
    6.    {
    7.         groupResult = group;
    8.         break;
    9.    }  
    10. }
    11.  
    12. for(int i = 0; i < groupResult.items.Count; i++)
    13. {
    14.     DBManager.SetToPurchased(groupResult.items[i].id);
    15. }
    Thanks for the feedback, I'll see whether a duplicate button somehow fits into the editor structure!
     
    christougher likes this.