question

SniperED007 avatar image
SniperED007 asked

Steam - PlayFabClientAPI.ConfirmPurchase - Errors with "InvalidParams"

I get the error: "InvalidParams" - "Invalid input params" after I click the Authorize button on the Steam Purchase overlay.

private void PurchaseCoins()
  {
    PlayFabClientAPI.StartPurchase(new StartPurchaseRequest()
    {
      CatalogVersion = "Avatar Items",
      Items = new List<ItemPurchaseRequest>()
      {
        new ItemPurchaseRequest()
        {
          ItemId = "IAP_1Dollar",
          Quantity = 1,
          Annotation = "Purchased via in-game store"
        }
    }
    }, result =>
    {
      text.text += Environment.NewLine + "StartPurchase: " + result.OrderId;
      Debug.Log("StartPurchase");
      PurchaseOnSteam(result.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";
    }, error => {
      text.text += Environment.NewLine + "SENT TO STEAM FAILED";
    });
  }


  private void OnSteamApproval(MicroTxnAuthorizationResponse_t pCallback)
  {
    if (pCallback.m_bAuthorized == 1)
    {
      text.text += Environment.NewLine + "Authorized Payment: " + pCallback.m_ulOrderID.ToString();


      ConfirmPurchase(pCallback.m_ulOrderID);
    }
    else
    {
      text.text += Environment.NewLine + "Failed to authorize payment";
      // Player didn't authorize the payment
      Debug.Log("Failed to authorize payment");
    }
  }


  private void ConfirmPurchase(ulong orderId)
  {
    PlayFabClientAPI.ConfirmPurchase(new ConfirmPurchaseRequest()
    {
      OrderId = orderId.ToString()
    }, result => 
    {
      text.text += Environment.NewLine + "CONFIRMED PURCHASE";
    }, error => 
    {
      text.text += Environment.NewLine + "FAILED: " + error.Error;
      text.text += Environment.NewLine + error.ErrorMessage;
    });
  }

Not sure what's wrong?

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, I figured it out, I was passing in the OrderId returned from Steam instead of keeping track and passing in the original OrderId from the StartPurchase.

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

Can you provide the Title ID, PlayFab ID of the user, Order ID of the order, and the complete body of the response packet showing the failure message?

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.

SniperED007 avatar image SniperED007 commented ·

TitleId - ED6B

PlayFabId - 5B6F6F083C44D0CC

OrderId - 9A60F2537B7A612E

OrderId (from steam) - 11124157519972950318

I printed out error.GenerateErrorReport() and it says:

"OrderId: must fit within the range of UInt64"

0 Likes 0 ·

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.