Hi, I can't get Steam overlay to show up. Once I execute the code bellow, both StartPurchase() and PayForPurchase() return the expected results but the Steam overlay still does not show up. In my Unity project I have a GameObject with the SteamManager script attached which triggers SteamAPI.Init(). I have another script which triggers PlayFabClientAPI.LoginWithSteam() and that one also returns the expected result. This is my code:
using PlayFab; using PlayFab.ClientModels; using Steamworks; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class PurchaseTest : MonoBehaviour { protected Callback<MicroTxnAuthorizationResponse_t> m_MicroTxnAuthorizationResponse; string orderID = ""; public Text text; // Use this for initialization void Start() { if (SteamManager.Initialized) { m_MicroTxnAuthorizationResponse = Callback<MicroTxnAuthorizationResponse_t>.Create(OnMicroTxnAuthorizationResponse); } } public void StartPurchaseProcess() { PlayFabClientAPI.StartPurchase(new StartPurchaseRequest() { CatalogVersion = "myCatalog", Items = new List<ItemPurchaseRequest>() { new ItemPurchaseRequest() { ItemId = "sword", Quantity = 1, Annotation = "Purchased via in-game store" } } }, result => { text.text += Environment.NewLine + "StartPurchase: " + result.OrderId; Debug.Log("StartPurchase: " + result); orderID = result.OrderId; PurchaseOnSteam(orderID); }, error => { text.text += Environment.NewLine + "StartPurchase FAILED"; Debug.Log("StartPurchase FAILED: " + error.ErrorMessage); }); } private void PurchaseOnSteam(string orderId) { PlayFabClientAPI.PayForPurchase(new PayForPurchaseRequest() { OrderId = orderId, ProviderName = "Steam", Currency = "RM" }, result => { text.text += Environment.NewLine + "Purchase on steam"; Debug.Log("PurchaseOnSteam Success: " + result); }, error => { text.text += Environment.NewLine + "SENT TO STEAM FAILED"; Debug.Log("PurchaseOnSteam Failed: " + error.ErrorMessage); }); } private void OnMicroTxnAuthorizationResponse(MicroTxnAuthorizationResponse_t pCallback) { if (pCallback.m_bAuthorized == 1) { text.text += Environment.NewLine + "Authorized Payment: " + pCallback.m_ulOrderID.ToString(); Debug.Log("OnSteamApproval authorized!"); ConfirmPurchase(orderID); } else { text.text += Environment.NewLine + "Failed to authorize payment"; // Player didn't authorize the payment Debug.Log("Failed to authorize payment"); } } private void ConfirmPurchase(string orderId) { PlayFabClientAPI.ConfirmPurchase(new ConfirmPurchaseRequest() { OrderId = orderId }, result => { text.text += Environment.NewLine + "CONFIRMED PURCHASE"; Debug.Log("Final ConfirmPurchase: " + result); }, error => { text.text += Environment.NewLine + "FAILED: " + error.Error; text.text += Environment.NewLine + error.ErrorMessage; Debug.Log("Failed ConfirmPurchase: " + error.ErrorMessage); }); } }
What am I doing wrong? Hope someone can help me out with this.
Thanks!
Answer by Brendan · Jun 12, 2018 at 02:24 AM
If the call to PayForPurchase is returning successfully, you'd need to check with the Steam developer support folks to see why the overlay isn't showing up in your Steam client - I'm afraid we have no control over that, nor are we able to debug into that client.
Are you trying this with sandbox purchases (with that Setting enabled in PlayFab)? If so, what happens if you try non-sandbox?
Hi @Brendan, thank you for your reply. I have tried both sandbox and non-sandbox purchases, but the overlay is still not showing up...Will try to get in touch with the Steam developer support folks - maybe they know what's wrong with this.
Answer by Ravi Belkud · May 27, 2021 at 01:48 AM
In case anyone is still facing this issue, please add add the Asset server key as mentioned in the steam community link. After that it works for both Steamworks.NET and Facepunch.
https://steamcommunity.com/groups/steamworks/discussions/0/1727575977575099042/
Copy pasting the solution here:
Create an API Key
In case anyone is still facing this issue, please try adding the Asset server key as mentioned in the steam community link. After that it works for both Steamworks.NET and Facepunch.
https://steamcommunity.com/groups/steamworks/discussions/0/1727575977575099042/
Copy pasting the solution here:
Create an API Key