question

kareembelgharbi avatar image
kareembelgharbi asked

Trading Unavailable

Whenever I open a trade (or use any other part of the trading API for that matter) I get an error that looks like this:

PlayFabError(ServiceUnavailable, 500 Internal Server Error, 400 BadRequest) UnityEngine.Debug:LogError(Object) PlayFab.Internal.<MakeApiCall>c__AnonStorey1:<>m__1(String) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWWW.cs:128) PlayFab.Internal.<Post>c__Iterator0:MoveNext() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabWWW.cs:140) UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

This is with Unity WWW, I also tried using UnityWebRequest and it still doesn't work.

unity3dTrading
10 |1200

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

1 Answer

·
pfnathan avatar image
pfnathan answered

All of our API calls in that SDK use the same pattern: You create a request object, fill it out, and then pass it to the function along with your callbacks. Here's the example from the testing sample in our Unity SDK (https://github.com/PlayFab/UnitySDK/blob/56b2daf8f1d2c5bb56fda287d2cde4da6f5d4038/PlayFabCombinedTestingSample/Assets/PlayFabSDK/Examples/API/Client/TradeExample.cs)

public static void OpenTrade(params string[] offeredInventoryInstanceIds)

{

var openRequest = new ClientModels.OpenTradeRequest();

// Optional field: null is anybody, alternately if specified, this is a targeted trade request

// In this example, we restrict the trade to ourselves (because I don't have multiple clients for this example)

// A normal trade process would use all the same steps, but would interact between multliple clients

openRequest.AllowedPlayerIds = new List<string>() { PfSharedModelEx.globalClientUser.playFabId };

// Offering the items you have

openRequest.OfferedInventoryInstanceIds = new List<string>();

openRequest.OfferedInventoryInstanceIds.AddRange(offeredInventoryInstanceIds);

// Listing the items you want

openRequest.RequestedCatalogItemIds = new List<string>() { PfSharedModelEx.swillItemId };

PlayFabClientAPI.OpenTrade(openRequest, OpenTradeCallback, PfSharedControllerEx.FailCallback("OpenTrade"));

}

11 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.

kareembelgharbi avatar image kareembelgharbi commented ·

I've been using the SDK for a while now, I used to have trading working just fine until I tried it a few weeks ago. This is the code I'm using:

var tradeRequest = new OpenTradeRequest()

{

OfferedInventoryInstanceIds = new List<string>() { "ED618519AC6D9E17" }, RequestedCatalogItemIds = new List<string>() { "sniper" }

};

PlayFabClientAPI.OpenTrade(

tradeRequest,

result => print(result.Trade.TradeId),

Debug.LogError

);

0 Likes 0 ·
pfnathan avatar image pfnathan ♦ commented ·

A 500 error indicates that something unpredicted went wrong in the call. Can you provide the full response body, including the RequestID?

0 Likes 0 ·
kareembelgharbi avatar image kareembelgharbi pfnathan ♦ commented ·

Here you go (using Postman):

{ "code": 500, "status": "InternalServerError", "error": "InternalServerError", "errorCode": 1110, "errorMessage": "An unexpected error occured while processing the request.", "errorHash": "d7acf222bdaeef059ad91938d9666d37", "errorDetails": { "RequestID": [ "832f3b62b4054394b251e38e4874fc25" ] } }

0 Likes 0 ·
pfnathan avatar image pfnathan ♦ commented ·

Thank you for your prompt response on this issue. We have confirmed that this is a bug on our end and filed a bug report.

0 Likes 0 ·
kareembelgharbi avatar image kareembelgharbi commented ·

Thank you for your help.

0 Likes 0 ·
kareembelgharbi avatar image kareembelgharbi commented ·

Just leave a comment here when it gets fixed.

0 Likes 0 ·
Show more comments

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.