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

    SuperDuperPooperGames

    Joined:
    Sep 28, 2017
    Posts:
    47
    I'm using SIAP ver 1 Latest 4.3.7). It gives the following 2 errors and thus the unity game will not work.
    ======================================================
    Assets\SimpleIAPSystem\Scripts\IAPManager.cs(185,39): error CS0246: The type or namespace name 'ISamsungAppsConfiguration' could not be found (are you missing a using directive or an assembly reference?)

    Assets\SimpleIAPSystem\Scripts\IAPManager.cs(185,76): error CS0103: The name 'SamsungAppsMode' does not exist in the current context
    ========================================================
    The errors point to this line. If I comment this line out then the errors go away. Will this mess anything up? Is it OK to do this? if not, then can we get a quick update for the plugin to work? I will upgrade to version 2 at some point, but for now just want the games to load without errors.

    // Enable "developer mode" for purchases, not requiring real-world money
    builder.Configure<ISamsungAppsConfiguration>().SetMode(SamsungAppsMode.AlwaysSucceed);
     
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    @SlifkerGames You are using Unity IAP 4.x which removed support for Samsung Apps. That happened after SIS 4.3.7 was released, so the change was not included. You can remove or comment out these lines without breaking anything.
     
  3. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    Last edited: Oct 18, 2021
  4. scrant

    scrant

    Joined:
    Jun 1, 2017
    Posts:
    73
    Thanks @Baroni for the update. Yes a guide on doing this would be great. To be more clear, yes we would of course be creating new items (assets) in Unity which will have models, code, etc and we will be putting them in asset bundles which will be ingested from our existing code base. This is a separate process (and person) in our pipeline than someone going into Playfab and making the entry for the product, it's identifier etc. We then don't want that person having to go in and modify a Unity project (the project settings for SIS) to then add the same information that was just entered in Playfab. We want like a sync or at least a download of Playfab catalog to Unity either at runtime or as a process we can run in Editor. I know you can update a product price for a sale automatically but what about syncing newly added products. Or am I missing something here? Thanks much.
     
  5. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    Hi @justtime, thanks for the request! I added 1) in my dev branch. However for 2) I do not see the need, could you elaborate? The default setting of this option is "true" (purchases returned at initialization) as before.

    @scrant Thanks for the response! Including models dynamically via asset bundles makes sense. However, code or any executing scripts are not allowed to be put into asset bundles, so you would still need an app update for that.

    Downloading at runtime may be a bit difficult, as the user would have to be authenticated before calling PlayFab APIs to get the catalog, and this is a process already integrated in the IAP initialization. I'll write the guide for downloading a server configuration with all product identifiers, as that would be more flexible when using other services or your own server.

    The issue with that is that some developers would like to have the single source of truth in Unity, adding and removing products in PlayFab or the App Stores having no effect, while others would like to only maintain the products in e.g. PlayFab. Unfortunately a "just add missing products" checkbox in Unity would not work out for all cases, as it is a bit more complicated than that and also depends on the game.

    Maybe I can still include instructions for both ways in the guide. I will provide an update for you this week.
     
    Last edited: Oct 20, 2021
  6. derkoi

    derkoi

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

    Any chance we can get better documentation for Steam IAP consumables without using Playfab please?

    This video:
    is very hard to follow, has no sound.

    Thanks
     
  7. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    Hi @derkoi, the video was actually recorded for another customer. I included it on the Steam guide for convenience, but it is not listed on YouTube on purpose. Basically besides setting up your app and products in Steam, when not using PlayFab all you need to do is to enable the checkbox shown at 2:00 in the video + select Steam native in SIS.

    The rest of the video is really only shown to cover everything, but is not related to SIS at all - just general Steam setup you would do for every package as well. Is there anything specific you are looking for in a separate guide?
     
  8. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Thanks for the reply.

    I'm a little confused by the Item Definitions in Steam and the Store ID in the Product override in Simple IAP. Is that the itemdefid in the Steam Item Definition?

    Also, is there anything specific for a consumable item (coin pack) on Steam or do i just set it up as an item?
     
  9. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    Yes, ITEM DEF ID is your product identifier. These are usually numbers. You do not have to use overrides if you are only publishing to Steam.

    Nope, nothing special. Non-/consumables are both of type "item". You define what happens with the product in SIS after it is consumed.
     
  10. SuperDuperPooperGames

    SuperDuperPooperGames

    Joined:
    Sep 28, 2017
    Posts:
    47
    I have SIAP version 1 latest with latest unity 2021.1.26. I just upgraded t it. I found that under the IAP manager that now there is no place for the google key. In the past the google play store key was pasted here for IAP. Where did this go or what am I doing wrong?
     
  11. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
  12. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    349
    After months that my SIMPLE IAP worked great (4.3.0 with Unity IAP 3.0.2), suddenly I get payment declined. I tried upgrading to 4.3.7 but getting the same error. I use PayPal with playfab. Unity 2020.3.8f1. I get this on the IAP Status:
    upload_2021-10-24_14-2-17.png

    Unity IAP is on but I don't use Google so never gia a Key there:

    upload_2021-10-24_14-2-48.png
    I have set my title ID on playfabsharedsettings.

    The messages I get are:

    Log:
    1)
    purchase(1_month_sub)
    UnityEngine.Purchasing.PurchasingManager:InitiatePurchase (UnityEngine.Purchasing.Product)
    SIS.IAPManager:purchaseProduct (string) (at Assets/SimpleIAPSystem/Scripts/IAPManager.cs:366)
    SIS.IAPItem:purchase () (at Assets/SimpleIAPSystem/Scripts/IAPItem.cs:258)
    UnityEngine.EventSystems.EventSystem:Update () (at C:/Program Files/Unity/Hub/Editor/2020.3.8f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:385)


    2)
    IAPManager reports: PurchaseFailed. Error: PaymentDeclined
    UnityEngine.Debug:Log (object)
    SIS.IAPManager:OnPurchaseFailed (UnityEngine.Purchasing.Product,UnityEngine.Purchasing.PurchaseFailureReason) (at Assets/SimpleIAPSystem/Scripts/IAPManager.cs:572)
    UnityEngine.Purchasing.PurchasingManager:OnPurchaseFailed (UnityEngine.Purchasing.Extension.PurchaseFailureDescription)
    SIS.PlayfabStore:OnPurchaseFailed (PlayFab.PlayFabError) (at Assets/SimpleIAPSystem/Scripts/Extensions/PlayFab/PlayfabStore.cs:349)
    PlayFab.Internal.PlayFabUnityHttp:OnResponse (string,PlayFab.Internal.CallRequestContainer) (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:260)
    PlayFab.Internal.PlayFabUnityHttp/<Post>d__12:MoveNext () (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:190)
    UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)

    Warning (I think I always got that and it worked anyway):

    The header Accept-Encoding is managed automatically, setting it may have no effect or result in unexpected behavior.
    UnityEngine.Networking.UnityWebRequest:SetRequestHeader (string,string)
    PlayFab.Internal.PlayFabUnityHttp/<Post>d__12:MoveNext () (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:139)
    UnityEngine.MonoBehaviour:StartCoroutine (System.Collections.IEnumerator)
    PlayFab.Internal.PlayFabUnityHttp:MakeApiCall (object) (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:119)
    PlayFab.Internal.PlayFabHttp:_MakeApiCall<PlayFab.ClientModels.PayForPurchaseResult> (string,string,PlayFab.SharedModels.PlayFabRequestCommon,PlayFab.Internal.AuthType,System.Action`1<PlayFab.ClientModels.PayForPurchaseResult>,System.Action`1<PlayFab.PlayFabError>,object,System.Collections.Generic.Dictionary`2<string, string>,bool,PlayFab.PlayFabAuthenticationContext,PlayFab.PlayFabApiSettings,PlayFab.SharedModels.IPlayFabInstanceApi) (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabHTTP.cs:228)
    PlayFab.Internal.PlayFabHttp:MakeApiCall<PlayFab.ClientModels.PayForPurchaseResult> (string,PlayFab.SharedModels.PlayFabRequestCommon,PlayFab.Internal.AuthType,System.Action`1<PlayFab.ClientModels.PayForPurchaseResult>,System.Action`1<PlayFab.PlayFabError>,object,System.Collections.Generic.Dictionary`2<string, string>,PlayFab.PlayFabAuthenticationContext,PlayFab.PlayFabApiSettings,PlayFab.SharedModels.IPlayFabInstanceApi) (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabHTTP.cs:133)
    PlayFab.PlayFabClientAPI:payForPurchase (PlayFab.ClientModels.PayForPurchaseRequest,System.Action`1<PlayFab.ClientModels.PayForPurchaseResult>,System.Action`1<PlayFab.PlayFabError>,object,System.Collections.Generic.Dictionary`2<string, string>) (at Assets/PlayFabSDK/Client/PlayFabClientAPI.cs:1550)
    SIS.PlayfabStore:OnPurchaseStarted (PlayFab.ClientModels.StartPurchaseResult) (at Assets/SimpleIAPSystem/Scripts/Extensions/PlayFab/PlayfabStore.cs:192)
    PlayFab.Internal.PlayFabHttp/<>c__DisplayClass23_0`1<PlayFab.ClientModels.StartPurchaseResult>:<_MakeApiCall>b__1 () (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabHTTP.cs:215)
    PlayFab.Internal.PlayFabUnityHttp:OnResponse (string,PlayFab.Internal.CallRequestContainer) (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:247)
    PlayFab.Internal.PlayFabUnityHttp/<Post>d__12:MoveNext () (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:190)
    UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)


    updating to 4.3.7 removes the NOT OK errors but still getting the same payment declined



    any help would be appreciated.
     
    Last edited: Oct 24, 2021
  13. SuperDuperPooperGames

    SuperDuperPooperGames

    Joined:
    Sep 28, 2017
    Posts:
    47
    So am I to understand that if I publish an app to google play store it will automatically know this? Also, there are some apps I have that still have the field to pass the key into. What's up with that? In the settings filed it asks for a key. It says I do not have permission to change it (There is none there). Is this where the key comes from?
     
  14. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    I am sorry for the delay @scrant, I spent two days optimizing my build pipeline to get out tutorials quicker... I have added a page in the How-To section, please provide feedback if this is what you were looking for. Thanks!

    @SlifkerGames I can only speak for Unity IAP and SIS, and there it is not necessary since Google does the signing already. I do not know what "settings field" you mean or what permissions you are talking about.

    @SSL7 I saw that you asked here as well, so I guess the Google Key thing should be solved. Regarding "payment declined", this is a very generic message coming from PlayFab. Simple IAP System is just displaying it, but there is no further information that can be retrieved, meaning that I am not able to provide a solution either.

    If the SIS Setup window shows PlayFab + PayPal still enabled, then everything is fine. Did you check your bundle identifier, product identifiers and Paypal permissions + setup in PlayFab again? It's maybe worth going over the PlayFab + PayPal guide on my docs pages and re-checking all settings just in case. If you are sure that everything is setup correctly, you would have to ask PlayFab for more details on that message.
     
  15. scrant

    scrant

    Joined:
    Jun 1, 2017
    Posts:
    73
    Thanks @Baroni for the guide. Will take a look this week and get back to you. Much appreciated!
     
  16. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    349

    It was a PlayFab issue (still is), they have changed something on their backend and the PlayerID is not sent to paypal for the express checkout. The good news is that they achnoledged the issue and they are on it.
     
    Baroni likes this.
  17. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    Perfect, let me know if there is something that requires a change in Simple IAP System (i.e. PlayFab API change).
     
    SSL7 likes this.
  18. scrant

    scrant

    Joined:
    Jun 1, 2017
    Posts:
    73
    Thank you @Baroni for the guide. Finally was able to get back to this. Very helpful! And just FYI.. the code to accept new items is already in our codebase via addressables. We are adding similar items that don't require new code so this should all work. Once I implement, I'll let you know how it turns out.
     
    Baroni likes this.
  19. musicdeveloper

    musicdeveloper

    Joined:
    Oct 16, 2019
    Posts:
    68
    The issue with Playfab / PayPal has severely crippled my app for the last few weeks - Windows payments broke completely unexpectedly 10 days ago without any app updates or changes.

    I switched over to using the new direct payment to PayPal system in Simple IAP 2, which avoids the Playfab issue. The direct PayPal payments work perfectly on all my testing devices, and also for some users.

    However, it appears the majority of users receive a "PurchasingUnavailable" message, which I am completely unable to replicate.

    I have contacted PayPal directly and confirmed that international currency conversion is correctly set up and there are no issues of any kind with my account. Any thoughts on what could be wrong or what could fix?

    Thank you
     
    Last edited: Nov 3, 2021
  20. Kapteeni-Studios

    Kapteeni-Studios

    Joined:
    Apr 5, 2014
    Posts:
    39
    Hi Baroni,

    I have one question. Lots of players buy lots of things and then refund them all because they get to keep the items and virtual currency. I was wondering if someone purchases an item that is Not Consumable and then they Refund that same item. Will the SIS DBManager.IsPurchased("example") still return True? Or does Unity IAP and then Simple IAP System somehow change this status to False?

    Or lets say the same player deletes the game, then re-installs it. Is Unity IAP (or Google Play) going to give the players the items that have been refunded same way that it normally does with previously purchased items that were purchased and not refunded?

    From Google Play I can see the exact time and date the item that was purchased before it was refunded. From my events I can then identify that player that has refunded these items. I could check this and remove the items in the game from this player, but how could I change the DBManager.IsPurchased to a state where it is not Purchased? How could I "reset" the state as it was so that when the game checks DBManager.IsPurchased("example") it will return False and not give the item that was refunded anymore.
     
  21. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    @musicdeveloper I am sorry to hear you are experiencing this issue. The "PurchasingUnavailable" log is coming from Unity IAP not being able to complete initialization, which is actually before any PayPal interaction takes place. Are you sure this is the correct message, or is it ""Billing is not available." when trying to purchase a product? The cause would still be in the Unity IAP initialization though, where I would also need more information to reproduce, unfortunately.
     
  22. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    Hi @Kapteeni-Studios, in general, refunds are issued by Google Play for first- or non-abusing players within 48 hours after purchase. Requesting refunds too often, or always, will notify Google Play's abuse system and it will decline the request. With that said, there are different ways to handle it within your app, but answering your questions:

    For consumable purchases, without using a server or cloud provider to store currency balances (e.g. like PlayFab), there is no way to remove currency from a player in your app, since the product is consumed and SIS will not be notified anymore.

    The default behavior is yes, it will not remove the item. The reason for this is in the Google Play abuse system I mentioned above. If you are experiencing a very high abuse rate, or would like to handle this is a different way (removing the product), you can loop over your products on IAPManager.controller.products.all and check their hasReceipt method. If DBManager.IsPurchased returns true, but hasReceipt returns false, you may want to call DBManager.ConsumePurchase.

    Another way would be to use a server to always retrieve the current states of a product or subscription and access this data at app launch. I am currently working on a platform supporting this, with the goal that developers like you (and me) would not need to maintain their own servers. It is not designed for consumables since I do not store currency balances anywhere, but primarily for non-consumables and subscription purchase/renewal/cancellation/expiration.

    No. After reinstalling the app, only active entitlements are returned to Unity IAP and processed by Simple IAP System. Deleting the game clears the DBManager storage, so it will not get the refunded product anymore.

    Hopefully explained above in the DBManager.ConsumePurchase part :)
     
    Kapteeni-Studios likes this.
  23. Kapteeni-Studios

    Kapteeni-Studios

    Joined:
    Apr 5, 2014
    Posts:
    39
    Yes there is currently very high abuse rate. My IAP revenue in Google Play console is at times negative because of the refunds. Could you please let me know how to write this in C#?

    I'm looking at these:

    https://flobuk.gitlab.io/assets/docs/sis/api/IAPManager.html
    https://flobuk.gitlab.io/assets/docs/sis/api/DBManager.html

    But how do I write the C# code that loops all of the products, checks if IsPurchased is true & hasReceipt is false, and then CunsumePurchase those items?
     
  24. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    @Kapteeni-Studios There's really nothing else to it. Except maybe you would want to skip consumable products.

    Code (CSharp):
    1. foreach(Product p in IAPManager.controller.products.all)
    2. {
    3.   if(p.definition.type == ProductType.Consumable)
    4.      continue;
    5.  
    6.   if(DBManager.IsPurchased(p.definition.id) && !p.hasReceipt())
    7.      DBManager.ConsumePurchase(p.definition.id);
    8. }
     
    Kapteeni-Studios likes this.
  25. musicdeveloper

    musicdeveloper

    Joined:
    Oct 16, 2019
    Posts:
    68
    That is the message the users send screenshots of. Strangely, users don’t have any errors in their logs when I ask them to send those. It’s all bizarre.

    Can I send you a simple repro project for my apps purchasing? Maybe if it doesn’t work for you, you’d be able to use this to debug whatever might be wrong with this new feature? How thoroughly has the new PayPal store feature been tested?

    Thank you
     
  26. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    We can start with a compiled app, the same your users are trying to run. You can send me a PM with the download link. If I am unable to experience the issue in the compiled app, it is unlikely that I will find the cause in the project.

    I mean, I cannot test it on all countries and all potential operating system configurations, but if it works, it works :) As I said, the error seems to be before even contacting PayPal.
     
  27. musicdeveloper

    musicdeveloper

    Joined:
    Oct 16, 2019
    Posts:
    68
    I understand what you're saying - however I think we can both agree it's strange that it works perfectly on all my testing devices, but does not work for most users - so something slightly unusual is happening, and it isn't a binary situation of either working or not working here.

    You should be able to do that form of testing with the publicly available build - https://www.dropbox.com/s/x7yok4m8j5rorfz/SeeMusic Windows 4.3.2.exe?dl=1

    You don't need to complete the purchase - just make a free account and click the upgrade link - if the PayPal webpage opens, it's working.

    Thank you
     
  28. scrant

    scrant

    Joined:
    Jun 1, 2017
    Posts:
    73
    Hi again @Baroni wondering if in the guide you made for downloading the catalog from PlayFab if it is also possible for it to also get the icon thumbnail image? Meaning, is this data returned as part of a CatalogItem that can be assigned to an IAPProduct?
     
  29. Kapteeni-Studios

    Kapteeni-Studios

    Joined:
    Apr 5, 2014
    Posts:
    39
    Thank you!

    I still need some help with the code. I get error: "error CS0246: The type or namespace name 'Product' could not be found (are you missing a using directive or an assembly reference?)"

    I have using SIS; in the beginning.
     
  30. scrant

    scrant

    Joined:
    Jun 1, 2017
    Posts:
    73
    Also, @Baroni the sample scenes seem to use just a email/password combo. What if we need to use email/password to login but also have a unique username/displayname? Would that be modifying the PlayfabManager RegisterAccount method and changing RequireBothUsernameAndEmail to true? And then what if they want to login using their unique username instead of email? Would we need to call LoginWithPlayfab or something similar? We ultimately want them signing up with email/password but also choosing a unique username during registration to be used in-game. Thanks!
     
  31. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    I didn't mean it that way, it was directed at my testing. I am getting the "PurchasingUnavailable" error in the build too. If you could send me a very small repro project in PM for this, I will investigate the Unity IAP initialization flow and switch out your PayPal credentials to see if that makes a difference.

    You can find the namespace you have to import on this official page, right under the class name.

    Hi there, in the PlayFab catalog you have the option to set an url for the icon, so in Unity you would first need to download the image, convert it to a Sprite and then assign it to the IAPProduct. You could use an approach as described here for this.

    As per documentation, I would say so, yes. I'm not sure about username uniquess though, you will want to check more resources on the PlayFab forum to verify that.

    Yes, LoginWithPlayFab. Due to the nature of sample scenes, they are just an example - you should use your own login scene and UILogin script instead of the ones provided in SIS. You would then implement your requirement i.e. a "Login" and "Have an account already?" screen in there. You can even add other login methods as well, just make sure to call PlayFabManager.OnLoggedIn with the login result at the end to establish the connection back to SIS.
     
  32. Kapteeni-Studios

    Kapteeni-Studios

    Joined:
    Apr 5, 2014
    Posts:
    39
    This gives me error:

    Non-invocable member 'Product.hasReceipt' cannot be used like a method.

    So I removed the () from hasReceipt.

    Code (CSharp):
    1.         foreach(Product p in IAPManager.controller.products.all)
    2.         {
    3.             if(p.definition.type == ProductType.Consumable)
    4.                 continue;
    5.             if(DBManager.IsPurchased(p.definition.id) && !p.hasReceipt)
    6.                 DBManager.ConsumePurchase(p.definition.id);
    7.         }
    Now it's not giving me error. I hope this is still OK?

    I now have this code in the game:

    Code (CSharp):
    1.         foreach(Product p in IAPManager.controller.products.all)
    2.         {
    3.             if(p.definition.type == ProductType.Consumable)
    4.             {
    5.                 if(DBManager.IsPurchased(p.definition.id) && !p.hasReceipt)
    6.                 {
    7.                     Debug.Log("Detected: Refunded Consumable.");
    8.                 }
    9.             }
    10.             else
    11.             {
    12.                 if(DBManager.IsPurchased(p.definition.id) && !p.hasReceipt)
    13.                 {
    14.                     Debug.Log("Detected: Refunded Non Consumable. ConsumePurchase Item.");
    15.                     DBManager.ConsumePurchase(p.definition.id);
    16.                 }
    17.             }
    18.         }
    Everytime I run the game in the editor this code removes (ConsumePurchase) all IAP Purchases. I think the hasReceipt returns false in editor.

    I'm now going to send this to Google Play next and try it on my device. When I do test purchase on my device it's not going to actually charge anything, because it's test of course. But I wonder if the state of these test purchases will be in the "refunded state" and will the hasReceipt therefore return false.

    You know, when you look at the data from Google Play App and do a test purchase in it, it's like this: Order Recieved, Succesfully charget for EUR 0.00 and right after this: A refund was initiated, user was refunded.

    I need to be really careful here so that my customers that have not refunded anything are going to be safe. In worst-case scenario I quess they could purchase the items again and Google would say that the item is already paid, but that would cause lots of problems.
     
  33. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    Sure, didn't notice it's a property, not a method.

    This check is unnecessary and inconsistent, see the note on hasReceipt regarding consumable receipts.

    There are no receipts in the editor since you do not actually buy something.

    Correct, you will want to test this thoroughly on sandbox using a real device. Non-consumable purchases keep their receipt, even in sandbox, so you can test the refund process without problems. The product should stay purchased after several app restarts, until you cancel the purchase in the Google Play developer dashboard. The product removal in your app could be delayed by a few hours because of the caching Google does.
     
  34. Kapteeni-Studios

    Kapteeni-Studios

    Joined:
    Apr 5, 2014
    Posts:
    39
    Yep, my bad. I was just trying to send an event to my server to detect players who have refunded consumables as well.

    I followed your instructions and everything worked! :) Thank you.

    In the Google Play console there was this checkbox.

    "Remove entitlement: Choose whether to remove the customer’s access to the product or subscription after the refund has been issued."

    I wonder when real player has refunded something, is this Remove entitlement on by default? I looked recent real Refund and couldn't find any checkbox.

    BTW does the hasReceipt and this work on iOS & Apple App Store as well?
     
  35. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    I could not find any concrete details by Google on that matter either. It's a bit hidden, but other users report that this is the case. You may want to follow up with Google for clarification.

    There were reports that it is not ensured a Product always has a receipt, even if it is purchased, between app restarts or the user requesting its receipts again (calling restore transactions) on iOS. I would not rely on it on that platform. You would actually need server-side validation for refunds on iOS, at least until StoreKit 2 comes out or Unity IAP adding support for a StoreKit call directly.
     
    Kapteeni-Studios likes this.
  36. musicdeveloper

    musicdeveloper

    Joined:
    Oct 16, 2019
    Posts:
    68
    I've sent you a Repro project via DM. Would sincerely appreciate it if you have a chance to look at it very soon, as purchases remain broken in my app from the PlayFab PayPal breakdown, and both myself and my users are truly desperate for a solution.

    Thank you!
     
  37. sgrinnovation

    sgrinnovation

    Joined:
    Oct 15, 2020
    Posts:
    5
    Hi Baroni,
    I am working on my game to publish on Facebook Web Games platform. Can you kindly provide me the latest information on how to integrate Simple IAP System with Facebook & PlayFab.
    Thank you.
     
  38. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    Hi @sgrinnovation,

    since Unity removed the Facebook build target, Facebook is kind of in an experimental state right now, with neither parties (Unity nor PlayFab) supporting it that well. I would recommend thinking about deploying to Facebook one more time, as it really is a hassle to get it working and maintain. It is a dying platform.

    Did you know that it is not even possible anymore to create new app IDs? See this post:
    https://www.facebook.com/fbgaminghome/blog/important-changes-to-gameroom-and-web-games-on-facebook

    Can a developer:
    Create a new App ID and configure it for Web Games on Facebook (or Gameroom)?
    After June 30, 2021 - NO
     
  39. Gathering_Storm_Studio

    Gathering_Storm_Studio

    Joined:
    May 30, 2018
    Posts:
    8
    Error : PlayFab.PlayFabClientAPI.GetCatalogItems

    I saw you touched on this issue earlier in the thread which I have extensively combed through. However, the error still doesn't go away. I am currently trying to get Steam connected with Playfab working. I have gone through every setup systematically. Even if turn off validation only on the Playfab manager then try to login from the login screen it says there is no account with that. I have already put the game ID in and so on from playfab. What would you recommend in narrowing this error field down?
     
  40. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    Hi @Gathering_Storm_Studio, thanks for posting here!

    Could you please let me know the script and line the error is coming from? I assume it's the PlayFabStore class, and if so, which line in the OnCatalogRetrieved method?

    A few remarks:
    You definitely want to keep the "Validation Only" checkbox disabled. When using and running the game via Steam (starting it from the Steam app), there is no need to do any login since the Steam authentification token is passed to PlayFab. Coming from the UserLogin sample sene, you would be automatically signed in and directed to the SceneSelection scene. Did you add the SteamManager to the UserLogin scene?

    You mean that, even without SteamManager and doing a manual login using email and password (after creating it via the "Register" button), you are not able to log in with PlayFab? The GetCatalogItems error should actually happen after a login, so maybe it gets stuck there.
     
  41. Gathering_Storm_Studio

    Gathering_Storm_Studio

    Joined:
    May 30, 2018
    Posts:
    8
    PlayFabException: Must be logged in to call this method
    PlayFab.PlayFabClientAPI.GetCatalogItems (PlayFab.ClientModels.GetCatalogItemsRequest request, System.Action`1[T] resultCallback, System.Action`1[T] errorCallback, System.Object customData, System.Collections.Generic.Dictionary`2[TKey,TValue] extraHeaders) (at Assets/PlayFabSDK/Client/PlayFabClientAPI.cs:357)
    SIS.PlayFabStore.RetrieveProducts (System.Collections.ObjectModel.ReadOnlyCollection`1[T] products) (at Assets/SimpleIAPSystem/Scripts/Extensions/PlayFab/PlayFabStore.cs:108)
    UnityEngine.Purchasing.PurchasingManager.Initialize (UnityEngine.Purchasing.IInternalStoreListener listener, System.Collections.Generic.HashSet`1[T] products) (at Library/PackageCache/com.unity.purchasing@2.2.2/Runtime/managed/Purchasing/PurchasingManager.cs:319)
    UnityEngine.Purchasing.UnityPurchasing+<>c__DisplayClass2_0.<Initialize>b__0 (System.Collections.Generic.HashSet`1[T] response) (at Library/PackageCache/com.unity.purchasing@2.2.2/Runtime/managed/Purchasing/UnityPurchasing.cs:50)
    UnityEngine.Purchasing.UnityPurchasing.FetchAndMergeProducts (System.Boolean useCatalog, System.Collections.Generic.HashSet`1[T] localProductSet, UnityEngine.Purchasing.Extension.ICatalogProvider catalog, System.Action`1[T] callback) (at Library/PackageCache/com.unity.purchasing@2.2.2/Runtime/managed/Purchasing/UnityPurchasing.cs:74)
    UnityEngine.Purchasing.UnityPurchasing.Initialize (UnityEngine.Purchasing.IStoreListener listener, UnityEngine.Purchasing.ConfigurationBuilder builder, UnityEngine.ILogger logger, System.String persistentDatapath, UnityEngine.Purchasing.IUnityAnalytics analytics, UnityEngine.Purchasing.Extension.ICatalogProvider catalog) (at Library/PackageCache/com.unity.purchasing@2.2.2/Runtime/managed/Purchasing/UnityPurchasing.cs:48)
    UnityEngine.Purchasing.UnityPurchasing.Initialize (UnityEngine.Purchasing.IStoreListener listener, UnityEngine.Purchasing.ConfigurationBuilder builder) (at Library/PackageCache/com.unity.purchasing@2.2.2/Runtime/managed/Purchasing/UnityPurchasing.cs:20)
    SIS.IAPManager.Initialize () (at Assets/SimpleIAPSystem/Scripts/IAPManager.cs:220)
    SIS.IAPManager.Awake () (at Assets/SimpleIAPSystem/Scripts/IAPManager.cs:181)


    So the error is definetely from the SIS manager. But I am not sure what is going on with the PlayFab Log in?
     
  42. Gathering_Storm_Studio

    Gathering_Storm_Studio

    Joined:
    May 30, 2018
    Posts:
    8
    So, after looking at some other stuff. Logging in with device actually gets me to the shop screen but the billing is unsuccessful. onPurchaseFailedEvent(productId:50credits message:/Client/PayForPurchase: Failed to initiate transaction with payment provider. I have the sandbox option enabled so funds shouldn't be an issue?
     
  43. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    I'm very sorry if I missed your post, I just got a notification from 20 minutes ago, but your posts show Monday!?

    Being able to call PlayFab methods such as GetCatalogItems requires logging in prior to that, so definitely check the UserLogin scene if that's still an issue. Steam login in that scene is handled automatically, if set up correctly, and retrieving products from PlayFab / Steam is a sequence of methods happening afterwards.

    Unfortunately I can't open the image you've posted. What do you mean by "Logging in with device", I thought you were using Steam and the UserLogin scene?

    The error is coming from PlayFab not being able to communicate with your Steam settings. This can have various reasons, e.g. wrong entered app ID, credentials in PlayFab > Steam Addon, your product not being created in the Steam backend, or the product ID containing other characters (product IDs on Steam must be a number only). Did you look into PlayFab's log to find out more about the error?
     
  44. Gathering_Storm_Studio

    Gathering_Storm_Studio

    Joined:
    May 30, 2018
    Posts:
    8
    Ok after fighting for nearly 2 weeks with this system. I have managed to sort out some of the issues. However, I am still getting a log-in error with playfab. But after between 1-2s I am assuming from a refresh call of some sort it then loads the selection screen I then use the vertical option and the virtual currency items I loaded to playfab are loading correctly. However, when I press 'buy', nothing happens at all. I used to get a Unity IAP not initialized, but now it's nothing. I worked through the code and put a Debug line on the purchase button it's firing correctly. It's also sending the right productID to the IAPManager.Purchase(string productID) function. I also checked to see if I had sandbox activated on playfab and I do.
     
  45. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    Hi @Gathering_Storm_Studio, before "fighting" with it for 2 weeks, please do not hesitate to contact me more often and explain your issues. If it's something in Simple IAP System that makes problems, I'm here to provide support.

    Unfortunately, based on your post I am not able to think of the exact root cause for your issues. Could you please try to start from the UserLogin scene and make sure that you're correctly logged in with PlayFab, using a) email credentials and b) automatic Steam login when launching the app embedded from the Steam client. We can work from there and then find out why purchasing does not do anything.

    If you are unable to get the sample scene working at all, it's not something I do very often, but I can offer to look at your project directly - if you would like to take that offer, please prepare a repro project that showcases your issue, without any unrelated code and at best with only Simple IAP System included, and send me a private PM.
     
  46. Gathering_Storm_Studio

    Gathering_Storm_Studio

    Joined:
    May 30, 2018
    Posts:
    8
    The project itself is massive. It's been in development for over a year. However, the the User Login screen creates 1 need playfab login error. I located this error, it is due to the fact that steam's default manager executes in the awake function the same as SIS so I had to stop SIS from initializing until steam initialized. So that starting login error is fixed. But still having the same issue with the buttons not doing anything. No billing setting error or anything. But it is loading the catalog from playfab. Can I possibly get an email I could send a video over? I am testing a bunch of different things but you might get there faster cause it's your structure.
     
  47. Gathering_Storm_Studio

    Gathering_Storm_Studio

    Joined:
    May 30, 2018
    Posts:
    8
    Sorry for these spam messages. But I am testing things quickly on my end. So now steam isn't crashing on load and everything is fine. I have loaded the game to the steam library as non-steam game. But the billing error is there now? It's not in the editor but in the standalone.
     
  48. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    The error probably means that initialization can still not finish correctly, which can have various reasons in either Unity, PlayFab, Steam or all of them. It is very difficult to track this down by looking at it from the outside. You can upload the video somewhere and send me only the link in a private message on this forum, or upload it as an attachment, although I do not know the upload limits.
     
  49. AppSD

    AppSD

    Joined:
    Feb 9, 2021
    Posts:
    11
    I am interested to know if your plugin can check user subscription status when the app starts, and validate app receipt. Thank you.
     
  50. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,267
    Good question. In a previous version of Simple IAP System, it shipped with a php file that could be uploaded onto your own server for verifying subscriptions on purchase and app launch, effectively detecting expired subscriptions. The need of your own server and some tedious configurations made it only feasible for a small group of users who really wanted to go that extra mile.

    I noticed the increased demand for subscription validations, where Unity IAPs SubscriptionManager did not fully work out, and am working on an online receipt validation platform for over half a year already. It will be simple to set up, compatible with Simple IAP System and you will not need your own server. The base tier will also be cheaper (in most cases) than renting a VPS. The planned beta launch is in January - please let me know if you're interested.

    So as a summary, my new platform will support subscriptions and expiration, refunds etc. very soon, but as of today you would still make use of Unity's SubscriptionManager (and it's flaws).