Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • General Discussion /
avatar image
Question by mkojic · Jun 11, 2018 at 11:15 PM · unity3dIn-Game Economy

Steam overlay not showing up [Unity]

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!

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

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?

Comment

People who like this

0 Show 1 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image mkojic · Jun 12, 2018 at 08:17 AM 0
Share

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.

avatar image

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

  1. Users & Permissions
  2. Manage Groups
  3. Create a group, select your apps
  4. Create WebAPI Key
  5. Paste the web api key at "App Admin > Community > Economy > Asset Server 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

  1. Users & Permissions
  2. Manage Groups
  3. Create a group, select your apps
  4. Create WebAPI Key
  5. Paste the web api key at "App Admin > Community > Economy > Asset Server Key"
Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    1 Person is following this question.

    avatar image

    Related Questions

    How to implement Daily rewards with Playfab? 1 Answer

    Unity Editor Test Purchase - Best Practice 1 Answer

    How to integrate real money payment using Playfab? 1 Answer

    Real Money Purchase only showing on some purchases 1 Answer

    problem with PurchaseItemRequest 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges