Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

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

    179 vote(s)
    86.9%
  2. Voxel Busters

    10 vote(s)
    4.9%
  3. Stans Assets

    13 vote(s)
    6.3%
  4. Prime31

    4 vote(s)
    1.9%
  1. habeeb2

    habeeb2

    Joined:
    Mar 20, 2019
    Posts:
    4
    Hi @Baroni
    Playfab cloud scripts is now legacy and not available for new users and instead azure functions are available for new users.
    Is there any update for integration of azure functions instead of legacy cloud scripts?
    Thanks
     
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    Hi @habeeb2, thanks for the heads-up. I'm going to upgrade the functions to Azure in the coming days and will include it in the next update. I can see I could use C# now, but have to setup my Azure account first. Let me know if you would like to receive the scripts prior to the next update, via private message, if you do not want to wait.
     
  3. habeeb2

    habeeb2

    Joined:
    Mar 20, 2019
    Posts:
    4
    @Baroni thank you, as always quick responses I greatly appreciate.
    Yes please it would be great :D.
     
  4. kygen007

    kygen007

    Joined:
    Feb 20, 2017
    Posts:
    8
    Thanks Dear, It's fixed on Playfab's...
    So do you have any sample JSON script syntax to upload on Steamworks?
     
  5. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
  6. TibiTibith

    TibiTibith

    Joined:
    Mar 8, 2015
    Posts:
    29
    This might be a dumb question, but where on Earth can I find the "License Key" for the Apple App Store tab in the Receipt Validator?
     
  7. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    Hi @TibiTibith,

    thanks for registering! Please use the support forum (link is bottom left when logged in) for Receipt Validator questions, to keep it all in one place.

    You can find instructions on the app store setup on the docs pages, here (start from the top):
    https://flobuk.gitlab.io/validator/docs/stores/appstore#license-key

    P.S. I can also see that your Google license key is wrong, you have to copy-paste it including the tags at the beginning and end. Recheck with the Google setup page as well.
     
    Last edited: Mar 31, 2022
  8. TibiTibith

    TibiTibith

    Joined:
    Mar 8, 2015
    Posts:
    29
    Thank you! I am so embarassed!

    Totally missed the specific documentation for the validation. It makes complete sense to have it seprated this way. I've been following along with it and all my questions have been answered. It's very neatly put together and quite up-to-date!

    Everything's been great so far for me otherwise! Thanks again!
     
  9. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    Thanks for the feedback! I'll add a link to the Docs on the main page too :)
     
  10. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    1,082
    Hello, my project is on Unity 2019.4. Which is the latest version compatible with Unity 2019?
     
  11. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    Hi newlife, the latest version is still technically compatible with Unity 2019, it has just been uploaded with Unity 2020 in preparation of Unity discontinuing 2019 within this quarter. You would want to download in 2020.3 and then import in 2019.
     
  12. newlife

    newlife

    Joined:
    Jan 20, 2010
    Posts:
    1,082
    What do you mean with unity discountinuing 2019 this quarter?
     
  13. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
  14. Ohz_fr

    Ohz_fr

    Joined:
    Jan 3, 2020
    Posts:
    22
    Hi! Said you could help me set up my API system! I want to create a metaverse! I thought about your asset for the API! The truck is that I want to monetize NFT tokens! An NFT token can be nimporte that she gameobject! But how to create a game object of a credit!
    And I want to create a map and I use Terrain grid systeme! I send you the doc! And two examples of code! ( One to extend is territory and one to display the cell’s no on the screen) I would like a scipt to be able to monetize its boxes, sell them and buy them with the single currency IAP System 2!
    And avoiding clicks but more commands >VR
    I know that she who can help me but he and the subscribers absant and I code like a chicken 4 meters high! If I succeed I offer you some ground in the mutlivers to appease you! ( Because I really need help!)
     

    Attached Files:

  15. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    Hello @RelitNadami, I have absolutely no clue what you are talking about. I guess you are using Google translate because most of your text does not make sense to me. It would be easier to answer if you could formulate a specific question about Simple IAP System.
     
  16. Ohz_fr

    Ohz_fr

    Joined:
    Jan 3, 2020
    Posts:
    22
    I would like to spend the currency to buy gameObject in VR. And sell a GameObject to get currency! Its would be for a square in a grid! The game object is the square.

    I’m more looking for a scipt! Which allows to buy and sell a box in currency (how to increase the value of currency for example in code)
     
    Last edited: Apr 18, 2022
  17. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    @RelitNadami ok, did you take a look at the Scripting Reference already?

    For selling a product, regardless of it being visible in game (as a game object) or not, you would just create a product in the Project Settings > Simple IAP System. In there you would define the virtual currency pricing for this product. Selling the product would then be done using a ShopItem component or manually via IAPManager.Purchase.

    For the other way around - sell a game object to get currency, you can just call DBManager.AddCurrency via code and handle the owner yourself. Optionally and depending on your needs, you can handle everything on your own and call other DBManager methods directly as well.
     
  18. eNm2

    eNm2

    Joined:
    Oct 28, 2017
    Posts:
    6
    hey Flobuk..

    i have a question..

    i have implemented SIAP in my project . Now I want to buy with an In-Game Currency (Coins) an other In-Game Currency (Diamonds).

    I set it up and it works. The only Problem is On the Buy Button the Price will not shown.
    If i Test it with real Money the Price which I set up before shown succesfully, only if i want to buy with an In-Game Currency it dont show the Price..
     
  19. Ohz_fr

    Ohz_fr

    Joined:
    Jan 3, 2020
    Posts:
    22
    There I understood! I need to add DBManager.AddCurrency in the listener!
    The problem is that I don't understand the inventory code! VR inventory!
    You never know if you can figure it out!
    This is "Slot" and a script attached to my inventory!
    ''Item'' to objects!
    ''CoreSlot''?

    In my API system in my shop I can call code
    I would like a code for in the code script that Adds the item info and the count to the ''Slot'' scipt but I don't understand how to make a code to add an Item

    It would happen in the script ''IAP Listener'' in this code it manages the purchases! When I buy it activates a piece of code.
     

    Attached Files:

  20. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    Hi @eNm2, you are probably using the same ShopItem prefab for both cases (real money and virtual currency purchase), however you should use a different one for each.

    If you have a look at a ShopItem prefab in the inspector (e.g. Simple IAP System > Prefabs > Vertical) and scroll to the bottom, you can see they have a "Cost Label" dropdown. For example, the "IGCItem" uses and displays the coins currency for its price, instead of real money.

    ---------------------
    Hi @RelitNadami, unfortunately writing custom code is out of support. Also, I do not know what platform you are using, what a "VR inventory" should be, or any other of your terms "Slot" "Item" "CoreSlot". This is something specific to your app. The Scripting Reference and documentation has public methods to achieve nearly everything, but I am unable to teach how to use it in your app.
     
  21. eNm2

    eNm2

    Joined:
    Oct 28, 2017
    Posts:
    6
    thank you for the very fast reply..
    now it works very well :)
     
  22. Ohz_fr

    Ohz_fr

    Joined:
    Jan 3, 2020
    Posts:
    22
    Thank you ! In listener it is a function that must be called at "case"!
     
  23. Meet2play

    Meet2play

    Joined:
    Feb 14, 2020
    Posts:
    9
    hey, I'm very much interested in this asset and I wanna purchase it for my app, but before that I have some questions, I'm using Playfab in my game and I've created a virtual currency system in my game for both iOS and android, do I need to publish my app to both AppStore and google play for this to work? do I need any other third party? and when a player purchase an item with the amount of money used shows in Playfab dashboard I mean will the purchases be stored? and how can I connect virtual currency to real money?? so many questions I know lol sorry about that but I need answers.
     
  24. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    Hi there, thanks for your interest!

    Could you explain, for what to work? I'm not sure what you mean, since publishing to App Stores is a logical step that is done at the end of development (or already when testing).

    If you're using PlayFab for iOS and Android, it is likely that you will also want to support native platform logins using "Login With Apple" or the Google Play Games SDK. Simple IAP System works without them and uses anonymous sign-in, but it's better to integrate native logins too.

    Yes, since Simple IAP System communicates the purchase with PlayFab - it uses the PlayFab SDK after all - you can see the purchase and player history in the dashboard.

    When specifying the product in Simple IAP System, you have to define whether it should cost real money or virtual currency. You can then upload the product definitions in JSON format to PlayFab, where the same information is required. This is also described in my PlayFab guide, store catalog section.
     
  25. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,273
    @Baroni

    I upgraded my project from Unity 2019 to 2021 LTS I updated simple IAP to the latest from asset store and when I try to build for Android I get these errors:

    Any idea what the issue could be? I Updated UnityIAP to latest version also but it didn't fix the issue.
     
  26. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    The errors are coming from missing Unity IAP local validation files. To fix them, you have to click "Services > In App Purchasing > Receipt Validation Obfuscator > Obfuscate ..." button. You do not have to enter anything in the Google Play license key field, if you are not using local validation. If you are not using server-side validation at all, you can also just delete the script.

    The code line should actually contain a platform define, I am sorry for missing that.
     
    derkoi likes this.
  27. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,273
    Thanks. Seems to be building now.
     
  28. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    36
    Hello Flobuk.

    Today i setup SIS (currency system) with google play save game services for save and load coins value from google cloud . And I had tested this works fine.
    I attached the screenshot here of my (savegame) script .
    Simply i use Text variable and i has used this Text variable in both scripts (Currency Container) And (savegame) script.
    And in savegame script this Text variable stores and loads the value from google cloud .

    But i need some help from you .
    How can i save and load the Non Consumable items like Purchase weapons or vehicles in game coins not real money.
     

    Attached Files:

  29. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    Hi @ishangill,

    similar to the DBManager.SetCurrency method there are methods to receive and write purchase data from and to the DBManager. For example you could use the GetAllPurchased method to get a list of all owned products, without quantity, and save them to the cloud. When downloading them, use SetPurchase.

    Note that the DBManager also provides methods to read its full data as string, so you actually do not have to do this for each product or currency manually. Read method to upload, Overwrite method on download.
     
  30. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    36
    Hello thanks for reply.
    Can you the screenshot of 2 line of code . Because with the help of screenshot, I will easily setup my code in proper way.
     
  31. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    36
    Sorry mistake in above message can (send) the screenshot of code.
     
  32. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    @ishangill I'm not sure why you are mentioning a screenshot - yours or should I take one? If you keep your methods, it's really just one line in there. Like the following:

    Code (CSharp):
    1. void DowloadFromCloud(string dataIn)
    2. {
    3.    //dataIn = your downloaded cloud data as string
    4.    DBManager.Overwrite(dataIn);
    5. }
    6.  
    7. void SaveToCloud()
    8. {
    9.    string dataOut = DBManager.Read();
    10.    //call your custom method / plugin code to upload the dataOut string
    11. }
     
  33. ishangill

    ishangill

    Joined:
    Nov 28, 2017
    Posts:
    36
  34. P1M2

    P1M2

    Joined:
    Jul 5, 2021
    Posts:
    4
    Hi Baroni, I buyed your asset, but I am with some problems, I use with PlayFab, sometimes the products are all lost when in editor, what can be? IAPSettings lost all their config...
    Other problem that I am facing is the translation, how can I do to get the ItemPrefab translated when the products are instantiated?

    Thanks.
     
  35. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    Hi @unity_ZbHKse8nLs_QCA, sorry for the delayed response as I am currently travelling. Could you please mention what Unity version you are using and steps to reproduce the lost settings? I have heard of this issue but couldn't reproduce it yet.

    Regarding translations, PlayFab does not support them. Without PlayFab you would just enable "Fetch" on the product in Simple IAP System and specify the translations in the App Store for your product. But with PlayFab you'll have to do it manually using a custom script and e.g. reading out the ShopItems product ID after instantiation.
     
  36. P1M2

    P1M2

    Joined:
    Jul 5, 2021
    Posts:
    4
    I use the version 2020.3.34.f1, I don't know exactly how to reproduce, but at a moment when I play in editor the products disappear. Thanks for your support
     
  37. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    So when in the editor (not at runtime), the products exist in the Project Settings? But at runtime they are cleared? On the IAPManager prefab in your scene, could you try to remove the IAPSettings object and re-assign it from the project.
     
  38. P1M2

    P1M2

    Joined:
    Jul 5, 2021
    Posts:
    4
    Exactly this, I don't know why but the problem was solved, I believe that I did what you said, thanks and sorry for late response.
     
  39. P1M2

    P1M2

    Joined:
    Jul 5, 2021
    Posts:
    4
    I have a new question about prices with PlayFab, I use diferent prices for diferent countries, how can I do to setup this? I read about RealCurrencyPrice propertie on PlayFab, but I cant find this on the asset. Can you help-me? Thanks.
     
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    @unity_ZbHKse8nLs_QCA Yes, PlayFab allows entering multiple currencies as RealCurrencyPrice values. However this is basically just a list of currencies. Simple IAP System only uses the RM (real money dollar) value, since it cannot not know the language or currency you would like to use.

    If you are developing for mobile, you would typically enter the prices for different countries in the App Store. This is the place that counts - PlayFab does not have control over your IAP prices. And if users press on the buy button, they would see the localized prices in the popup.
     
  41. scrant

    scrant

    Joined:
    Jun 1, 2017
    Posts:
    73
    Hi, is there any intention to support the native Unity Economy system (now in beta)? Basically, Unity's native version of something like Playfab that allows you to create currencies, inventory management, purchases, etc.
     
  42. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    Hi @scrant, thanks for the suggestion. Unity Gaming Services is on my research list. However at its current state, it fails on so many points to even consider adding it anytime soon:
    - the overall pricing is a lot more expensive than PlayFab's
    - economy pricing is 14x more expensive than cloud save, only Unity knows why
    - you have to start with Authentication, where documentation is outdated already. For example, their linked "Sign In with Apple" plugin is deprecated, and for Google they use an older version because the latest does not work.

    Is there anything specific you are looking for that PlayFab does not support, or are you actively considering adding Unity Gaming Services to your app - and have you tried implementing it yet?
     
  43. makaka-org

    makaka-org

    Joined:
    Dec 1, 2013
    Posts:
    1,093
    Hi, am old user of SIS. If you remember, we have a large discussion about subscription & server-side verification on your own local forum. Since the forum doesn't exist, I post here.

    So I have your server-side verification script (php) on my hosting and the related script in the app.
    For now, I am migrating from 4.3.6 > 4.3.7 > 5.1.1.

    In your release notes for v5.0, I can see the next message: "removed public support for server-side validation, as there is a new service planned for this later this year. If you've used it before, see the updated C# file on the support forum"

    So, how can I get an updated C#/php files?
     
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    Hi @makaka-org, this is the correct place to ask. The old server validation files were available on the forum until it was shut down at the end of last year.

    The new validation service was launched in March, featuring not only "validate-and-forget" but also checking for transactions being unique and user inventory with subscription expiration. This service replaces the old approach. It has a free plan too and dedicated ticket support. Maybe you would like to give it a try. There is a new ReceiptValidatorServer script in Simple IAP System for making use of it.
     
  45. makaka-org

    makaka-org

    Joined:
    Dec 1, 2013
    Posts:
    1,093
    How to update these lines from v4.3.7:
    • IAPManager.GetIAPObject(id)?.virtualPrice.name
    • IAPManager.GetIAPObject(id)?.virtualPrice.amount
    • IAPManager.GetIAPObjectGroupName(id)
     
  46. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    • IAPManager.GetIAPObject(id)?.virtualPrice.name, IAPManager.GetIAPObject(id)?.virtualPrice.amount
    IAPManager.GetIAPProduct(id).priceList is a list of IAPExchangeObject. If you've specified virtual currency prices, you can access IAPExchangeObject.currency.ID and IAPExchangeObject.amount.
    • IAPManager.GetIAPObjectGroupName(id)
    IAPManager.GetIAPProduct(id).category.ID
     
  47. makaka-org

    makaka-org

    Joined:
    Dec 1, 2013
    Posts:
    1,093
    and what about this? IAPManager.GetProductCategoryName(id).
     
  48. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    You can use that too, it's the same.
     
    makaka-org likes this.
  49. makaka-org

    makaka-org

    Joined:
    Dec 1, 2013
    Posts:
    1,093
    The docs say: "If you have imported Simple IAP System in a new project, the Package Status check will show NOT OK."

    However, when I import in new project, I can't see SIS tab in project settings, because there is an error until I import Unity IAP package: "Assets/SimpleIAPSystem/Scripts/ReceiptValidatorServer.cs(16,19): error CS0234: The type or namespace name 'Purchasing' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)"
     
    Last edited: Jul 11, 2022
  50. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,299
    @makaka-org Thanks for the report, I already fixed this in the upcoming update. The Purchasing namespace in the ReceiptValidatorServer script should be wrapped in a SIS_IAP define too.