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

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    @TBrayner I haven't used the latest version of PlayMaker, but it could be that you need to put using HutongGames.PlayMaker; at the top of the script too.
     
    Jami_2 likes this.
  2. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    I tried this too, I'll ask for the playmaker devs maybe something changed since the last version. I think if we find a simple workflow to do some integration between SIS and Playmaker, it could be usefull for another users.
     
  3. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    @Baroni ,

    Is it possible to use SIS as a main menu?

    Let me explain, lets say on main screen there are 5 items (Horizontal Menu), one unlocked (with 10 sub items also unlocked) rest 4 is locked (non-consumable) when purchased all 4 will have 10 more sub items. When I tap on unlocked sub items those should take me to respective scenes or run custom commands.
     
  4. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    @PixelEnvision
    Sure, just place both the IAPManager and ShopManager in your main screen. The scene selection thing on IAPItems could be handled by a seperate script attached to the prefab. There you could do something like (pseudo):

    Code (csharp):
    1. IAPItem thisItem = GetComponent<IAPItem>();
    2. if(DBManager.isPurchased(thisItem.productId))
    3. {
    4.    //show additional button to tap on or take me directly to the scene
    5.    
    6.    switch(productId)
    7.    {
    8.        case "level1":
    9.            Application.LoadLevel(...);
    10.            break;
    11.        ....
    12. }
     
  5. tafer95

    tafer95

    Joined:
    Oct 23, 2014
    Posts:
    44

    Hello, in this video i explain to you my problem, i think that i have all things good but in the moment that i buy anything does not show the message and not does the things that i put in the cases... please see the video, i explain more in the notes of the video

    do you think that i need reinstall the plugin?
     
  6. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    @tafer95 Thanks for the video, everything looks ok to me. I'm not sure if the billing plugins work correctly on the BlueStacks simulator though. You could investigate the simulator log for suspicious error messages. If you don't find any errors, I would test it on a real device. You can also send me parts of your project for investigation, I'll replace your dev key etc. and test it with my phone.
     
  7. tafer95

    tafer95

    Joined:
    Oct 23, 2014
    Posts:
    44
    I tested in BlueStacks and 2 phones.. and is the same....
    I go to reinstall and later i say to you if i solved this..
     
  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Checking the device log via ADB logcat could help in that case, to see if everything is set up correctly.
     
  9. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    513
    Thank you, sounds good. I'll purchase and give this a try...
     
  10. iEpic

    iEpic

    Joined:
    Sep 29, 2013
    Posts:
    119
    Hey it's me again... Quick question.
    So I'm trying to test in app purchases on android..
    Is the only way to test them by publishing the game as a beta??
    I published a beta like 4-5 hours ago and it's still not showing in google play, and was just wondering.
     
  11. riadysalim

    riadysalim

    Joined:
    Sep 16, 2014
    Posts:
    7
    Hai, i have bought your plugin Simple IAP System and i have integrated in my game.
    So far so good but when i tried at the Unity Editor, i can click the Buy Button and it showed windows popup but when i build it in android, i can click the buy button but the windows popup would not show up.
    Please can you help me? i really need the iap to works.
    PS: I think my problem is similar to @tafer95
    Thank you
     

    Attached Files:

  12. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hey riadysalim, the solution for your problem : FIX !

    Regards,
     
    Baroni likes this.
  13. riadysalim

    riadysalim

    Joined:
    Sep 16, 2014
    Posts:
    7
    @D0R1N
    hey, thank you for your reply.
    well i have checked my purchase scene and IAP Manager was active when i play at unity editor.
    also the message popup was showing only in unity editor but when i build in android, it would not show up.
     

    Attached Files:

  14. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    @riadysalim
    Sorry the child object of IAP Manager --> IAP Listner must be active , like here:

    P.S very important the IAP Manager must be on the first scene of your game !
     
    Baroni likes this.
  15. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hey, yes. Testing in-app billing in draft apps is not supported.

    @riadysalim
    Please try the solution mentioned by @D0R1N (thanks for that!), especially the red part.
     
    RoyalCoder likes this.
  16. iEpic

    iEpic

    Joined:
    Sep 29, 2013
    Posts:
    119
    So when I build and run from unity and try the IAP I get this error...

    I setup the in-App products and tried publishing a beta, and I'm getting this error.
    Anyone know how to fix this???
     
  17. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Check the following points:
    - your AndroidManifest file includes the billing permission
    - the APK uploaded in Google Play is a recent one (with the billing permission)
    - the bundle identifier in Unity matches the one displayed for your app in Google Play
     
  18. iEpic

    iEpic

    Joined:
    Sep 29, 2013
    Posts:
    119
    Not sure what I did but now it's saying..
    "The publisher cannot purchase this item"
    Sorry for the noob questions, but I really do appreciate the help!
     
  19. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Well, that's basically a perfect description :) You have to sign in with a different account on your device (one of the tester accounts in Google Play), not with your publisher email address.

    More on that on the web: stackoverflow
     
  20. iEpic

    iEpic

    Joined:
    Sep 29, 2013
    Posts:
    119
    Had to delete my developer account on my phone.
    Everything works!!!
    Yay!
    You are the best!
     
    Baroni likes this.
  21. iEpic

    iEpic

    Joined:
    Sep 29, 2013
    Posts:
    119
    lol, it's me again. I know you are probably sick of me by now, but you have been a life saver and I am forever grateful.
    Everythings working fine on iOS and Android but not with Amazon.
    For some reason with amazon it is showing all IAP as $0.99.
    I set up the correct prices on amazon for each one but when I test it, they are all $0.99
    Any clue what could be the problem?
     
  22. zeantblaze

    zeantblaze

    Joined:
    Dec 2, 2014
    Posts:
    3
    @D0R1N
    Hi. i'm another programmer at the same studio as @riadysalim . i have to see if my IAPListener is turn off and it doesn't. Also i have placed the IAPManager in the first scene(splashscreen_1). Here some screenshot of it. The message still not pop up in the real device. But it work fine in the when i tested in PC.
     

    Attached Files:

  23. zeantblaze

    zeantblaze

    Joined:
    Dec 2, 2014
    Posts:
    3
    Oh, i forgot to mention it. the screenshot is from 1 run. so there's no other IAPManager in other scene except splash screen_1
     
  24. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    @iEpic no way :D you are using OpenIAB, right? Did you use the test environment with the App Tester + JSON file containing your IAPs, or live environment with a beta build (documentation? Also, simulator or real device?

    @zeantblaze @riadysalim
    Did you try running the example scenes of Simple IAP System in a new project to pin down if it's actually an issue related to SIS, or to your project? As other customers do not have this issue, I am guessing that some configuration in your project causes this to happen. If you are using multiple Android plugins, it could be that your AndroidManifest file is misconfigured etc. Please send me a stripped down project via email to replicate this, otherwise I'm just making wild guesses.
     
  25. riadysalim

    riadysalim

    Joined:
    Sep 16, 2014
    Posts:
    7
    @Baroni
    i had created a new empty project, imported newest SIS and OpenIAB, used example scene, built on android and the result was the same. i clicked the button and still no message showed up. the only message showed up only *Restore Purchase* button.
    in the first pic, the button is highlighted but no popup message.
    in the second pic, the popup message show up when i only click restore purchase.
     

    Attached Files:

  26. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    How do I get the funds I have stored in DBManager at the start of the app? I want to store the value of my currency (Coins) in a Public GlobalVariable "NewCoins", so I can get access to it by Get Property on Playmaker.
    After that, everytime a success purchase is made, I also store the values in this Global "NewCoins" from IAPListener.

    Is it possible?
     
  27. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    @riadysalim
    The in-app purchases in the example scenes are for my app in Google Play. Of course they won't work out of the box for your app... you need to create your IAPs in Google Play first and then enter them in the IAP Settings editor in Unity. Your Google dev key and bundle id in Unity must match with the data displayed in Google Play too. Video tutorial

    @TBrayner
    There are no PlayMaker actions in SIS for that, sorry. You can create a very short script for that and just set your global variable directly via code. Btw, did you figure out how to use FsmInt?
    Code (csharp):
    1. FsmInt coinsVar = FsmVariables.GlobalVariables.FindFsmInt("NewCoins");
    2. coinsVar.Value = DBManager.GetFunds("coins");
     
    RoyalCoder likes this.
  28. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    I'm still on struggle, a friend mine gave me some extra informations which I think can help me with this, only had not time to try everything.

    I'll try do this that you are sugesting me, I only dont know where specifically I put this lines.

    I think in the start of IAPListener and when the "case" coin_pack_001 be fired.
     
  29. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Yeah that should be fine.
     
    Xomanowar likes this.
  30. riadysalim

    riadysalim

    Joined:
    Sep 16, 2014
    Posts:
    7
    @Baroni
    looks like the problem is indeed the manifest because of multiple plugins and also the different item id of iap listener.
    my bad, it was my mistakes.
    well after merging your manifest with my project manifest, it already works.
    the popup message already show up.
    thank you for helping me and my friend.
    we owe you big time d^_^b.
     
    Baroni likes this.
  31. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    Is there any way to test SIS without need to make a Build and run on cell phone? To test directly on Unity console to see if the purchase events have been fired properly?

    Btw @Baroni I could have the value of DBManager, a weird "98" :) and read it on Playmaker.
     
  32. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Just going to leave that here ;)
     
    Xomanowar likes this.
  33. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40
    Hi, so, now I created a store, without any playmaker interation, only with the defautt template.
    I only put my product ("coin_pack_001") in IAPSettings, and I also put it on the IAPListener Script as the video teaches to do.

    So, the store detected a consumable item I purchased before, and show it blocked as is expected. Also shows I have 4000 coins (from the tests I made before).

    When I try to buy my ("coins_pack_001"), the Google API seems to be working properly, because allows me to buy the item. But seems that in this particular item, IAP Listener is not firing the case event. Because any coins is added to my wallet, and any message is showed on the screen.

    Fetch also is not working (weird because before it was working).

    The InGame Purchases seems to be working correctly, decrease coins etc..

    So, InGamePurchase sounds working well.
    BDManager seems to be saving correctly data.

    IAPListener Found the consumable item and locked it correctly.

    The problem seems to be specifically with my "coin_pack_001", which the events seems haven't been started.


    My setup:

    Stan's Android Native Plugin



    IAP Settings



    IAPListener Script



    IAPListener (Inspector)




    INGame Purchase (Default)


    IAPManager at the first Scene




    My Product in the Google Developer Console:




    GameStore

     
    Last edited: Feb 7, 2015
  34. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    @TBrayner thanks for all the detailed screenshots! First please remove the Base64 Key and products in Stan's AndroidNativeSettings, these fields are not necessary as they are being overwritten by Simple IAP System.

    To pin-point this further, please check "Debug" on the IAPManager prefab and have a look at the device log (adb logcat) to see any potential errors showing up on directly on the device.

    Thanks for the review too!
     
    Xomanowar likes this.
  35. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40

    Ah ok, I didn't know that (stans setup), thks , . sorry about this ton of questions.

    I'm almost there.
     
  36. Xomanowar

    Xomanowar

    Joined:
    Apr 2, 2014
    Posts:
    40

    Now Worked !!! Thks a lot!
     
    Baroni likes this.
  37. PlayKiseki

    PlayKiseki

    Joined:
    Oct 4, 2014
    Posts:
    14
    Hi Baroni! I've been using your plugin in my project and have an error. The SIS is working 100% flawlessly (I've even tested on-device and it's perfect) except for one thing. I have three IGCs- feather_1, feather_2, and feather_3 which all upgrade a property named feather. I've set these using the "Next Upgrade" feature of SIS (so it changes from feather1 > 2 > 3 on purchase) but am getting the error:

    "ArgumentException: An element with the same key already exists in the dictionary.
    System.Collections.Generic.Dictionary`2[System.String,SIS.IAPItem].Add (System.String key, SIS.IAPItem value) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404)
    SIS.ShopManager.InitShop () (at Assets/SIS/Scripts/ShopManager.cs:144)
    SIS.ShopManager.Init () (at Assets/SIS/Scripts/ShopManager.cs:70)
    SIS.IAPManager.OnLevelWasLoaded (Int32 level) (at Assets/SIS/Scripts/IAPManager.cs:220)
    SIS.IAPManager.Awake () (at Assets/SIS/Scripts/IAPManager.cs:203)"

    I have tried everything- Clearing the database, renaming the IGCs, changing prefabs, changing the IDs, descriptions, images, removing SIS & OpenIAB completely, even starting a new project. The weird thing is that the default speed_1, speed_2, speed_3 that come with SIS work fine and don't throw an error, but as soon as I use my own, I get the error. Any ideas?

    The storefront in my project is in the same scene as IAP Manager & Shop Manager.
     
  38. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hey Kiseki,
    please try leaving the prefab & parent references for your upgradeable items empty in the IAP Settings editor. Basically just have an "Upgrade" group with your upgrade products (feather_1, feather_2, feather_3), but don't set a prefab or parent for them.
     
  39. PlayKiseki

    PlayKiseki

    Joined:
    Oct 4, 2014
    Posts:
    14
    Hi Baroni,

    Thanks for your suggestion! It almost worked, but in the end I had to put each item in a separate group. So, feather_1 has a parent/prefab, then a new group with feather_2 which doesn't have a parent/prefab, then another group for feather_3. Like so:



    It works this way, so I'm happy! Thank you for the help and for the amazing plugin! I'll leave you a review once this project is done!

    EDIT: Hi again, I'm having another problem. I have 5 unlockable costumes in my project and I'm using the IGCItem_SingleSelect prefab. At runtime I am able to select more than one at a time. Again, the built-in items work fine, but in my project many can be selected. Do you have any idea why? I'm not getting any error messages... it just seems to "work" that way.
     
    Last edited: Feb 10, 2015
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    @PlayKiseki
    I'm a bit confused on how you solved your upgrades issue, doesn't that mean that "feather_1" shows up in the shop? Normally you would have a "feather" product in the shop, and "feather1-3" products in a group without prefabs (that's how the speed product is set up too).

    Regarding your edit: unlockable items have a special prefab which does not show the buy / select button by default, as they must be unlocked first. See "IGCItem_MultiSelect_Locked" for reference. If you instantiate it in the scene, it only shows some descriptive text set in the requirements window in the IAP Settings editor.
    Now if you want to have both unlockable AND single select prefabs, you can built the prefab out of the existing one but delete its deselect button. All of your costume products must be in the same group too (as in the weapons example).
     
  41. PlayKiseki

    PlayKiseki

    Joined:
    Oct 4, 2014
    Posts:
    14
    @Baroni I think I confused myself and was being kind of dumb before. I retried your suggestion and it works as you said (using just 2 groups instead of 3). feather_1 is available to buy from the beginning. When you buy it, it changes to feather_2, then feather_3. So, all that is working fine now!

    As for the second point, again, I didn't phrase it well. the five playable characters are available for purchase whenever the player wants. The player should be able to only select one costume at a time after purchase, but right now you can select many at once.

    I'll show you here (ignore the terrible scaling for now!):


    Then:



    Here are the IAP settings:



    I hope that's clearer!
     
  42. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Thanks for the screenshot, I can see that you didn't set a price (or left it at 0) for your products. This will mean that they will all start as purchased from the beginning.
     
  43. PlayKiseki

    PlayKiseki

    Joined:
    Oct 4, 2014
    Posts:
    14
    I have them set to 0 for testing purposes. The problem I'm having is that multiple costumes can be selected at once. It should be like equipping a gun- only one should be able to be equipped at a time. That's how your example products work, but for some reason mine are not doing that.

    Sorry for not being clear enough!
     
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    @PlayKiseki could you send me a shop scene that reproduces this to my email?
     
  45. PlayKiseki

    PlayKiseki

    Joined:
    Oct 4, 2014
    Posts:
    14
  46. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Alright, the parent/container gameobject you are using (Window - Customization > ScrollView > Container) needs a "Toggle Group" component attached to it. Sorry about that, I actually forgot that this is required for single select products.
     
  47. Ziad

    Ziad

    Joined:
    Aug 5, 2012
    Posts:
    12
    Hi there,
    I'm getting this error once I start the application on my Sony Xperia Z2 ( Installed the application by using my device's Package installer) :
    IAPManager reports : BillingNotSupported. Error: No suitable appstore was found (response: 3 Billing Unavailable)

    I'm not sure how to fix that. Application bundle id is the same as the one in Google play store and I've copied my RSA puplic key to Google store key var in IAPManager and I've my in-app product setup correctly with the same ID as the one in Google play store.
     
  48. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    Hi Ziad, thanks for the description. Is your app also published as an alpha/beta and are you logged in with a test account on the device?
     
  49. Ziad

    Ziad

    Joined:
    Aug 5, 2012
    Posts:
    12
    Yeah I uploaded my application to beta and made a new google group and added my personal account to it and then added it to the beta testing groups.

    Some information that I don't know whether they would help to solve it or not :
    - I have an apk that is already published in production with a version of 4(1.3) and does not have the billing permission.(I had it uploaded before I plan to add in-app purchase
    -In order to create an in-app product I had to build another apk with the billing permission ( I built the sample ) and and I uploaded it as a beta with a version of 5(1.4)
     
  50. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,256
    @Ziad yes that should all be fine. I know there have been some issues with the latest version of OpenIAB, could you please try to import version 0.9.7.2 instead? That's the version I work with, and which usually works without problems.
    https://github.com/onepf/OpenIAB-Unity-Plugin/releases