question

Jorge Ramirez avatar image
Jorge Ramirez asked

PurchaseItem()'s customData And ExtraHeaders Parameters in Unity SDK, how do they work?

Hello!.

I have a doubt with some parameters in the PurchaseItem() method in Unity's playfab SDK. I can purchase successfully in my project with playfab, but I need to add some custom values on my item that I just bought, I have a CloudScript that does just that exactly (with UpdateUserInventoryItemCustomData), but I just saw that PurchaseItem() has this two parameters (customData and extraHeaders) that I assumed was like sending an object to add their properties as Cutom Data to the Item, but it seems it's not doing it.

my questions are:
this two values, what are their function? How can I make them work?
I just read an answer that says that I can use PlayStream Rules, and I guess I will use it, but, is any way to do it from the Client's API?
Where can I find documentation to study other methods with this kind of function properties that I don't know how to use?


Thanks a lot for this great platform, and hope you can help me.

unity3dsdks
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

·
brendan avatar image
brendan answered

Those values are specific to the SDKs. For folks not familiar with using lanbda-style functions, we added customData. In short, it's whatever data you want to tag onto the call, and then get back with the response, so that you know what call triggered it. The extraHeaders property is simply that - extra headers for the API call. It was added to support double encrypted logins. The details on these are in our release notes, here: https://api.playfab.com/releaseNotes#170925.

And yes, you can use PlayStream Actions triggered by Rules, though bear in mind that triggered Cloud Scripts have much shorter runtime limits, so you'll need to be cautious about making a minimum of calls to the Server API. But no, there is no API call to update an inventory item's custom data from the Client API, as we haven't had folks ask for that (likely because anything the client can be authoritative concerning is trivially cheatable).

In general, the documentation for use of the API calls is specifically what you see in the API documentation, here: https://api.playfab.com/documentation/Client. For anything that's not clear, posting a question to the forums is going to be your best bet.

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.