Search Unity

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

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

?

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

  1. Unity IAP

    173 vote(s)
    86.5%
  2. Voxel Busters

    10 vote(s)
    5.0%
  3. Stans Assets

    13 vote(s)
    6.5%
  4. Prime31

    4 vote(s)
    2.0%
  1. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Working on it and planned to send it to you today - have to do testing with local and online (PlayFab) integrations first to verify that the "fix" is actually fixing the issue
     
  2. DevNoody

    DevNoody

    Joined:
    Sep 8, 2021
    Posts:
    10
    Awesome thanks!
     
  3. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,968
    @Baroni Could you please share us steps to make our plugin compatible with your server? As we already provide receipt(purchase token) which is the actual requirement for receipt verification, wondering what else is required.
     
  4. Nayjest

    Nayjest

    Joined:
    Aug 7, 2013
    Posts:
    4
    Thanks for helping with prev. problem.

    Now I have another: can't consume items directly after successfull purchase (from HandleSuccessfulPurchase).
    Always getting next error: IAPManager reports: ConsumeFailed. Error: Not enough inventory to consume.

    Background:
    Testing on another Steam account (not developer) unreleased game demo (but for dev acc. same problem exists, the only difference is that steam dont takes real money from dev acc.). Purchases are successfull with real money, I'm getting notifications on new items in steam inventory (but there is no dedicated section with items for my game, probably because it isn't released). In SIS settings all products are consumable, has same names as steam inventory ID's + have overrides for steam (to same string representing same steam ID, like 100, 200, etc).

    Steam inventory items looks like this:


    {
    "appid": "2348040",
    "itemdefid": "100",
    "Timestamp": "2023-03-22T14:27:19Z",
    "modified": "20230322T142719Z",
    "date_created": "20230322T142719Z",
    "type": "item",
    "display_type": "",
    "name": "30 Riddles",
    "price": "1;VLV100",
    "quantity": 1,
    "description": "Credits to generate & play 30 riddles.",
    "tradable": false,
    "marketable": false,
    "commodity": false
    }

    Please help to solve that.
     
  5. Shivaji_Games

    Shivaji_Games

    Joined:
    Apr 2, 2020
    Posts:
    28
    Hello, Restore transaction successfully working, But code written inside IAP Listener (HandleSuccessfulRestore) is not calling. IMG20230322232805.jpg IMG_20230322_232733.jpg

    I used to fixed this error by suggestion of visual studio basically it creates a function with same name, I think this is going wrong so I removed that now getting this error. please see

    one more question I see code inside HandlePurchaseSuccessful runs when restore transaction succeed, I don't want this thing.
     
    Last edited: Mar 22, 2023
  6. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Providing the purchaseToken is sufficient. As per REST endpoint documentation there are more fields necessary such as store, bundle id, product id, product type - everything that the client should already have access to. I assume the product id and product type can be accessed in your plugin at runtime via BillingServices > ProductDefinitions > BillingProductType. I have not heard back from the user, however I think the request was more directed at implementing the required callbacks of your plugin in a ready-to-use component, rather than extending it.

    @Nayjest Why would you want to consume the product manually in HandleSuccessfulPurchase? Usually, with the product having a reward count added in the IAP Settings editor, the user can decide when to consume it. Consuming it instantly in the callback means that this is the same as a product without a reward count. So ultimately, you would want to check for the reward count (I guess the count should be 30 for your "30 Riddles" product) in the IAP Settings editor and then let the user invoke an action that calls IAPManager.Consume(your product ID).

    @Shivaji_Games Did you test on a device? The callback is only fired for Android and iOS.
     
    Voxel-Busters likes this.
  7. Shivaji_Games

    Shivaji_Games

    Joined:
    Apr 2, 2020
    Posts:
    28
    Yes I am testing on my IOS device But code written inside IAP Listener (HandleSuccessfulRestore) is not calling.
     
  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    And you call IAPManager.RestoreTransactions() or use the UIButtonRestore component do invoke the restore? Ultimately this only calls into Unity IAP functionality as described on this page:
    Code (CSharp):
    1. extensions.GetExtension<IAppleExtensions>().RestoreTransactions(OnTransactionsRestored);
    So I can re-test this on my device too, but I just assume that it should still work since I last tested it.

    You could double check and implement the code listed on the page above on your own though, by adding it into the OnInitialized method of the IAPManager:
    Code (CSharp):
    1.     extensions.GetExtension<IAppleExtensions> ().RestoreTransactions (result => {
    2.         if (result) {
    3.             Debug.LogWarning("RESTORE SUCCESS");
    4.         } else {
    5.             Debug.LogWarning("RESTORE FAIL");
    6.         }
    7.     });
    Then debug the device in XCode to see the log and what was printed.
     
  9. Shivaji_Games

    Shivaji_Games

    Joined:
    Apr 2, 2020
    Posts:
    28
    Please see this. This might be causing issue ?
     
  10. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Going to check in an hour or two. In the meantime what Unity IAP version are you using from the PackageManager? The latest 4.7.0?
     
  11. Shivaji_Games

    Shivaji_Games

    Joined:
    Apr 2, 2020
    Posts:
    28
    Yes i checked the log it's returning "RESTORE SUCCESS". No it's not 4.7 it's 4.04. Yes going to update it. As i open my game to test. it RESTORE SUCCESS automatically getting printed without clicking on restore button.
     
    Last edited: Mar 22, 2023
  12. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    You meant 4.4.0? Please update to at least 4.6.0 or better 4.7.0. If you do not see that version in the PackageManager please follow the documentation. You can then remove the "RESTORE SUCCESS" code you added previously again. I think that should fix it for you.
     
  13. Shivaji_Games

    Shivaji_Games

    Joined:
    Apr 2, 2020
    Posts:
    28
    Yes I updated to latest 4.7, Great ! It's working now. The program I have written Inside "HandleSuccesfulPurchase" is being called automatically when I start game, I want to stop this.
     
  14. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    I really don't know why. This does not happen in the Simple IAP System example scenes.
     
  15. Shivaji_Games

    Shivaji_Games

    Joined:
    Apr 2, 2020
    Posts:
    28
    And this too "RESTORE SUCCESS" is also called without clicking restore button
     
  16. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    I would recommend creating a new sandbox tester on the Apple developer site to test without previous transactions.

    If you see the same issue, please try in a default project with the Simple IAP System example scenes. I can only assume that you made some changes somewhere, but it is definitely not the default behavior.
     
  17. knuppel

    knuppel

    Joined:
    Oct 30, 2016
    Posts:
    97
    Hi, I'm planning to buy this asset. I have some presale questions.
    I will use it for subscriptions, how does the script know, that the subscription was payed, everytime the users opens the app?
    Are all the other bought items (like coins etc..) are stored somewhere? Or do i have to store evereything somewhere?

    thanks in advance, Andreas
     
  18. Shivaji_Games

    Shivaji_Games

    Joined:
    Apr 2, 2020
    Posts:
    28
    Hello, Ok Understood that. But I don't want to HandleSuccesfulPurchase to be called when I restore, So please tell me how I can achieve this
     
  19. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    @knuppel Hi Andreas, thanks for your interest! For subscriptions, Unity IAP does its best to identify whether it is paid for or still pending. This is accessible in the client and handled by Simple IAP System already.

    The more difficult part is what happens after a user cancels, resubscribes, or let's the subscription otherwise expire. At some point (after store cache is updated) the subscription will then return back to a "not owned" state. While some local validation happens, there could be cases where local validation is not enough to check for (as mentioned above for cancelled but active, paused or long expired + restored subscriptions). For these cases I provide the receipt validation service over on my website. However, you should test first whether the regular local checks are sufficient to you.

    All purchases are stored locally in an optionally encrypted file. Since consumables are not stored on the App Store, by default they exist only locally on this specific device the user purchased it on. If you would like to have it transferred to other devices as well and kept in sync, supporting a user login and inventory, that's what the PlayFab integration is for, however that requires your app to basically be an online game.

    @Shivaji_Games By definition, a restored purchase should be processed on devices where the purchase was lost. So, of course the HandleSuccessfulPurchase method is called for a restored product, because it is treated as a new "purchase" internally. If you have some code in that method that should only run once, you are probably not using the method in the correct way.

    I would be able to assist further if you could explain your use case and why it would make a difference that HandleSuccessfulPurchase is not called for restored purchases, I.e. what is your requirement that you want to achieve here.
     
  20. Shivaji_Games

    Shivaji_Games

    Joined:
    Apr 2, 2020
    Posts:
    28
    Hello, understood that, In my case when user press restore button which will call HandleSuccesfulPurchase , It prints Purchase complete along with restore complete message, and apple app review team can see it as a bug. So I don't want Purchase complete message get called after restore done.
     
  21. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    @Shivaji_Games This asset is used by over 2000 developers and I can assure you, I have not heard Apple declining a release because of this a single time :) As I said this is the default billing process and if it would have been an issue, everyone would have run into it.
     
  22. Shivaji_Games

    Shivaji_Games

    Joined:
    Apr 2, 2020
    Posts:
    28
    Great to hear this, let me confirm 1 more time If user click restore if he see 2 messages (1 restore complete and another purchase complete) then will it be fine ?
     
  23. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Yes, this is fine. But if it really concerns you, you could not show the restore message. The purchase complete message is required.
     
  24. Shivaji_Games

    Shivaji_Games

    Joined:
    Apr 2, 2020
    Posts:
    28
    Ok, Thank you very much
     
  25. herra_lehtiniemi

    herra_lehtiniemi

    Joined:
    Feb 12, 2017
    Posts:
    133
    Hi! Trying to up Steam with PlayFab integration. When I try to upload the exported JSON-file (SimpleIAPSystem_IAPSettings_PlayFab.json), the upload spinner appears briefly and then disappears. The modal in the attachment stays visible and no catalogue is uploaded.

    What could cause this? The catalogue-tab on the PlayFab-page says it's legacy and there's also Economy V2 available, but couldn't find guide for this, if that's what I should use?
    upload_2023-3-24_15-43-10.png

    Network inspector gives this error:
    Code (CSharp):
    1. [{
    2.     "Key": "JsonFile",
    3.     "Value": ["JSON file could not be mapped to the model."]
    4. }, {
    5.     "Key": "Catalog[0].Bundle.BundledItems",
    6.     "Value": ["Error converting value \"no_ads\" to type 'System.String[]'. Path 'Catalog[0].Bundle.BundledItems', line 1, position 245."]
    7. }]
    8.  
    After reducing my categories to 1 and products to 2, now it gives the following error when trying to upload the same file to Categories (Legacy):
    Code (CSharp):
    1. [{
    2.     "Key": "__generic__",
    3.     "Value": ["InvalidItemProperties"]
    4. }]
    5.  
     
    Last edited: Mar 24, 2023
  26. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hi @herra_lehtiniemi thanks for posting here. Economy v1 is what should be used, Economy v2 is not supported yet. I'll check later with my setup if PlayFab changed something in their backend with v1, in the meantime, could you please send the .json file you are trying to upload in a private message? Thanks!
     
  27. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Thanks for the json file @herra_lehtiniemi ! I was able to reproduce the issue with the default json and the cause there is within the "bundle" product, specifically it containing the "no_ads" product. After removing "no_ads" from the bundle's rewards, uploading that json works fine too. Will investigate what a correct format should look like.

    Regarding your json, I was able to upload it without problems. Did you upload the currency file first? This is important, since your product json contains the currency and although the error from PlayFab is quite generic, this could be the cause.
     
  28. herra_lehtiniemi

    herra_lehtiniemi

    Joined:
    Feb 12, 2017
    Posts:
    133
    Hmm, could you please check with these files? I cleaned up the files a bit and I should no longer have the ads-products.

    If I try to upload currency first (on the Catalogs-page, there's no upload-button on the Currency-page), I get the following error:
    Code (CSharp):
    1. [{
    2.     "Key": "",
    3.     "Value": ["Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'GameManager.Areas.Economy.Models.CatalogContainerModel' because the type requires a JSON object (e.g. {\"name\":\"value\"}) to deserialize correctly.\nTo fix this error either change the JSON to a JSON object (e.g. {\"name\":\"value\"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.\nPath '', line 1, position 1."]
    4. }, {
    5.     "Key": "JsonFile",
    6.     "Value": ["JSON file could not be mapped to the model."]
    7. }]
    8.  
    If I try to upload the catalogue-file, I get:
    Code (CSharp):
    1. [{
    2.     "Key": "__generic__",
    3.     "Value": ["InvalidItemProperties"]
    4. }]
    5.  
     

    Attached Files:

  29. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    That PlayFab.json file works for me, in the catalog. The Currency page indeed has an upload button, although not as visible as the catalog button:

    upload_2023-3-24_20-22-23.png

    Note: there is a separate json file for currency (SimpleIAPSystem_Currencies.json), do not upload the catalog on the Currency page.
     
  30. rubicogames

    rubicogames

    Joined:
    May 10, 2022
    Posts:
    2
    Hello. I'm trying to get the plugin to work with Steam. I have everything set up as per the documentation, but the purchasing overlay is not showing. If I try to buy a product the "HandleSuccessfulPurchase" is working fine, but "HandleSuccessfulConsume" is not working. When I check the local log file from my game I see this message, that comes from the IAP Listener script - "No products available for purchase!". I have uploaded my JSON file to steamworks and I have copied the same information in the SIS settings and I have enabled the override function with the correspoding item IDs. Any help would be greatly appreciated as I don't know what to do next..
     
  31. herra_lehtiniemi

    herra_lehtiniemi

    Joined:
    Feb 12, 2017
    Posts:
    133
    Got the JSON-import to Playfab solved with help - issue was that currency-page (legacy) no longer had a JSON import. However, it was easy to type in the .json-content to that page. After that the JSON import worked well on catalogs-page!




    I'm still facing one issue - when I click on the sample UI purchase button (both in editor or build via steam), I get the following error. Same happens also in the sample scenes that come with the asset so it seems there's something in Unity's settings.

    Code (CSharp):
    1. Unity IAP is not initialized correctly! Please check your billing settings.
    2. UnityEngine.Debug:LogError (object)
    3. SIS.IAPManager:Purchase (string) (at Assets/SimpleIAPSystem/Scripts/IAPManager.cs:389)
    4. SIS.ShopItem2D:Purchase () (at Assets/SimpleIAPSystem/Scripts/ShopItem2D.cs:338)
    5. UnityEngine.EventSystems.EventSystem:Update () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:501)
    6.  
    I went through the checklist on this guide: https://flobuk.gitlab.io/assets/docs/sis/stores/steam-playfab and they all seem to match. I can open the Steam overlay in the build so Steam seems to work. It's some config on Unity's side.

    Also, didn't find in the guide, but when I'm setting up Steam IAP's with PlayFab (validation only) do I have to enable Steam item inventory on the page where I upload the products-JSON on the Steam developer site?

    I checked with debugger and this part of the code is never called (in IAPManager):
    Code (CSharp):
    1. public void OnInitialized(IStoreController ctrl, IExtensionProvider ext)
    This is, however so at least the initialization is started:
    Code (CSharp):
    1. UnityPurchasing.Initialize(this, builder);
    Do I have to add the products into the Unity's own IAP settings as well or should Simple IAP take care of that?
     
    Last edited: Mar 27, 2023
  32. herra_lehtiniemi

    herra_lehtiniemi

    Joined:
    Feb 12, 2017
    Posts:
    133
    Btw there's a small error in the code - when I run a sample scene multiple times in a row, I get the error that a dictionary already contains the key. Error comes from this line:
    Code (CSharp):
    1. //add IAPItem to dictionary for later lookup
    2. IAPManager.shopItems.Add(product.ID, item);
    This was fixed by adding IAPManager.shopItems.Clear() to the start of CreateShopItems().
     
  33. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hi @rubicogames, did you see the last part in the guide where it says "In cases of the Steam Overlay opening, but the purchase overlay does not"? Unfortunately I don't really get the issue - you say that the purchase overlay is not showing, how is the HandleSuccessfulPurchase callback fired then without a previous purchase? If the products are not retrieved from Unity IAP ("No products available" message), there is definitely an issue with the Steam Store connection you would want to check.

    @herra_lehtiniemi There seems to be a mix of issues and confusion involved. Do you start your scene with the PlayFabManager prefab and SteamManager prefab present, IAPManager prefab's auto-initialize turned off, and logging in with PlayFab in the first scene? For example, with the PlayFab sample scene (in the separate package). The PlayFab login flow starts the IAPManager initialization. Before that, no products are initialized with PlayFab.

    Two things - did you try with "Validation Only" turned off and logging in as mentioned above too? Second, the Steam Inventory option should be disabled, since your inventory is managed by PlayFab. That option is only necessary when using Steam without PlayFab.

    You should not add products to Unity IAP's catalog or use any of its codeless components.

    Clearing that dictionary is done via the OnSceneWasLoaded callback. May I ask how you are loading the scenes? Additively? There should be no error just by switching scenes back and forth.
     
    rubicogames likes this.
  34. herra_lehtiniemi

    herra_lehtiniemi

    Joined:
    Feb 12, 2017
    Posts:
    133
    @Baroni Ah, I didn't know I have to initialize PlayFab separately, I must have missed this step in the guide. Thank you for the extra tip! I have now added the PlayFab login scene. I use "Log in with device id", I get the message "Got PlayFab ID xxxxx" and OnLoggedIn gets called in PlayFabUILogin.cs. If I try to press the purchase button after this, I still get the same error. This happens with both "Validation only" on and off.

    Code (CSharp):
    1. Unity IAP is not initialized correctly! Please check your billing settings.
    2. UnityEngine.Debug:LogError (object)
    3. SIS.IAPManager:Purchase (string) (at Assets/SimpleIAPSystem/Scripts/IAPManager.cs:389)
    4. SIS.ShopItem2D:Purchase () (at Assets/SimpleIAPSystem/Scripts/ShopItem2D.cs:338)
    5. UnityEngine.EventSystems.EventSystem:Update () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:501)
    6.  
     
  35. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    @herra_lehtiniemi Just a shot in the dark, could you try without product ID overrides for Steam? So e.g. having a product in SIS & PlayFab & Steam with the main product identifier ID "200" and overrides removed. I'm assuming the issue is somewhere in not getting the correct products from PlayFab and Steam, because PlayFab does not have product overrides (but catalog overrides) and therefore could eventually send the wrong product ID to Steam.
     
  36. herra_lehtiniemi

    herra_lehtiniemi

    Joined:
    Feb 12, 2017
    Posts:
    133
    After trial and error, I'm now up to the point where I have logged in with PlayFab (Device ID). When I press the purchase button provided by SIS interface, running the build via Steam, it says "Payment declined". It doesn't pop up any steam purchase overlay, but the error comes from the Unity-interface. Any ideas what could cause this?

    When pressing it in editor, I get:
    Code (CSharp):
    1. IAPManager reports: PurchaseFailed. Error: PaymentDeclined
    2. UnityEngine.Debug:Log (object)
    3. SIS.IAPManager:OnPurchaseFailed (UnityEngine.Purchasing.Product,UnityEngine.Purchasing.PurchaseFailureReason) (at Assets/SimpleIAPSystem/Scripts/IAPManager.cs:664)
    4. UnityEngine.Purchasing.PurchasingManager:OnPurchaseFailed (UnityEngine.Purchasing.Extension.PurchaseFailureDescription)
    5. SIS.PlayFabStore:OnPurchaseFailed (PlayFab.PlayFabError) (at Assets/SimpleIAPSystem/Extensions/PlayFab/Scripts/PlayFabStore.cs:376)
    6. PlayFab.Internal.PlayFabUnityHttp:OnResponse (string,PlayFab.Internal.CallRequestContainer) (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:220)
    7. PlayFab.Internal.PlayFabUnityHttp/<Post>d__12:MoveNext () (at Assets/PlayFabSDK/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:159)
    8. UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr) (at /Users/bokken/build/output/unity/unity/Runtime/Export/Scripting/Coroutines.cs:17)
    9.  
     
    Last edited: Mar 28, 2023
  37. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    @herra_lehtiniemi Good to hear you're making progress. I saw your PM screenshots. With product overrides I meant your product settings - you are using the same product ID "100" as a global ID and then added an override for SteamStore with product ID "100". This is unnecessary but does not cause any harm.

    The message you are seeing now is received by PlayFab. It cannot initialize your purchase correctly and therefore fails with that generic message (which can be found in various public threads on the PlayFab forums). Did you recheck the following points in the guide, since the issue now is between PlayFab and Steam, specifically the part mentioning the Web API Key and correct group assignment on Steam, but also copy-pasting it correctly into the PlayFab addon (no spaces)?

    https://flobuk.gitlab.io/assets/docs/sis/stores/steam-playfab#unsolved-errors
     
  38. pedromgdo

    pedromgdo

    Joined:
    Feb 13, 2018
    Posts:
    7
    Hi there,

    is there a version of the asset with just the steam integration?
    I want to add steam purchases to my game, but I already have a working purchases system for all the other platforms, is it possible to just use the steam module without adding any bloat to the game or changing my implementation?
     
  39. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hi @pedromgdo !

    There is no "standalone" asset for Steam, however all code is compiled platform dependent using scripting defines. So if you would like to not use Simple IAP System e.g. on Android, you would remove the SIS_IAP scripting define for that platform. Several developers are using it that way successfully.
     
  40. pedromgdo

    pedromgdo

    Joined:
    Feb 13, 2018
    Posts:
    7
    Thanks!
    Do the items purchased appear in the steam inventory of the game or not?
    Having 'double resources' purchase in your steam inventory wouldn't make much sense.
     
  41. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    For non-consumable products, they do get added to the user's Steam Inventory by default. You might want to look into the configuration on Steam - maybe there is a setting on the product that can toggle this.
     
  42. herra_lehtiniemi

    herra_lehtiniemi

    Joined:
    Feb 12, 2017
    Posts:
    133
    I replied privately.

    So far it seems Unity fetches products from PlayFab and logs into PlayFab correctly. On PlayFab console I see the following request failing:
    upload_2023-3-30_14-21-45.png

    We have published the changes on Steam for our game (should also include inventory items, right?), but checking the product via direct link (posted privately) doesn't work. Should it show something? Does this indicate Steam doesn't have the products published if the direct link to product doesn't work?
     
  43. scottnicholson113

    scottnicholson113

    Joined:
    Mar 20, 2020
    Posts:
    6
    Hello! I am trying to use this for WebGL, with paypal. It works great when in the editor, but when I export and have it on the website, the payal window never appears like it does in the editor.
     
  44. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    @herra_lehtiniemi Currently still looking into this, but my time is slowly running out before the weekend. I am able to reproduce the "PaymentDeclined" error with your AppID but will have to dig deeper. The Economy tab missed an Asset Server key so at least your purchase direct links are now working.

    Hi @scottnicholson113, did you fill out the PayPal production credentials in the Setup tab too? Any errors showing up when Development Build is enabled?
     
  45. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Hi @herra_lehtiniemi, while I was able to reproduce the "PaymentDeclined" error with a quickly hacked build, I switched back to my own App ID where the error did not occur (and still does not). So, starting from scratch I downloaded your game from Steam, renamed my Unity project and build it into the Steam/steamapps/common/bonedust folder effectively replacing your executable with mine.

    Launching the game from Steam and starting with the "PlayFab" example scene, authenticated my user with PlayFab+Steam and connected the game properly. Note that the login happens automatically using the Steam user ticket - you do not have to do a login via device or something like that. This way the user has a Steam symbol on PlayFab:

    upload_2023-4-3_13-50-24.png

    upload_2023-4-3_13-48-5.png

    Using your App ID and Web API Key in my PlayFab title, initializing and paying for a purchase works too:

    upload_2023-4-3_13-52-39.png

    Although note that the product ID and description (here: coins) does not match with the items defined in Steam. It seems that the items on Steam, under the Inventory Service tab are not used at all, since I was also able to purchase an item that did not exist there. Everything comes directly from PlayFab, they must have changed this some time ago, with the Steam Inventory Service now basically completely ignored.

    I am going to send you screenshots of my setup via PM, hope this helps.
     
  46. scottnicholson113

    scottnicholson113

    Joined:
    Mar 20, 2020
    Posts:
    6
    Hey! Nope! No errors, the paypal site launches perfectly when Im playing the the editor, but when I build to webgl it does nothing.
     
  47. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,268
    Unfortunately I am not able to reproduce. I created a WebGL build using Unity 2022.1.0, uploaded it to itch.io and it opens the production PayPal page correctly with Development Build disabled. Could you please inspect the browser console - any warnings or errors there?

    Also make sure to have the PayPal production credentials set when disabling Development Build. Did you upload on your own server or an external provider like itch.io?
     
  48. scottnicholson113

    scottnicholson113

    Joined:
    Mar 20, 2020
    Posts:
    6
    I used GitHub Pages
     
  49. scottnicholson113

    scottnicholson113

    Joined:
    Mar 20, 2020
    Posts:
    6
    I got the error, https://api-m.paypal.com/v1/oauth2/token 401 So its a 401 error, any ideas on how to fix it?
     
  50. scottnicholson113

    scottnicholson113

    Joined:
    Mar 20, 2020
    Posts:
    6
    So its an auth error, lol, but I have the correct credientals in the player settings, cause I dont get the error when im in the unity editor