Search Unity

Simple In-App Purchase System (SIS) - Shop solution

Discussion in 'Assets and Asset Store' started by Baroni, Aug 8, 2013.

?

Which billing plugin are you using in combination with Simple IAP System?

  1. Unity IAP

    173 vote(s)
    86.5%
  2. Voxel Busters

    10 vote(s)
    5.0%
  3. Stans Assets

    13 vote(s)
    6.5%
  4. Prime31

    4 vote(s)
    2.0%
  1. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @v.megar.v
    Page 2, step 4: "Enter your Google Play developer key in the prefab inspector (except when using Unibill, in this case your key goes into Unibill’s Inventory Editor), if you want to use Android as a publishing platform."

    Make sure to switch the target platform to Amazon and back to Google Play once before saving the inventory. Unibill only generates the AndroidManifest when doing that. Check your bundle identifier and if everything is set up correctly, the device log.
     
  2. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi Baroni,
    I bother you with a curiosity about the possibility of transferring SIS products from a project to another. Can this be done ? Thanks !
     
  3. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hey Dorin, products are stored in the IAPManager prefab. Exporting and importing it in the other project should work.
     
  4. Gamma42

    Gamma42

    Joined:
    Feb 3, 2015
    Posts:
    7
    Baroni, I have a question. I did figure out my other issue (user error as they often are... lol) and am trying to figure out one more. I wanted to test a simple coin pack in my game... just one. By the time I had imported SIS I was ready for publish... I was unaware it was a "one-stop playerprefs shop". I had already saved several things into playerprefs and had my own character shop setup. So this is what I did and it may not be the intended use, but I thought you might be able to help me, or tell me if I misunderstood the workings. I decided to only let sis handle that coin pack transaction and so I added my product to the listener, and a simple 500 coins added message. I then proceeded to add the SIS namespace to my shop script. I created a secondary bool to use to compare "states" of dbManager.isPurchased ("") and my own bool to run a function when they were both true. Then it runs some of my internal shops functions to add coins and update my currency texts and save it in playerprefs the way i did all my other shop code. I am curious is there anything really wrong with this approach? My first implementations all worked (though I had forgotten to store my bools final value(which i flipped after my coin functions completed so that it wouldn't run again). Therefore inititally coins were added every script run), then later with every game run. I thought "ok, im silly" I had never written out the value changes to playerprefs so I did so... with my last approach which even when tested in other situations worked fine, but didnt in the shop situation. Now no coins are given when product is purchased. Again, I am sure it is my programming, but i am wondering what your opinoin would be on using it that way?? I could show how I was attempting to use DBManager.isPurchased with my own setup if it would help. I just kinda hit a wall and I thought if you knew what I was trying to do maybe you would have some input. Great asset btw. Ill be leaving a review soon. I usually like to get my hands dirty with it first :)
     
  5. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    This is all black magic to me, as I don't know what you are doing :) I hope I can answer your question with this general explanation: DBManager.isPurchased is for non-consumable purchases, like cars, levels, skins etc. Consumable purchases such as powerups, coins, ammunition do not have a database entry and will always return false.

    So if you want to add coins in your playerprefs, all you need to do is to add your code to the switch handler in the IAPListener script for your product. No isPurchased or other checks. The HandleSuccessfulPurchase method only runs when a transaction completes. There are a few caveats when not using the database in SIS though: you will always have an internal virtual currency amount of 0 and won't be able to buy other packs in SIS in exchange for coins, as it thinks you have none. I'm not sure about how you would handle that without rewriting some methods of SIS.
     
  6. Gamma42

    Gamma42

    Joined:
    Feb 3, 2015
    Posts:
    7

    Your response helped me greatly. I think I now understand how I should probably do this, if I am going to do it this way. I don't have anything in the sis shop for purchase with sis virtual currency, so i beleive that will be fine. I assumed I probably shouldnt try to do that if i was trying to keep my existing work intact and still use a feature of sis. when I bought this package a few months back i did not know what all it did(ideally i would've planned and used the sis database initially). So if i understand... technically should be able to add my namespace to sis IAPlistener script and where my entry is in the switch handler just call my function from my shop script which adds my coins and updates my currency? and at that point should be good? Btw i lol'd pretty hard on the black magic... that was good. Also in addition to that last explanation/question. I had initially marked it as non-consumable so i could call isPurchased. should I change is in iap settings editor... i figured either way it would be a one time purchase situation and figured it wouldnt be an issue if i called it that way. Should I mark it consumable and add my code to the switch handler as described above. I am thinking now that should work, and is probably the cleanest implementation if i plan to do it that way.
     
  7. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Yes, that should be sufficient.

    For coins, yes. Otherwise you won't be able to buy them multiple times.
     
  8. Gamma42

    Gamma42

    Joined:
    Feb 3, 2015
    Posts:
    7
    Awesome, Thank you very much Baroni! Now that i know what all the package offers it makes a great deal of sense to use the sis database for prefs on next project... I am just stubborn and didn't want to make design changes this late in development. Thank you again for your help. I did the above and now I am hoping to do some testing in a bit when it goes live again. The non-consumable was making it hard to get new people to test the coin pack purchase process :D... had to find a new sorry soul everytime :)

    Thanks
     
    Baroni likes this.
  9. RoyalCoder

    RoyalCoder

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

    The solution with export/import the IAPManager.prefab worked fine, but now I get this error:
    UnityException: Transform child out of bounds
    UIPanelStretch+<Start>c__Iterator30.MoveNext () (at Assets/SIS/Scripts/UIPanelStretch.cs:30)

    *FIXED
    My mistake, I attached in the IAP Settings, the wrong container for the Parent ;) Who get this problem just be aware on the stuff you set for products prefab and the parent of them ;) !

    @Baroni how about this:
    NullReferenceException: Object reference not set to an instance of an object
    SIS.DBManager.GetPlayerData (System.String id) (at Assets/SIS/Scripts/DBManager.cs:412)
    GameManager.Awake () (at Assets/_Stuff/Scripts/GameManager.cs:38)


    Line 38: string currentLanguage = DBManager.GetPlayerData("lang");

    Thanks!
     
    Last edited: Jun 10, 2015
  10. v-megar-v

    v-megar-v

    Joined:
    Mar 11, 2013
    Posts:
    28
    HandleSuccessfulPurchase is not triggering at all. I have put messages to display whenever it gets to that function, but the HandleSuccessfulPurchase function does not get called and my coin balance remains unchanged. Why? :( Any Ideas?
     
  11. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    @v.megar.v be aware if in the scene do you have IAPManager Prefab -> with IAPListener enabled or in the first scene of you game ;)
     
  12. v-megar-v

    v-megar-v

    Joined:
    Mar 11, 2013
    Posts:
    28
    I do have it set that way, but I get nothing :(
     
  13. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
  14. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @D0R1N
    You didn't start from the first scene or don't have an IAPManager prefab in the scene, I guess.

    @v.megar.v
    What @D0R1N said. Also toggle the "debug" checkbox on all components and see where the call ends.
     
  15. v-megar-v

    v-megar-v

    Joined:
    Mar 11, 2013
    Posts:
    28
  16. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    If you are running it on the device, again this could be because of errors occuring during the initialization of SIS, so check for errors (NullReferences etc.). You can also always send me a project that reproduces this to my email (stated on the last page in the documentation pdf) and I'll check it out tomorrow - it's after midnight here.
     
  17. v-megar-v

    v-megar-v

    Joined:
    Mar 11, 2013
    Posts:
    28
    I am not allowed to send you the project, but I discovered that the IAPListener gets called when I do a consumableVirtual purchase, but not when I do a plain consumable purchase. I set the Googleplay items to be consumable, and the local ingame items as consumableVirtual. Is that correct? And why do you think it could be the reason as to why the IAPListener is being called only by the consumableVirtual?
     
  18. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Depends on if they should actually be consumable, thus purchasable multiple times...
    Answering that would be a combination of guessing and poking in the dark, I really can't tell without any information about the project or error logs.
     
  19. v-megar-v

    v-megar-v

    Joined:
    Mar 11, 2013
    Posts:
    28








    and lastly I attached the adb log, although I didn't see anything suspicious myself.
     

    Attached Files:

  20. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    There is a lot of unnecessary stuff in there, please try "adb logcat -s Unity". Also I can't find any debug messages of the IAPListener or IAPManager prefab when purchasing products, and your images don't load.
     
  21. v-megar-v

    v-megar-v

    Joined:
    Mar 11, 2013
    Posts:
    28
     

    Attached Files:

  22. v-megar-v

    v-megar-v

    Joined:
    Mar 11, 2013
    Posts:
    28
    I will add that buying a googleplay item does not generate any lines on the log, but the consumableVirtual do.
     
  23. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @v.megar.v
    Thanks for the screenshots, your configuration looks good. Sorry that this is a time consuming trouble shooting, but I can't see any issues there so let's step back for a moment. You have some coins products in the shop, set up as managed products on Google Play, that should give the player coins ingame. They do show up in Unity. After pressing the buy button on a product, going through the purchase process (entering email, password in a popup), you see a window from Google Play that shows a successful transaction but you don't get anything in the app, as the IAPListener method is not being called. Is this correct?
     
  24. v-megar-v

    v-megar-v

    Joined:
    Mar 11, 2013
    Posts:
    28
    In our case the google play window never pops up :( I know the IAPListener is not being called because I set up messages inside the IAPListener and they never pop up when doing the google items. Even so, the messages I set on the IAPListener pop up when I purchase consumableVirtual. At someone's suggestion, I took the demo scene and set all the items to be purchased from my game into it. I get no items to show up and it gives me this error on the log:

    If I uncomment the try catch, I can see the items again, but I am back at the same point as in my previous problem in my main game. Now, I d not understand why it would not initialize on android, yet I have no problems or error messages when I run it through the editor on my computer.

    I repeat for clarification purposes, this is the HorizontalTabs demo scene running with my Google Items and Unibill.
     
    Last edited: Jun 12, 2015
  25. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    The pop up not showing is a serious problem! This means that the billing (Unibill) configuration has some issues in setting up. IAPListener is only called on completed purchases, but without the Google Play window you won't reach that point.

    Virtual purchases are made offline and in SIS (not Unibill) so that doesn't relate to real money purchases.

    Unibill can't read your inventory. Open the InventoryEditor, switch the platform to Amazon and back to Google Play (this will generate the AndroidManifest) and hit save.

    Double check that your AndroidManifest file has the com.outlinegames.unibill.PurchaseActivity needed by Unibill. Oh, and please remove the code taken from Unibill in your post. I'm sure that its developer doesn't want to see it published.
     
  26. v-megar-v

    v-megar-v

    Joined:
    Mar 11, 2013
    Posts:
    28
    So, when you say there is something wrong with the Unibill setup. does this mean that the settings I provided on my screenshots are not correct? Or are you saying it goes beyond the settings? Have anyone ever gotten that error before?

    I do not understand why unibiller would fail to initialize since I feel like I followed the tutorials properly.

    I did try switching to Amazon then Google in the past I got nothing. I will try it again in a few moments just to make sure.
     
  27. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    It is not in the screenshots, they look fine to me. Yes, I get that error too with missing inventory or Google developer key.

    Verify that unibillInventory.json.txt and AndroidManifest.xml is actually there and correct. If you could at least send me a project that reproduces this, I could figure this one out in minutes. Guessing is tedious. I'm slowly running out of ideas here..
     
  28. v-megar-v

    v-megar-v

    Joined:
    Mar 11, 2013
    Posts:
    28
    Ok, I will try a few ideas first and then if I don't succeed then I will make a project that replicates the problem and send it to you. That being said, I do have one more question. look at this picture of the IAP_settings window and see the area that I marked with the red rectangle. Then look at it after I run it (the pink iap_settings window image), and This message pops up in the area that I also marked in a red rectangle, saying "No Shopmanager prefab found on this scene!" Could this be indicative of something? or is it just another thing in the sea of my issue? Thanks.
     

    Attached Files:

  29. v-megar-v

    v-megar-v

    Joined:
    Mar 11, 2013
    Posts:
    28
    Forget that Fixed it. As you said, it was the inventory failing to load. It was all due to the check box on publishing settings called split binary application. It must be unchecked. :'(
     
    Baroni likes this.
  30. ironfiftynine

    ironfiftynine

    Joined:
    Jan 22, 2013
    Posts:
    71
    Good day. I would like to ask if you have an online documentation for how to link this package with Stan's Assets? I haven't bought your package yet, but I would like to check how the linking process will be done to decide if this can improve my workflow. Thank you very much.
     
  31. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    So this basically provides the front-end to a back-end system like Unibill? (I haven't dug into IAP stuff yet, just trying to figure out what packages would be useful.)

    Also, we have a project that is, sadly, still using the old Unity GUI. Does this include guiskins and templates for that?

    thanks
    Dave
     
  32. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    @ironfiftynine @gecko
    Hi, I've uploaded a video on how to set up Unibill (not much difference to other plugins) on our Youtube channel, here. This asset works as a front-end to those billing plugins, that's correct. You won't have to touch any billing code directly, SIS does that for you. You'll only specify what in-game action the purchase of a product should result in.

    @ironfiftynine
    No, the old Unity UI didn't make much sense to support in terms of performance. Unity 4.6 UI and NGUI samples are included.
     
    ironfiftynine likes this.
  33. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    We're looking at Playfab for our backend. Can you give any sense of how easy/hard it would be to hook SIAP to that, since that's not one of the platforms with built-in support?
     
  34. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    There are two scripts to modify for new implementations, IAPManager.cs and IAPArticle.cs. To be able to use their player data management, all calls to our DBManager should be replaced too. The billing plugins out there are pretty similiar in their API and typically I need 2-3 days for them. I don't know how PlayFab is different to that, but a fully customized version of SIS for PlayFab could be compared to our other asset, Simple IAP System for SOOMLA, which took 2 weeks to build (based on existing code).
     
  35. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Hmm. You aren't planning to do a PlayFab version, are you?
     
  36. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    No, sorry. I can't commit to more integrations due to time constraints and existing support levels. Simple IAP System for SOOMLA has been made via an agreement, and unless PlayFab is offering the same, it won't happen. On the other hand, I'm thinking about removing Unity 4.6 and NGUI support by the end of this year, so it may or may not be a consideration for the future.
     
  37. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    I'm getting this error below only when I release my apps to Amazon. SIS in-app purchases work fine in Google Play. Any help is appreciated.

    I checked the following points:

    - I changed the store setting to "Amazon" in the SIS settings.
    - my AndroidManifest file includes the billing permission
    - my APK uploaded to Amazon is the most recent one (with the billing permission)
    - the bundle identifier in Unity matches the one displayed for your app in Amazon

     
  38. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Testing in-app purchases on Amazon is quite different from Google Play. You'll have to set up your device with the testing environment (App Tester) and specify the JSON file with all product data as described here: Amazon Testing In-App Purchasing (IAP). Switching the store in SIS' IAP Settings editor mainly tries to tell OpenIAB that you could be using different products there. It won't fully go into "Amazon testing mode" without going over Amazon's steps though.
     
  39. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    The weird thing is, I have 2 apps that have gone live on Amazon. So it is a live production (not testing) environment for both apps.

    In-app purchases using SIS and OpenIAB work fine for one app, bringing up the Amazon purchase screen. In-app purchases using SIS and OpenIAB doesn't work for the other app, bringing up the error screen in my previous post.

    I checked all the points I mentioned in my previous point for both apps. Is there any other SIS setting you can think of that I may have missed in the app that isn't working? Thank you
     
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Mmh I really don't know, especially if it works with the same setup. Maybe you could try to remove the Google developer key on the IAP Manager prefab, in case you've set it. Just a wild guess though.
     
  41. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Thanks Baroni. I looked in the Amazon logs and see that it's an error with OpenIAB:

    "E OpenIAB-UnityPlugin: Problem setting up in-app billing: IabResult: 3, No suitable appstore was found (response: 3:Billing Unavailable)"

    Maybe I'll just try another billing plugin... is there a way I can swap out OpenIAB and use Soomla instead, while keeping all my SIS settings intact?

    I have the SIS for Soomla asset as well but I don't want to re-input all my many IAP and IGC items in my current app. Thanks!
     
  42. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Actually there are a few hints on how to deploy your apk for Amazon: Link. There is also an older, much longer thread about it here.

    Unfortunately not. Soomla's store model is quite different from the other billing plugins (non consumables = lifetime products, consumables = single use products, selectable = equippable etc.). These are all different types than in the main SIS asset.
     
  43. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Thank you. What about if I swap out OpenIAB for Unibill, would that allow me to keep my IAP and IGC settings as they are?
     
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Good question, yes it does. Just tried exporting the IAPManager prefab few seconds ago. But with Unibill, you actually have to define your products in the Unibill inventory editor too. This is only necessary for the IAP items though (and name+description etc. does not matter, only the id matters).
     
  45. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Ok thank you.

    Another question: can I just using the regular SIS just for an IGC storefront, without any IAPs?

    In other words, use SIS simply as a virtual store without having to initialize any IAP plugin. Is there some option or setting not to require a billing plugin?
     
  46. BigToe

    BigToe

    Joined:
    Nov 1, 2010
    Posts:
    208
    When I imported the SIS and Unibill (1.8) I was left with two compilation errors.

    The first was...
    Code (CSharp):
    1. Assets/SIS/Scripts/IAPManager.cs(305,48): error CS0234: The type or namespace name `PurchaseEvent' does not exist in the namespace `Unibill'. Are you missing an assembly reference?
    2.  
    It came from this function in IAPManager...
    Code (CSharp):
    1. private void PurchaseSucceeded(Unibill.PurchaseEvent eventData)
    2.         {
    3.             string id = eventData.PurchasedItem.Id;
    I was able to fix it by removing the "Unibill." namespace from the PurchaseEvent parameter.

    The second was...
    Code (CSharp):
    1. Assets/SIS/Scripts/IAPManager.cs(623,52): error CS0234: The type or namespace name `PurchaseFailedEvent' does not exist in the namespace `Unibill'. Are you missing an assembly reference?
    2.  
    It came from the following function in IAPManager...
    Code (CSharp):
    1. // method that fires a purchase/cancelled error
    2.         private static void PurchaseFailed(Unibill.PurchaseFailedEvent eventData)
    3.         {
    I can't find the definition for PruchaseFailedEvent in Ubill. Has it changed? If not, what's the best fix here?

    Thanks in advance.
     
  47. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Yes. It's not an option or button you can press that does this automatically, but you could just import the SIS+OpenIAB package in Window > Simple IAP System > Plugin Setup and remove all OpenIAB calls in the IAPManager.cs script.

    Unibill 1.8 is very old, they're at 1.10.3 now. The purchase failed events changed in 1.9.7, please try updating your copy of Unibill (and not modifying our IAPManager).
     
  48. Simmo76

    Simmo76

    Joined:
    Oct 17, 2012
    Posts:
    31
    Hi there,

    I'm having a UI issue on my new HTC android device where horizontal grey "bars" appear, obstructing the view of hte shop items behind.

    You can see the actual backgorund through thin areas between the grey/white parts in the attached screenshot.

    Any ideas as to why this might be happening? BTW this happens in both horizintal/vertical mode as well as portrait and landscape.

    Cheers.


    linesIssue.png
     
  49. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,260
    Hi Simmo,
    please try updating to the latest Unity version to see if that fixes it. This is an issue with Unity's UI and because I can't submit a bug report myself (as 3 of my devices don't have this issue), please submit one if it is still happening and let me know the public issue tracker number, so I can vote for it.

    There were multiple posts about this in my forum, but I've never heard back from them.
    http://www.rebound-games.com/forum/index.php?topic=210
     
  50. Simmo76

    Simmo76

    Joined:
    Oct 17, 2012
    Posts:
    31
    Ok it's still an issue in the latest unity build (5.1.2f1).

    Tried a few different things (eg. moved/removed some controls, changed the depth on a few panels) but it didn't have any effect.

    Unfortunately - this is a real show stopper for us :(