question

SniperED007 avatar image
SniperED007 asked

Steam - Unity - MicroTxnAuthorizationResponse_t not getting called.

  protected Callback<MicroTxnAuthorizationResponse_t> m_MicroTxnAuthorizationResponse;


  private void Start()
  {
    if (SteamManager.Initialized)
    {
      m_MicroTxnAuthorizationResponse = Callback<MicroTxnAuthorizationResponse_t>.Create(OnMicroTxnAuthorizationResponse);


      Debug.Log("SteamUserID: " + SteamUser.GetSteamID());
      Debug.Log("Language: " + SteamApps.GetCurrentGameLanguage());
    }
  }


  private void OnMicroTxnAuthorizationResponse(MicroTxnAuthorizationResponse_t pCallback)
  {
    text.text = "HERE";


    if (pCallback.m_bAuthorized == 1)
    {
      text.text += Environment.NewLine + "Authorized Payment";


      Debug.Log("Authorized Payment");
      
      ConfirmPurchase(pCallback.m_ulOrderID.ToString());
    }
    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 + "CONFIRM PURCHASE";
      Debug.Log("CONFIRM PURCHASE");
    }, error => 
    {
      text.text += Environment.NewLine + "PURCHASE FAILED: " + error.ErrorMessage;
      Debug.Log("PURCHASE CONFIRM FAILED: " + error.ErrorMessage);
    });
  }


I'm trying to purchase an item, the steam overlay pops up with the item name and price in it, clicking purchase closes the window but does nothing after that the MicroTxnAuthorizationResponse_t callback does not get called.

1. Steam is initialized

2. Callback is registered

3. SteamAPI.RunCallbacks(); is running in the Update()

* I have enabled Sandbox mode in the PlayFab settings (but even with it disabled and canceling the steam purchase windows it doesn't call MicroTxnAuthorizationResponse_t)

Any other ideas?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

SniperED007 avatar image
SniperED007 answered

Ok, found the problem, the callbacks aren't working in Unity 2018.1 when the scripting backend is set to IL2CPP.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

This isn't actually something we can help you with, as the issue is on the Steam side. When you call PayForPurchase, we kick off the call to Steam which causes the overlay pop-up to show up, so clearly the calls you're making to PlayFab are working fine. But we have no control over Steam making the callback to your title once you click yes or no on that overlay, nor do we have any way to debug into their service to see what's happening for your title. I would suggest asking the Steamworks team for assistance with this.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.