Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Simple In-App Purchase System (SIS) for SOOMLA

Discussion in 'Assets and Asset Store' started by Baroni, Jan 8, 2015.

  1. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Cool! You deserve a beer for your great customer service :cool:
     
    Baroni likes this.
  2. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Hi again Baroni, I tried to follow your Soomla video but get this error:

    Assets/SIS/Scripts/IAPManager.cs(129,25): error CS0117: `Soomla.Store.StoreEvents' does not contain a definition for `OnUnexpectedErrorInStore'
     
  3. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    Hey, looks like they've renamed this event 12 days ago. Please rename OnUnexpetedErrorInStore to OnUnexpectedStoreError two times (line 129, 184) and replace the BillingNotSupported method with this:

    Code (csharp):
    1.         // method that fires a product request error
    2.         private static void BillingNotSupported(int error)
    3.         {
    4.             if(instance.debug)
    5.                 Debug.Log("IAPManager reports: BillingNotSupported. Error: " + error);
    6.             ShopManager.ShowMessage("Something went wrong. Errorcode: " + error);
    7.         }
    Thanks for noticing!
     
  4. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Thank you Baroni, that worked. I have another issue now though:

    I set up Soomla and SIS according to your video tutorial. I added a couple of virtual items in the IAP Settings (a simple "no ads" product and a "restore" product) and tried to test on Google.

    But when I try to buy the no-ads, I get a VirtualItemNotFoundException. And when I try to buy the restore, I get a Google window saying "Error: Authentication is required. You need to sign into your Google Account" even though I'm already signed in.

    Are there other settings that are needed aside from what you showed in the video? Do I have to enter in-app purchases on the Soomla website or something like that? Thank you!
     
  5. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    Completely uninstall your app on the device, so all data (PlayerPrefs) gets deleted. Also see this thread for more solutions: published app on Google Play and active IAPManager scripts.

    Save as above - your app has to be published as alpha/beta and tester accounts need to be added.
     
  6. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    Hi Baroni, I already completely uninstalled and reinstalled the app multiple times, and the app has already been published with tester accounts added.

    In fact, the in-app purchases worked fine with OpenIAB for this very same app, but I decided to try switching over to Soomla (because OpenIAB stopped working for Amazon for some reason) and I'm getting the above Soomla errors. So the issue is either with my Soomla or SIS setup (for which I followed your video).

    I might have to try going with Unibill after all... as a paid service, do you find Unibill to give less issues overall than the open source ones? In other words, do you find it to just "simply work" in most cases? I'm just hesitant to pay that much and then find out it also causes random issues (for example, OpenIAB used to work fine for Amazon but suddenly doesn't work anymore in its latest version).

    Anyway, thanks for your help!
     
  7. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    As a side note, nothing would build with the Soomla setup described in your video.

    It turned out the jar files in the "amazon" and "google-play" folders under \Assets\WebPlayerTemplates\SoomlaConfig\android\android-billing-services\ were corrupted or incomplete (they were only 1K in size), so I had to download them manually from the Soomla website. Only then would the project build.

    Just a note in case people run into the same problem. I think they are changing a bunch of things on the Soomla side these days.
     
    Last edited: Jul 19, 2015
  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    No, I don't think so. Unibill has its own oddities, which you can find by going through its thread on the forums. Devs ask the same questions there, like "it worked on my old device, but not on the new one". In every case, it isn't anything specific. Android has so many devices and billing solutions, sometimes I get the impression that Google doesn't know how to handle that either. It's very frustrating to solve billing errors, as the "authentification is required" thing could have more than 3 possible causes.

    SOOMLA usually works fine when following the video tutorial, otherwise I wouldn't keep selling it.Thanks for the information in your last post about the jar files, I'll look into that soon. Could you please send me a project that reproduces your issues with SOOMLA, so I may be able to figure out if it's related to Unity or Google Play, by switching out your developer key and bundle identifier.
     
  9. frozze

    frozze

    Joined:
    Aug 13, 2015
    Posts:
    11
    How codeless is this?

    I'm using playmaker to handle my score. Lets say that every time i get a point in my game, it's saved to playerprefs. Now if i want to use that score to buy something, would your asset be able to access that playerprefs, or how does it work?

    best regards
     
  10. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    You would set up the score as virtual currency, along with the products that can be bought for this currency. This is done in the IAP Settings editor and does not require code. If your user purchases a product, you need to tell your game what happens and that's where your code comes in. If your user purchases a sword, for example, you would need to check whether he is wearing that item or not - and do something with it, maybe instantiate the sword ingame. Our DBManager has multiple methods for that and all of them are documented, such as DBManager.isPurchased("sword").
     
  11. frozze

    frozze

    Joined:
    Aug 13, 2015
    Posts:
    11
    Thanks.

    So if a player unlocks a new character, and we switch to that character, is that a lot of code that needs to be written? Or is there an example of the code in your game example? I'm a bit worried if I buy this, and then not able to use it due to my bad coding.
     
  12. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    Yes, there is an example for exactly that use case. It's the demo game seen in this screenshot - where you are able to buy different colors for your jumping cube. It's not a lot of code and basically looks like this:
    Code (csharp):
    1. if(DBManager.isPurchased("blueCube"))
    2. {
    3.    InstantiateBlueCube...
    4. }
    5. else if(DBManager.isPurchased("yellowCube"))
    6. {
    7.    InstantiateYellowCube...
    8. }
    If you have any code related questions while using it, don't hesitate to post them here or contact me via email.
     
  13. frozze

    frozze

    Joined:
    Aug 13, 2015
    Posts:
    11
    Okay great, thank you!
     
  14. adelphiaUK

    adelphiaUK

    Joined:
    Apr 6, 2014
    Posts:
    28
    Hello. I am interested in purchasing this asset as I'm having a hard time implementing SOOMLA Store into my game.

    Will/can this tool fetch "live data" from my Google Play listing (which is currently published as ALPHA) to reflect actual prices or is this simply a store front designer?

    Excuse my ignorance if I have missed this info but being out of work, I don't want to spend money on making my game look pretty; I can do that myself. Incidentally, the screen shots make this asset look awesome!!!

    One final point, will this work with Unity 5.1 (Windows) and has it been updated to support the new SOOMLA GROW Ultimate API which I have just upgraded to?
     
  15. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    Hi adelphia, thanks for your interest :)

    Yes, it does fetch localized live prices/descriptions/titles from Google Play or iTunes.

    Simple IAP System for SOOMLA initializes the store and highway modules (and works with Unity 5.0+), the rest is up to you. I don't think that the Ultimate API changes any existing methods, but if you have issues integrating it, please let me know.
     
  16. adelphiaUK

    adelphiaUK

    Joined:
    Apr 6, 2014
    Posts:
    28
    Thanks for your response.

    Since converting to SOOMLA GROW Ultimate (and I'm presuming the other GROW bundles do this too) they have changed from SoomlaHighway.Initialize() to GrowHighway.Initialize() which suggests there might be some other changes required; all previous "Soomla.Highway" and "SoomlaHighway" references will need to be changed to "Grow.Highway" and "GrowHighway" for sure. Is the code included to be able to make the changes myself or would I need to wait for a new GROW <X> compatible version?
     
  17. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    @adelphiaUK
    Ah thanks, I'll look into it. You can easily do the changes you've mentioned yourself - we are not using other Highway code besides the initialization method.
     
  18. adelphiaUK

    adelphiaUK

    Joined:
    Apr 6, 2014
    Posts:
    28
    Thanks very much for your responses. Purchased. Do I still need to import SOOMLA (before I remove it) or are the necessary parts incorporated into SIS?
     
  19. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    Thanks! Yeah you still have to download and import SOOMLA separately - the process is described in the documentation pdf or if you like watching video tutorials instead, on our YouTube channel.
     
  20. adelphiaUK

    adelphiaUK

    Joined:
    Apr 6, 2014
    Posts:
    28
    I'm hoping this doesn't double post as it timed out the first time...

    I just want to say a big THANK YOU for this asset! After trying to get IAP working on my own for a week or more, after purchasing your asset, IAP is working within the space of an hour or so.

    I have a couple of questions and points:
    • When I first access the store (I mean after a new install, first start of game when there is no data on the device) everything appears to be blank. Is there some kind of "refresh" I need to perform the first time?
    • Is there anyway to actually test the store from within Unity Editor? All I get is what I put into "Simple IAP System" -> "IAP Settings" when running locally (i.e. within the editor) and it doesn't "Fetch" from the Google Play Store
    • FYI: The PDF documentation now has an invalid link for "Getting Started #4 "(http://know.soom.la/unity/grow/grow_gettingstartedstoreonly). I receive a "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable." error on that page. This didn't effect me but it may effect people who are not quite so savvy.
    Thanks again for a great asset and I look forward to using it on many a new project!
     
    KhaledM likes this.
  21. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    @adelphiaUK thank you for the kind words! Please consider writing a review on the Asset Store at some point :)

    Not manually, no. It could be that your device first gets the response from Google Play few seconds after opening the shop scene, but in this case it should at least display all (offline) products. Is the shop scene the only/first scene you've deployed?
    Unfortunately not, only real devices are able to connect to the stores and get the IAP response. You can buy "In Game Content" in the editor, but for real money in-app purchases it doesn't make much sense - as you have to make sure that they are connected to the store properly.
    Thanks for noticing!
     
  22. adelphiaUK

    adelphiaUK

    Joined:
    Apr 6, 2014
    Posts:
    28
    Consider the review done (well, it will be very shortly).

    Yes, this is the only scene that I use. I use canvas/panels and gameObject.SetActive(true/false) as my "scene switcher" as it's not a big game with complex scenes. I have no in game purchases, just market place ones. When a "local" version is created, does it create a file in a specific place? What I'm thinking is perhaps I could copy this file (which would obviously be "un-purchased" for all items by default) as a resource file but not knowing how SIS handles the local version (read/write) I'd need to know where to look in the code/folder. Any pointers? Oh, my page is totally blank by the way, I mean totally; there are no IAPItem prefabs created or anything when on a device during an initial launch (but all are created in the editor) but after I exit the game and restart it it is all populated with the correct information.
     
  23. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    All product data for in-app purchases (id, name, description etc.) is being saved into the IAP Manager prefab, which holds a list of IAPGroups with IAPObjects. So no local file or anything like that there, it's all referenced in the script. The player data itself (products bought) is then saved by SOOMLA's storage classes.

    Interesting... just to be absolutely sure: check that the IAPManager prefab is located in that scene. I'm going to test that out here too.
     
  24. adelphiaUK

    adelphiaUK

    Joined:
    Apr 6, 2014
    Posts:
    28
    It sure is, otherwise I wouldn't see them in the editor either and it's ONLY on an initial launch. I'm going to add a simple text to the app to show how many items the IAPManager has listed when shown to ensure it's a actually being populated on initial launch.

    [EDIT]
    OK, I can confirm this is a bug/issue (or I'm missing something). When I first launch I have zero IAPItems created (I added a GetComponentsInChildren<IAPItem>().Length check). After I quit the game and restart, the IAPItem count (using the same function) is 8 as it should be.

    [EDIT#2]
    OK, I've found out where the issue lies. If you start an app (at least in Android) which only has 1 scene, OnLevelWasLoaded in IAPManager for some unknown reason, is never called when an app is initially launched. Subsequent launches do invoke the OnLevelWasLoaded call. The way I have worked around this is to create a completely blank scene which just has a camera and attached a script which simply loads the next (original) scene. This in turn enables the shop to be initiated by means of OnLevelWasLoaded. Not sure why this is happening but at least I have a workaround.
     
    Last edited: Sep 7, 2015
  25. adelphiaUK

    adelphiaUK

    Joined:
    Apr 6, 2014
    Posts:
    28
    OK, I've run into a small problem. I am currently running a test install (alpha stage) and I want to reset my store as if I haven't purchased anything. How do I do it? I've tried by uninstalling the app but as soon as I reinstall, the items are not available for purchase any more. In addition, for some unknown reason, after a successful purchase, my items state don't show as sold/purchased on a device but they do within the editor (which incidentally can be reset by clicking the generated IAPItem "restore" item).
     
  26. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    Thanks for pointing that out, I'll see if there is a method to get the total scene count / check for the first scene and call OnLevelWasLoaded anyway.

    Purchases are stored for your account and your device receives this list on each app launch. For non-consumable products, you have to cancel the purchase in Google's Merchant Center as mentioned in this thread.

    Any useful error messages in the device log?
     
  27. adelphiaUK

    adelphiaUK

    Joined:
    Apr 6, 2014
    Posts:
    28
    Not sure if this would work, but could you use an instantiate for the Shop Manager rather than have the user have them put a Shop Manager into the scene themselves as I believe this is what is effecting this issue as I think (only think) it does one thing when it doesn't have any data from the on-line store and another when it does, i.e. when it uses "Fetch" but I could be totally wrong.

    Thanks. Sorted.

    I will see what I can dig out although I'm not too good at fetching device logs as I do most of my debugging in the editor which, in this case, doesn't have the issue.

    EDIT
    OK, this is what happens when I start the app. This is about an hour after I cancelled the test orders.

    Code (JavaScript):
    1. 09-08 20:55:17.927: E/SOOMLA SoomlaGpVerification(7841): Failed to verify transaction receipt. The user will not get what he just bought.
    2. 09-08 20:55:18.573: E/SOOMLA SoomlaGpVerification(7841): Failed to verify transaction receipt. The user will not get what he just bought.
    3. 09-08 20:55:33.831: E/SOOMLA GoogleIabHelper(7841): Unable to buy item, Error response: 7:Item Already Owned
    Don't know if you can help with this.

    EDIT#2
    I think you can ignore the issue about not being able to repurchase (for SIS anyway) as it appears to be a SOOMLA one (there are numerous reports in SOOMLA Answers). I didn't want to delete what I'd already posted in case others have a similar issue and they will then know where to look.
     
    Last edited: Sep 9, 2015
    Baroni likes this.
  28. KhaledM

    KhaledM

    Joined:
    Sep 29, 2013
    Posts:
    41
    Hi @Baroni
    Thanks for this asset it is really good,
    I have question, how can I sync the purchased items on multiple devices?
    If a player have two tablet or phones how can I synchronize his purchases from a device to another?
     
  29. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    Hi and thanks for using SIS!
    Non-consumable purchases for real money are associated to your iTunes/Google account and fully handled by the app stores. Your user can restore them on any device by "buying" (doesn't actually cost sth.) the "restore" product ingame.

    Consumable and in game content products, such as coins are saved on the device only. In order to snychronize them too, you could look into the synchronization methods offered by SOOMLA - they provide cloud storage for player accounts via Google login.
     
    KhaledM likes this.
  30. KhaledM

    KhaledM

    Joined:
    Sep 29, 2013
    Posts:
    41
    Thanks for your reply,
    I have one more question, how can I offer an item with two virtual currency?
    for example I want to sell a car either with 1000 virtual coins or with 10 golds
     
  31. adelphiaUK

    adelphiaUK

    Joined:
    Apr 6, 2014
    Posts:
    28
    Doesn't your in game currency determine that? i.e. 1 gold = 100 virtual coins?
     
  32. adelphiaUK

    adelphiaUK

    Joined:
    Apr 6, 2014
    Posts:
    28
    OK, I'm having some real issues right now and it's preventing me from releasing my game! Stupidly, I updated to "Soomla GROW" and since then I am having all kinds of errors. So, I thought, I'd revert back to Store/Core but now I can't compile as IAPManager is as king for SoomlaHighway.Initialize() which is now only available (as far as I can see) when you install a grow package. I purchased this package as (initially) it worked fine with Store/Core but since upgrading to GROW I can't get it to work correctly. I can't remove purchases for my test account, despite them being cancelled in Google Play and I keep getting "This item is not available" errors too. I'm not sure if this is a Soomla issue or SIS issue (so I am posting on both sites) but I am desperate to get it sorted. Is SoomlaHighway an absolute must for SIS to function correctly?
     
  33. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    @KhaledM Two currencies with an OR condition are not supported, so the best way would be to let your users convert gold to coins.

    @adelphiaUK did you download the GROW package via the link provided in the getting started section of the documentation pdf? I've tested the "old" GROW package few days ago and it still works without errors. You can find a lot of information about the Google message you are seeing online, which could occur because of incorrect developer key, bundle identifier or inactive product in the Google Play Console.
     
  34. KhaledM

    KhaledM

    Joined:
    Sep 29, 2013
    Posts:
    41
    No my virtual currencies are not related to each other but thanks for the suggestion

    Thanks for your reply, I suggest you to add this feature because it is become a popular thing, you can see it in CSR (Upgrades), RR3, Asphalt Overdrive (Some Cars)...
     
  35. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    @KhaledM SIS is the frontend for SOOMLA, so they have to add it internally for me to support it. I'll see what I can do about it.
     
    KhaledM likes this.
  36. adelphiaUK

    adelphiaUK

    Joined:
    Apr 6, 2014
    Posts:
    28
    Oh crap! No, I downloaded direct from Soomla. I've just tried to import it and it's saying everything is "new". Any ideas how to remove the version I added (via Soomla's own site).

    It used to work (until I updated GROW) and it's only on one item that it's giving this issue. Like a douche bag, I didn't make a backup before I "upgraded" the GROW package so I'm just hoping I can resolve this! Luckily, I store all my own code in it's own folder so I may just have to start over and reimport my own code into a new project. I'll keep you posted!
     
  37. adelphiaUK

    adelphiaUK

    Joined:
    Apr 6, 2014
    Posts:
    28
    OK, I have managed to get everything back to as it was with the suggested GROW (from the PDF) but, even though I have cancelled the test order in Google Play (several hours ago) and I've completely deleted the game from the Soomla GROW dashboard and even changed my Soomla "secret" my game is still picking up the previous purchase I made. Is there data on the device I should be looking to delete to clear this? I have cleared the Google Play cache and uninstalled and reinstalled my game and even reset the PlayerPrefs. Anything else I should be looking to do? The "This item is not available for purchase" issue seems to be fixed after reverting the assets as the option to purchase for the item in question is operational again.

    [EDIT]
    This issue is now resolved, or at least seems to be. I'm guessing from cancelling an order in Google Play you have to wait for several hours for it to feed through.
     
    Last edited: Sep 17, 2015
  38. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    Correct, Google Play caches purchases information in the device for about 2-6 hours.
     
  39. kaplica

    kaplica

    Joined:
    Feb 20, 2014
    Posts:
    87
    I'm getting weird errors.. Products display but they're all stacked up on to each other and these errors come up..

    UnityException: Transform child out of bounds
    UIPanelStretch+<Start>c__Iterator1B.MoveNext () (at Assets/SIS/Scripts/UIPanelStretch.cs:30)

    Also when i'm trying to buy something, it can't fetch the balance for some reason, and it pops up with object null reference on balance error.


    I've set up my currency, soomla, iap, items and everything..


    Okay i fixed those errors. But the one with balance still comes up!
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Soomla.Store.StoreInventory.GetItemBalance (System.String itemId) (at Assets/Plugins/Soomla/Store/StoreInventory.cs:78)
    3. Soomla.Store.PurchaseWithVirtualItem.checkTargetBalance (Soomla.Store.VirtualItem item) (at Assets/Plugins/Soomla/Store/purchaseTypes/PurchaseWithVirtualItem.cs:126)
    4. Soomla.Store.PurchaseWithVirtualItem.Buy (System.String payload) (at Assets/Plugins/Soomla/Store/purchaseTypes/PurchaseWithVirtualItem.cs:77)
    5. Soomla.Store.PurchasableVirtualItem.Buy (System.String payload) (at Assets/Plugins/Soomla/Store/domain/PurchasableVirtualItem.cs:69)
    6. Soomla.Store.StoreInventory.BuyItem (System.String itemId, System.String payload) (at Assets/Plugins/Soomla/Store/StoreInventory.cs:67)
    7. Soomla.Store.StoreInventory.BuyItem (System.String itemId) (at Assets/Plugins/Soomla/Store/StoreInventory.cs:52)
    8. SIS.IAPManager.PurchaseProduct (System.String productId) (at Assets/SIS/Scripts/IAPManager.cs:277)
    9. SIS.IAPItem.Purchase () (at Assets/SIS/Scripts/IAPItem.cs:242)
    10. UnityEngine.Events.InvokableCall.Invoke (System.Object[] args)
    11. UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters)
    12. UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters)
    13. UnityEngine.Events.UnityEvent.Invoke ()
    14. UnityEngine.UI.Button.Press () (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:35)
    15. UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:44)
    16. UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:52)
    17. UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:269)
    18. UnityEngine.EventSystems.EventSystem:Update()
     
    Last edited: Sep 22, 2015
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    Did you place the StoreEvents and CoreEvents prefabs into your first scene and set up the required configurations in SOOMLA's Settings (developer key for Google Play, app no. for iOS, bundle identifier for both etc.). Also try deleting the current database file by pressing the "Clear Database" button in the AllSelection scene on the device.
     
  41. deebor76

    deebor76

    Joined:
    Oct 16, 2014
    Posts:
    4
    Hi,
    I have done a market purchase test. The items now reflects as sold in the purchase window(Using Vertical scene from examples). But when I restore the purchase. The Sold item should now revert to Unsold status. Which is not happening.
    I have to close my app and then restart. Then the transaction of restore is reflected.

    Can you please help with this.
     
  42. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    Hi @deebor76,

    "restoring" a purchase means that it will be snyced from the app store. Restoring a purchase will make it available on the same or another device again. There is a difference to "refunded". Did you actually mean refunded and how are you invoking the refund?
     
  43. KhaledM

    KhaledM

    Joined:
    Sep 29, 2013
    Posts:
    41
    @Baroni
    Hi, I want to use GrowSync with your asset here is IAPManager Start function

    Code (CSharp):
    1. #if !UNITY_EDITOR
    2. KeyValueStorage.SetValue("soomla.referrer", "SimpleIAP");
    3. GrowHighway.Initialize();
    4. #endif
    5.  
    6. // Make sure to make this call AFTER initializing HIGHWAY,
    7. // and BEFORE initializing STORE/PROFILE/LEVELUP
    8. bool modelSync = true; // Remote Economy Management - Synchronizes your game's
    9. // economy model between the client and server - enables
    10. // you to remotely manage your economy.
    11.  
    12. bool stateSync = true; // Synchronizes the users' balances data with the server
    13. // and across his other devices.
    14. // Must be TRUE in order to use LEADERBOARDS.
    15.  
    16. // State sync and Model sync can be enabled/disabled separately.
    17. GrowSync.Initialize(modelSync, stateSync);
    18.  
    19. // LEADERBOARDS requires no initialization,
    20. // but it depends on SYNC initialization with stateSync=true
    21.  
    22. // Make sure to make this call AFTER initializing SYNC,
    23. // and BEFORE initializing STORE/PROFILE/LEVELUP
    24. GrowGifting.Initialize();
    25.  
    26. KeyValueStorage.DeleteKeyValue("meta.storeinfo");
    27. SoomlaStore.Initialize(new IAPStoreAssets(this));
    28.  
    29. SoomlaProfile.Initialize();
    30.  
    31. World mainWorld = WorldGenerator.GenerateWorld();
    32. SoomlaLevelUp.Initialize(mainWorld);
    33.  
    34. //remote and shop managers
    35. FirstStart();
    36. StartCoroutine(RemoteDownload());
    37. OnLevelWasLoaded(-1);
    1- the thing is when I start the game on another device or if I played then do Clear Data (Android) and then start the game the FirstStart will give starter money again,
    so if I set default money to 1000, each time the player clear data and start the game again it will give him 1000 again

    2- After sync some items throw an exceptions while fetching
    VirtualItemNotFoundException: Virtual item was not found when searching with itemId=xxx
    this error only happen if I enable Grow.Sync

    I hope I made my question clear, English is not my native language

    Thanks
     
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    Hi @KhaledM,

    that's by design. If you delete the app, all player data (plus each virtual product bought or spend) is lost. The game is then handled as a new installation (for this new user). If you want to sync virtual currencies, you need to use a cloud storage provider such as Google Play, Parse - or Grow Sync and retrieve the currency amount from that.

    Most likely you synced a product to Grow Sync which does not exist in your IAP Settings editor anymore. So SIS tries to load it, can't find it and runs in this exception. Could you send the method or line which is affected?
     
  45. KhaledM

    KhaledM

    Joined:
    Sep 29, 2013
    Posts:
    41
    I am using Grow Sync, how can I retrieve the currency amount after sync?
    Is there a way to find out if this is New user or Synced user, in that case I don't need to call "FirstStart();" if it is a Synced User

    SIS.IAPManager.GetAllPurchased()
    I am calling it from my method to get purchased vehicles, I tried to call it when soomla store is initialized and another try when grow sync is finished but I get the same error in both cases
     
  46. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    Please have a look at SOOMLA's docs or try asking them their forum, I am not familiar with Grow Sync API in particular.

    What happens if you call this method at a later point, say 10 seconds after app launch? I am not sure where this method is failing or what your setup looks like to make any precise statements. It has various null checks in there already, so calling StoreInfo.xxx could be the issue in itself. I don't know why this comes up when activating Grow Sync though.
     
  47. ruigouveia

    ruigouveia

    Joined:
    Feb 2, 2016
    Posts:
    3
    Hi @Baroni ,

    First sorry for posting in the wrong thread yesterday and thank you for your quick answer.
    Regarding your question, i am logged in with a test account on my device.
    Also you asked to "Also could you monitor the device log when starting the app, as SOOMLA's initialization could fail".
    I did so and this is what i get:

    --------- beginning of /dev/log/system --------- beginning of /dev/log/main D/Unity ( 2131): GL_AMD_compressed_ATC_texture GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_debug_labelGL_EXT_debug_markerGL_EXT_robustness GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24 GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary GL_OES_packed_depth_stencil GL_OES_depth_texture_cube_map GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object GL_QCOM_alpha_test GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering GL_QCOM_writeonly_rendering GL_EXT_sRGB GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float I/Unity ( 2131): RequestBanner
    I/Unity ( 2131):
    I/Unity ( 2131): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)
    I/Unity ( 2131):
    I/Unity ( 2131): AndroidJavaException: java.lang.NullPointerException
    I/Unity ( 2131): at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown>:0
    I/Unity ( 2131): at UnityEngine.AndroidJNISafe.CallStaticVoidMethod (IntPtr clazz, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <filename unknown>:0
    I/Unity ( 2131): at UnityEngine.AndroidJavaObject._CallStatic (System.String methodName, System.Object[] args) [0x00000] in <filename unknown>:0
    I/Unity ( 2131): at UnityEngine.AndroidJavaObject.CallStatic (System.String methodName, System.Object[] args) [0x00000] in <filename unknown>:0
    I/Unity ( 2131): at Soomla.KeyValueStorageAndroid._setValue (System.String key, System.String val) [0x00000] in <filename unknown>:0
    I/Unity ( 2131): at Soomla.KeyValueStorage.SetValue (System.String key, System.String val) [0x00000] in <filename unknown>:0
    I/Unity ( 2131): at SIS.IAPManager.Start () [0x00000] in <filename unknown>:0
    I/Unity ( 2131):
    I/Unity ( 2131): (Filename: Line: -1)
    I/Unity ( 2131):
    I/Unity ( 2131): HandleInterstitialLoaded event received. I/Unity ( 2131):
    I/Unity ( 2131): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)
    I/Unity ( 2131):
    I/Unity ( 2131): bannerView.Show
    I/Unity ( 2131):
    I/Unity ( 2131): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65)
    I/Unity ( 2131): W/Unity ( 2131): Can not play a disabled audio source W/Unity ( 2131): W/Unity ( 2131): (Filename: Line: 394) W/Unity ( 2131):
    I/Unity ( 2131): VirtualItemNotFoundException: Virtual item was not found when searching with itemId=goo_02
    I/Unity ( 2131): at Soomla.Store.StoreInfo.GetItemByItemId (System.String itemId) [0x00000] in <filename unknown>:0
    I/Unity ( 2131): at Soomla.Store.StoreInventory.BuyItem (System.String itemId, System.String payload) [0x00000] in <filename unknown>:0
    I/Unity ( 2131): at Soomla.Store.StoreInventory.BuyItem (System.String itemId) [0x00000] in <filename unknown>:0 I/Unity ( 2131): at SIS.IAPManager.PurchaseProduct (System.String productId) [0x00000] in <filename unknown>:0 I/Unity ( 2131): at SIS.IAPItem.Purchase () [0x00000] in <filename unknown>:0
    I/Unity ( 2131): at UnityEngine.Events.InvokableCall.Invoke (System.Object[] args) [0x00000] in <filename unknown>:0
    I/Unity ( 2131): at UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters) [0x00000] in <filename unknown>:0
    I/Unity ( 2131): at UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters) [0x00000] in <filename unknown>:0
    I/Unity ( 2131): at UnityEngine.Events.UnityEvent.Invoke () [0x00000] in <filename unknown>:0
    I/Unity ( 2131): at UnityEngine.UI.Button.Press () [0x000

    I doublechecked everything and did some more tests but the price on the buy button still doesn't get updated and nothing happens when i press it.
    I'm obviously doing something wrong but can't figure it out.
    Any help would be greatly appreciated!
     
    Last edited: Feb 3, 2016
  48. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,171
    @ruigouveia
    Thanks for the log. There's an exception thrown by SOOMLA.KeyValueStorage which prevents a successful initialization. Do you uninstall the app on your device every time before deploying it again to clear all outdated app data?
     
  49. ruigouveia

    ruigouveia

    Joined:
    Feb 2, 2016
    Posts:
    3
    Hello again @Baroni ,

    I just figure it out! After you pointing out it was SOOMLA not initializing i did some more digging and it was my android Manifest that was wrong.
    I compared it with some SOOMLA android manifests in GitHub and it turns out it lacked BILLING permissions!
    Once again i thank you for your help:)
     
    Baroni likes this.
  50. kvuik

    kvuik

    Joined:
    Feb 23, 2016
    Posts:
    3
    Hi Baroni,
    i am trying to use the sis system but facing some troubles with the manual.
    the pdf contains description about each term but the integration process is not clear in it.
    it says to see the examples rather showing how to integrate a custom iap.
    so let me know the process,
    the getting started section is clear and i am able to do it.
    and from the next section the process is not described like getting started,
    so let me know how to create an new custom iap after getting started section clearly or else make a video to show how to create a custom iap(all types of iap like lifetime vg,virtual currency) from scratch like the getting started video.
    also let me know how can i know if the user made a purchase for each and every type of iap.