question

Ben Snowden avatar image
Ben Snowden asked

Steam API "User has not approved this transaction "

Hello all, I have been attempting to implement Steam IAP through playfab. I have got to the point where i can link a steam account and I can start a purchase. However after Start purchase and payfor purchase runs it calls ConfirmPurchase which returns this error.

How does one go about testing IAP with Steam and playfab while in unity? What could be going on here?

05s2e.png (7.9 KiB)
10 |1200

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

Ben Snowden avatar image
Ben Snowden answered

Update, in a build when I call StartPurchase I am able to get the MicroTxnAuthorizationResponse_t callback to fire and its always false, seems like im having trouble getting the the Shift + Tab menu to come up.

3 comments
10 |1200

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

Rick Chen avatar image Rick Chen ♦ commented ·

Due to the limit resources, I cannot do the test for you. For the question of why your MicroTxnAuthorizationResponse_t callback always gets false, please search the steam document or contact the steam support for help. For example, https://partner.steamgames.com/doc/api/ISteamUser this document states that the MicroTxnAuthorizationResponse_t Is called when a user has responded to a microtransaction authorization request. You may do some troubleshooting according to the documents.

0 Likes 0 ·
Ben Snowden avatar image Ben Snowden Rick Chen ♦ commented ·

No worries Rick. Today I managed to get the shift-tab menu working in the build which is exciting. However, even when calling PayForPurchase steam does not open the menu automatically like how it looks in steam documentation.

The issue seemed to be about how steam injects itself into the build at the start. You must call the builds.exe through steam in order for it to work.

0 Likes 0 ·
Rick Chen avatar image Rick Chen ♦ Ben Snowden commented ·

Glad to hear that you managed to get the Steam shift-tab menu working. Thank you for sharing the information.

0 Likes 0 ·
Rick Chen avatar image
Rick Chen answered

For Steam, as a result of the PayForPurchase call, PlayFab uses the web methods provided by Steam to initiate the purchase in that service. This automatically causes the user to be presented with the purchase confirmation dialog via the Steam client. Have you confirmed the purchase on steam before calling the ConfirmPurchase API? Please refer to this document for more detail: Establishing the payment provider: Non-webhook providers.

1 comment
10 |1200

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

Ben Snowden avatar image Ben Snowden commented ·

Hey Rick, Thanks for the response, sorry for the delay had a busy weekend, I do not believe I did so, I will double-check my code with the docs and see what I can find,

0 Likes 0 ·
Ben Snowden avatar image
Ben Snowden answered

Here is my current code. @Rick


@Rick Chen


   public string PLAYFAB_TITLE_ID = "XXX";
    SteamManager s_SteamManager;


    protected Callback<MicroTxnAuthorizationResponse_t> m_MicroTxnAuthorizationResponse;


#if UNITY_EDITOR || UNITY_STANDALONE
    public void Start()
    {
        s_SteamManager = GetComponent<SteamManager>();


        string name = SteamFriends.GetPersonaName();
        Debug.Log($"STEAM NAME {name}");


        m_MicroTxnAuthorizationResponse = Callback<MicroTxnAuthorizationResponse_t>.Create(OnMicroTxnAuthorizationResponse);


    }


    public void Update()
    {
        if(Input.GetKeyDown(KeyCode.P))
        {
            StartPurchase();
        }
    }


    private void OnMicroTxnAuthorizationResponse(MicroTxnAuthorizationResponse_t pCallback)
    {


        if (pCallback.m_bAuthorized == 1)
        {
            Debug.Log("Payment Authorized");


            ConfirmPurchase(pCallback.m_ulOrderID.ToString());
        }
        else    
            Debug.Log("Failed to authorize payment");
        
    }




    #region  IAP
    [Button]
    public void StartPurchase()
    {
        PlayFabClientAPI.StartPurchase(new StartPurchaseRequest()
        {
            CatalogVersion = "XXX",
            Items = new List<ItemPurchaseRequest>() {
        new ItemPurchaseRequest() {
            ItemId = "XXX",
            Quantity = 1,
            Annotation = "Purchased via in-game store"
        }
    }
        }, result => {
            // Handle success
            PayForPurchase(result.OrderId);
        }, error => {
            Debug.Log($"Error Checking out with steam. \n" +
               $"{error.ErrorMessage} \n" +
                $"{error.ErrorDetails} \n" +
                $"{error.Error}");
        });
    }


    public void PayForPurchase(string order)
    {
        PlayFabClientAPI.PayForPurchase(new PayForPurchaseRequest()
        {
            OrderId = order,
            ProviderName = "Steam",
            Currency = "RM"
        }, result => {
            //Call steam to start payment?
        }, error => {
            Debug.Log($"Error Paying for  with steam.\n" +
                $"{error.ErrorMessage} \n" +
                $"{error.ErrorDetails} \n" +
                $"{error.Error}");
        });
    }


    public void ConfirmPurchase(string order)
    {
        PlayFabClientAPI.ConfirmPurchase(new ConfirmPurchaseRequest()
        {
            OrderId = order
        }, result => {
            Debug.Log($"Congrats you bought with steam.");
        }, error => {
            Debug.Log($"Error buying  with steam.\n" +
                $"{error.ErrorMessage} \n" +
                $"{error.ErrorDetails} \n" +
                $"{error.Error}");
        });
    }


    #endregion


#endif


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.