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

    65 vote(s)
    83.3%
  2. Voxel Busters

    4 vote(s)
    5.1%
  3. Stans Assets

    9 vote(s)
    11.5%
  4. Prime31

    0 vote(s)
    0.0%
  1. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    Hi Arashikage,

    thanks for buying SIS. If you are testing with an active internet connection, then the "Billing Unavailable" error means that there are issues/missing steps on billing initialization. I've mentioned three common gotchas in this thread on our forums: link. (Check your Google developer key)
    If this doesn't solve it, please post the device log and error message here.
     
  2. Arashikage

    Arashikage

    Joined:
    Dec 8, 2013
    Posts:
    14
    I removed and re-imported everything and followed your YouTube tutorial again and I'm still getting that same message:
    3, Cannot start purchase process. Billing unavailable. (response: 3: Billing Unavailable)
    I tried using the Soomla store plugin and I get a similar message:
    Error purchasing item IAB helper is not set up. Can't perform operation: launchPurchaseFlow (maybe that will help narrow down the problem?)

    I uploaded my apk to the dev console as an alpha. Does that makes a difference?

    I'm still pretty new to programming, how do I retrieve and post the device log? (OSX)
     
  3. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    Not really, if it couldn't find your app on Google Play the error message would be like "cannot find products". That's not related to the billing unavailable error and I don't know how Soomla handles that.

    For iOS, you can find the debug log in xCode. On Android, you have to use ADB and write "adb logcat" in your terminal: How to set up ADB Android debug bridge in Mac OSX

    You can also send a repro project to info [at] rebound-games.com so I can figure out what's wrong.
     
  4. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    Discussion for supported billing plugins

    Hi all,

    just trying to gather some info here. Would you like to see support for Android Native and iOS Native in Simple IAP System? Support for various billing plugins is not that easy to maintain, so please tell me if you would actually use this combination over the free one (OpenIAB).

    And on the same matter, is anyone still using our NeatPlug billing integration (or could I drop it in favor of Android/iOS Native)?
     
  5. InfinityCoder88

    InfinityCoder88

    Joined:
    Oct 4, 2013
    Posts:
    237
    Hi Baroni, I want to develope an Upgrade system via SIS my question is about price increase for every purchase...so if the player buys one point of upgrade the next level of upgrade to be more expensive...and so one , can this be done ?
    upgrade_system.jpg
    P.S Will be much appreciated SIS to be integrated with ANP and INP ;)
    P.S2 Another question :p a solution for displaying current numbers of items buyed ?!
    Cheers,
     
    Last edited: Oct 6, 2014
  6. Arashikage

    Arashikage

    Joined:
    Dec 8, 2013
    Posts:
    14
    I've attached the log. I don't know how much of that info you need so I just pasted everything, but I opened the game about halfway down that log (if not further), so the first half might be irrelevant.
     

    Attached Files:

  7. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    You have multiple ways to accomplish this: if you want them to be virtual purchases for currency, you could create one item for each type (health, energy, shield) and modify their prices at runtime, based on the current level. See the virtualPrice variable of an IAPObject (IAPManager.GetIAPObject() ). Another way would be to create separate items with different prices, and your buy button always points to the next item. In case you want them to be purchases for real money, each upgrade must be a separate product on the App Store.
    You could use the database implementation for that and store your own data (documentation page 17).

    Umm... the file is empty for me (608 bytes)?
     
    InfinityCoder88 likes this.
  8. Arashikage

    Arashikage

    Joined:
    Dec 8, 2013
    Posts:
    14
    Weird. I'll try again:
     

    Attached Files:

  9. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    Thanks for the log.

    Code (csharp):
    1. D/Finsky  (20514): InAppBillingUtils.getPreferredAccount: com.TheBoneLab.***: Account from first account - ***ivwqc42v***HjP5KDHtYt***\
    2. W/Finsky  (20514): InAppBillingService.checkBillingEnabled: Billing unavailable for this package and user.\
    The important part is: "Billing unavailable for this package and user.". I haven't come across this message before, but I've found two issues on code.google.com related to that: link and link. Are you testing with multiple accounts, one of them being a Google Apps account (difference), or trying to purchase with the secondary account by any chance?

    Also, did you include the billing permission in your manifest file (or use the one that comes with OpenIAB) and what's the device your running it on?
     
  10. KeeLo

    KeeLo

    Joined:
    Nov 1, 2013
    Posts:
    76
    Hello! i purchased your SIS and already accept my purchase, i have a question, i am doing non consumable IAP and use the armory example, when i purchased the uzi for example, and pistol, i can select between a weapons. But how can i do if i select uzi i get uzi in real game? where i need correct code for this function? how can i attach for chosen select button exact choice?
    for example if i selected an uzi i would got the uzi, then if i wanted a pistol i would got the pistol.....
     
  11. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    Hi KeeLo,

    the IAPListener script has all the callbacks you need to implement your item logic:
    - HandleSuccessfulPurchase (unlocks the item)
    - HandleSelectedItem (called when a purchased shop item gets selected)
    In your case, you could give the player the pistol when HandleSelectedItem receives "pistol" as id.
     
  12. fmarkus

    fmarkus

    Joined:
    May 22, 2010
    Posts:
    179
    Hello Baroni,
    Just wondering if you had any update on the possibility to read a csv file?
    Cheers!
     
  13. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    @fmarkus
    Hey there, you're still the only person requesting CSV import, but could you prepare and send me a CSV file so I know what kind of data/layout you are using? I may be able to work something out in the coming weeks.
     
  14. KeeLo

    KeeLo

    Joined:
    Nov 1, 2013
    Posts:
    76
    Hi thank you for answer!
    i have one more question! how can do? if i want 1 purchase do free and on first time this item must be already selected?
     
  15. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    @KeeLo
    You could check for all selections and if there are none, set your item to selected at game start. Check the documentation for more info about the DBManager.

    Code (csharp):
    1. void Start()
    2. {
    3.    if(DBManager.GetAllSelected.Count == 0)
    4.       DBManager.SetToSelected("your item id here", false);
    5. }
     
  16. KeeLo

    KeeLo

    Joined:
    Nov 1, 2013
    Posts:
    76
    Thank you very much! i've done but you've made mistake if(DBManager.GetAllSelected().Count==0)....
     
  17. fmarkus

    fmarkus

    Joined:
    May 22, 2010
    Posts:
    179
    Hi Baroni. I will send you an example as soon as possible. Even your current format is fine, but contained in a comma separated sheet.
    I don't know how others do it, if they have to tune many many items relative to each others and when there is an update from you... I don't know any professional that don't adjust their in game economy through spreadsheets :)
    Thanks for your help!
     
  18. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    Version 2.3.1

    This version introduces support for the widely used Android Native and iOS Native plugins by Stan's Assets. These plugins contain a full range of native functionality (more than just in-app purchase billing) and are an exceptional offer at such a good price. They are currently supported in the uGUI version of SIS; NGUI version will follow.

    v2.3.1
    - iOS & Android Native billing plugins by Stans Assets are now supported!
    - itemSelectedEvent now only fires on first and changed selections
    - DBManager.SetToSelected returns true for new selections (false otherwise)
     
  19. Arashikage

    Arashikage

    Joined:
    Dec 8, 2013
    Posts:
    14
    Hey Baroni,
    Thanks for the links, and sorry for the slow reply, I was out of the country and didn't have internet access.
    My test device had multiple accounts logged in, but only one of them was registered as a test account so I didn't think anything of it. When you mentioned testing with multiple accounts, it got me thinking about that fact so I removed the other accounts and now purchases work perfectly! Thanks for all your help, I really appreciate it.

    One more thing: Your included scenes have a lot more going on than I need and they're visually incongruous with the rest of my game. If I want to make my own simple purchase scene with only two buttons (purchase and restore), what is the minimum I need to include? Your scenes have the ShopManager script, which I will include, but I'm having trouble wading through all the canvases and UI elements to find out what else I need. I just want one button to make a purchase and one button to restore it, no animations or anything like that, and just simple OnGUI script to handle the buttons.
     
  20. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    @Arashikage
    You could create one (or two) IAPItem prefabs and assign them to containers in the IAPSettings editor, positioned where you want them to be. That's actually all it needs and you don't have to use scroll views or the other stuff. I strongly recommend against using OnGUI though.
     
  21. ThotwiseGral

    ThotwiseGral

    Joined:
    Sep 22, 2014
    Posts:
    1
    Hi!

    I just bought SIS but I couldnt even import it. During every import, Unity just crash.

    I tried with even a new empty project, and the result is always the same... I need help! =)
     
  22. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    @ThotwiseGral
    Hi there, you need to import it in Unity 4.6 (stable beta 20). It is written right below the download button.
     
  23. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    Version 2.3.3
    - ShopManager OnDestroy reverts to previous Input.multiTouchEnabled state
    - StansAssets: package updated for Android Native 4.8, iOS Native 5.3
    - Unibill: package updated for 1.7.5, onPurchaseDeferred event

    NGUI users:
    The NGUI-compatible version on our web store has been updated to be in sync with 2.3.3. If you want to upgrade, please re-download using the same link you've received in your purchase email. Minimum required Unity version is 4.5.4.
     
  24. Arashikage

    Arashikage

    Joined:
    Dec 8, 2013
    Posts:
    14
    I used one of your scenes and just changed icons, removed buttons I didn't need, and changed colours. The buttons of the purchasable items don't appear in the hierarchy until I've clicked on the button for their category in play mode, so how do I change fonts and colours for those buttons (ie. the second "page" of the storefront)?

    Also, let's say I have two non-consumables ( a normal and a deluxe), how does the restore button know which one to restore? As it is now, I have a case in the switch statement for the single iap I have right now, and I just copied that and pasted into the restore section of the switch statement. I don't know if that's the right way of doing it, but works fine with one iap. If I have more than one, how would I go about restoring the correct one?
     
  25. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    Hello,
    I just purchased SIS. I am on 4.6.0 (20 Stable), using IOSNative 5.3 (Stan's Assets). I imported Stan's Asset package from SIS, and got errors in IAPManager.cs lines 220 and 285, which refer to Android and Google store, can I just close them? since I am not using Android in anyway.


    Screen Shot 2014-10-22 at 3.59.44 AM.png

    Thank you. I'll be back with more questions :)
     
    Last edited: Oct 22, 2014
  26. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    Hmm I'm not sure what you exactly are asking here? Have you tried modifying the IAPItem prefabs located in SIS > Prefabs > scene folder?

    The billing plugin knows. It receives a list of previously purchases products for that user/device and just invokes their purchase again. Do not do custom stuff in the restore section! It is all handled automatically for you.
     
  27. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    @8bitCartridge
    Hi & thanks for noticing these errors! Yes, you can remove the Android part at line 220 and comment out what's throwing the error in the RequestProductData method. I will also upload a fixed package within the next hour, if you would like to wait just a few more minutes.
     
  28. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    Yeah, I already fixed those... couldn't just close it had to change Android----.HasInited to IOSInAppPurchase.initiate on line 220, and closed 283 - 295 i think, not sure if it supports IOS Native 5.3 completely (that was the only reason why I bought SIS, because I run everything else through IOSNative). Please take your time with the fixed package. Also a quick Tutorial would be really helpful, like the ones you have for all of the other packages on your youtube channel.

    One more thing - I use NGUI for all of the GUI in my game... on your site it says contact us for a NGUI version? I have to send you an email? I bought mine through Unity's Asset store, not through your web site's store.

    Thank you.
     
  29. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    SIS does support the in-app billing part of IOS Native completely, I just haven't tried it with only one package (Android or iOS) in one project before.
    There's nothing different from the OpenIAB tutorial (see the iOS part in Unibill) in regards to setting it up, but maybe I should record an updated one for them. Do you have any specific topics that are unclear after watching these videos?

    Yes, please send me an email with your invoice no. from the Asset Store. After that you will receive a download link from our web store.
     
  30. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    @Baroni

    Thank you for your replies and support! I have sent you an email with my invoice no. from the Asset Store, waiting for that like for the NGUI SIS version, by the way NGUI version also supports IOSNative, right?

    The video tutorial for Unibill and OpenIAB are pretty self explanatory, only had one question at this point, which Script can I / should I edit in order for the BOUGHT items to take effect in my game?

    Thank you again! Great Support!
     
  31. mechangel

    mechangel

    Joined:
    Nov 6, 2012
    Posts:
    73
    Hello there! I am in the process of testing SIS purchases with OpenIAB in Unity4.6.
    I am having some difficulty getting the same results on an Android Device as in the Unity Editor, the Default Virtual Currency set to 2000 in IAP Settings and appears in Editor, but the currency stays at zero on device. What could be changing that variable on me during the deployment process?

    Edit: I figured out what was happening, I didn't have the "All Selection" scene first in the build settings, changed that and it works perfectly now!
     
    Last edited: Oct 22, 2014
  32. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    @Baroni

    Two more question for now (before I receive a link for the NGUI Version :) ).
    1) Is the process the same for IOSNative as for Unibill and OpenIAB, first I import SIS package and only THEN I import IOSNative? As in your tutorials first you imported SIS followed by importing OpenIAB or Unibill.

    2) IOSNative has its own product list in its IOSNative Settings, I don't have to add anything to IOSNative, am I correct?

    Thank you again!
    (rated 5 out of 5 already!)
     
  33. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    @8bitCartridge
    Thanks for the feedback and rating! You should have received the NGUI version by now. The latest NGUI-compatible version is equal to the current uGUI 2.3.4 (including IOSNative support).

    Code for changing player variables goes into the IAPListener script (such as adding funds), while game variables (giving the player a new weapon) should be done in the game code itself, by checking the DBManager for purchased/available or selected items. I should probably do another video for that, thanks for the hint!

    Yes, but it shouldn't matter that much.
    No, all product settings should be done in the IAPSettings editor of SIS. The IAPManager will add these products to IOSNative at runtime.

    @mechangel
    Glad it's working now, let me know if you have any other questions ;)
     
  34. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    @Baroni

    Thank you so much! Just got the link, gonna go start working now. I'll let you know if I run into any problems, but hopefully I won't.
     
  35. Arashikage

    Arashikage

    Joined:
    Dec 8, 2013
    Posts:
    14
    Oh okay, I found it. Thanks.


    The problem I've run into is that clicking restore, although it does restore the purchase and a window pops up saying it was successful, it doesn't actually do anything in-game. I have one iap that unlocks extra play modes, and I'm just using PlayerPrefs to control that. So purchasing that non-consumable activates a case in the switch statement that changes an entry in PlayerPrefs to allow the user to access the extra modes. Clicking restore wouldn't do anything in-game until I added a line under the restore case to change that PlayerPrefs entry. Is that wrong? If so, how should I do it?
    As I mentioned earlier, I don't have much programming experience, but what I figured from reading your scripts is that clicking the restore button restores the purchase and then tells the script with the switch statement to trigger the restore case, which pops up a window saying it was successful, but other than that window it doesn't actually do anything to the game. So how do I make that restoration actually do what the original purchase did, if not to add the original purchase code to the restore case?
     
  36. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    @Baroni

    I get an Error "Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)" every time I go back to the scene where Shop Manager prefab is, it is creating new GameObject "IOSInAppPurchaseManager" every time and doesn't destroy it. (it's a new GameObject and not a Clone)

    Should I change something in ShopManager or in IOSInAppPurchaseManager?

    if (FindObjectsOfType(GetType()).Length > 1)
    {
    Destroy(gameObject);
    }

    should this be sufficient enough if I add it to IOSInAppPurchaseManager?

    Thank you.
     
    Last edited: Oct 23, 2014
  37. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    You shouldn't use additional PlayerPrefs at all and again, the restore functionality shouldn't be modified. When you buy a product, SIS already saves the purchase in its database (this is done automatically). If you want to check if a user bought the item, you can simply call DBManager.isPurchased("your item id"). I suggest replacing your PlayerPrefs code with that method. If your user clicks the restore button, the product is re-set to purchased in the DBManager. Hope that helps!

    I couldn't reproduce this error in the provided example scenes, are you sure that you have placed the IAPManager prefab only in the first scene and actually start your game from there?

    Edit: I was able to reproduce it sometimes, not every time, looks like an issue with IOSNative because SIS does not create gameobjects in OnDestroy() at all... If I can create a simple repro I'll send it to the developer for investigation.

    Edit2: Oh well, calling IOSInAppPurchaseManager.instance creates a new instance, even in OnDestroy(). I'll work around that on the next major update (I would like to avoid point releases if not absolutely necessary).
     
    Last edited: Oct 23, 2014
  38. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    yes I only placed it in the scene "0" from which my game starts. It actually happens in all of the SIS Demo Scenes, just click PLAY, stop it and PLAY again ... take a look at the photo:

    Screen Shot 2014-10-22 at 7.59.55 PM.png
     
  39. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    so if I have more than 1 of InAppPurchaseManager(S), that won't effect anything? I mean anything major?
     
  40. Arashikage

    Arashikage

    Joined:
    Dec 8, 2013
    Posts:
    14
    Everything works perfectly now! Thanks again for all your help Baroni, I really appreciate it. I left you a 5 star rating and review in the asset store.
     
  41. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    @8bitCartridge
    Sorry for the late reply, I sat back for a minute and found a fix for the OnDestroy error (deployed & tested successfully on 2 devices). Just comment out the whole OnDestroy() method in IAPManager.cs and things will work as expected. Also I'm sorry for the recent inconvenience (caused by errors) and would like to thank you very much for reporting them! Conversations like these really help to improve SIS further.

    @Arashikage
    You're welcome and thank you very much for the review :)
     
  42. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    @Baroni
    Thank you so much! Gonna try it out in a few minutes. And believe me that reply was not "late" at all, this is the best support that I've had.... ever :)

    Thanks a lot! Will write a review as well later on today.
     
  43. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    @Baroni

    Hello, me again. So far everything works like a charm, just got one question: lets say my player picks up coins during gameplay, (when he collides with them he gets 5 coins) I'm trying to call DBManager.IncreaseFunds("coins", 5); (I added using SIS; to that scrips) but it doesn't show that it is increasing at current moment as he picked it up. When I change scenes I do see that funds were increased/added as it was supposed to be.
    I have ShopManager (prefab) and UI root (2D) in all of my 3 Scenes, because my player might need to buy something during the game (it just pops up whenever it needs to be seen otherwise it stays off the screen) and everything works fine, "Offset" with UpdateFunds script is always on the screen (the one that is displaying inGameCurrency).

    please help :)
     
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    Hey there,
    the UpdateFunds script is only subscribed to the IAPManager, thus it will only detect changes initiated through user purchases. If you would like to subscribe to DBManager changes too, you can put this in its Start() method:
    Code (csharp):
    1. DBManager.updatedDataEvent += UpdateValue;
    In OnDestroy():
    Code (csharp):
    1. DBManager.updatedDataEvent -= UpdateValue;
    and because UpdateValue normally expects a string value, add a quick overload to the script:
    Code (csharp):
    1. void UpdateValue() { UpdateValue(null); }
     
  45. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    @Baroni
    Thank you! Start() and OnDestroy() I added to my coins script... but overload
    1. void UpdateValue() { UpdateValue(null); } when I add that to my coins script, it gives me an error : "error CS1501: No overload for method `UpdateValue' takes `1' arguments"
    I already tried void UpdateValue (string s) same thing...


    EDITED: UpdateValue is in UpdateFunds.cs am I doing everything right?

    EDITED #2: never mind, of course I put that in the wrong script, put everything in the UpdateFunds.cs and everything WORKS! THANK YOU!
     
    Last edited: Oct 23, 2014
  46. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    Great! At first I was a little bit confused :)
     
  47. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    @Baroni
    Sorry to bother you again, I don't know what I did or maybe I'm just confused, but for some reason the message window stopped showing, for example when I buy bullets (from your demo scene), the window that used to pop up ShowMessage("Bullets were added to your inventory!"); is not showing anymore.
    Thank you in advance.
     
  48. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,269
    @8bitCartridge
    Here's a quick checklist to go through, maybe one or two points apply:
    - Do you have a ShopManager prefab in the scene?
    - Are the errorWindow and message label variables assigned?
    - Is the product id (e.g. "bullets") declared in the IAPListener switch-case?
     
  49. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    -yes
    -yes
    -yes
    triple checked all of them, same thing in any of the demo scenes (also re-checked everything there)... not sure what it is.. I didn't even change IAP Setting, so all of the product ids are as they were, just stopped popping up for some reason. should I maybe delete SIS and import it again?

    another quick question, can I set PlayerPrefs in IAPListener for example when I buy an item with in game currency ("coins"):
    Code (CSharp):
    1. case "continues":
    2.                 PlayerPrefs.SetInt ("CONTINUES", PlayerPrefs.GetInt ("CONTINUES") + 1);
    3.                 ShowMessage("You Got One Continue!");
    4.                 break;
    that way? because it is not increasing.
    Thank you, and sorry :)
     
  50. 8bitCartridge

    8bitCartridge

    Joined:
    Feb 26, 2014
    Posts:
    144
    @Baroni
    I'm a customer from hell :( i know, sorry man.