question

Kevin avatar image
Kevin asked

Economy v2: "for amount" missing from API response

Say we have a currency called "COINS" with an ID of "abc-123" and we create a draft item "Box" in the Game Manager. We can add multiple prices, each with a "For Amount". For example, our prices might look like this:

6055-prices.png

Then we can use the Get Draft Items API call to get the item. The retrieved CatalogItem has a PriceOptions field which is a CatalogPriceOptions which has an array of CatalogPrice which each has an array of CatalogPriceAmount which has an Amount and an Item ID. Using the above example, our Box would have three CatalogPriceAmounts:

  • ItemId: abc-123, Amount: 100

  • ItemId: abc-123, Amount: 180

  • ItemId: abc-123, Amount: 250

As far as I can tell, the "For Amount" field from the Game Manager, which should be 1, 2, and 3 respectively, is not present in the data we get from the API. We now have a list of prices for different quantities of Box, but no indication of how many Boxes we get for each price.

Is this a flaw in the API, or are the "For Amount" values tucked away somewhere else where they're hard to find?

apisIn-Game Economy
prices.png (13.5 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.

1 Answer

·
Neils Shi avatar image
Neils Shi answered

In fact, the "For Amount" field is contained in the “PriceOptions” field you mentioned. The “UnitAmount” represents the "For Amount". For more info, you can refer to my request’s response. 6056-test1.png

 "PriceOptions": {
                     "Prices": [
                         {
                             "UnitAmount": 2,
                             "Amounts": [
                                 {
                                     "ItemId": "5d04207c-ee8d-46c2-8948-xxxxxxxxxxxx",
                                     "Amount": 3
                                 }
                             ]
                         },
                         {
                             "UnitAmount": 4,
                             "Amounts": [
                                 {
                                     "ItemId": "5d04207c-ee8d-46c2-8948- xxxxxxxxxxxx ",
                                     "Amount": 5
                                 }
                             ]
                         },
                         {
                             "UnitAmount": 8,
                             "Amounts": [
                                 {
                                     "ItemId": "5d04207c-ee8d-46c2-8948- xxxxxxxxxxxx ",
                                     "Amount": 8
                                 }
                             ]
                         }
                     ]
                 }

test1.png (9.6 KiB)
4 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.

Kevin avatar image Kevin commented ·

I posted a comment a few minutes ago but now it's not showing up; I'm not sure if it is pending or was lost to the void. Anyway:

The UnitAmount field is not present in the documentation that you linked to, nor in the documentation for Get Entity Draft Items. In the PlayFab Unity SDK v2.157.230529, there is no UnitAmount field in the corresponding data structure.

However, I just noticed that the UnitAmount field appears to have been added in v2.168.230609, which apparently was published the day after I downloaded the SDK and I hadn't realized was available until now.

Which brings up another point - no one is actually writing release notes for the SDK. We shouldn't have to read through every commit diff in full to understand what's changing in each update. It's extremely easy to miss a single line like the addition of the UnitAmount field.

0 Likes 0 ·
kylemc@microsoft.com avatar image kylemc@microsoft.com Kevin commented ·

Honestly, I was shocked you found the feature so quickly :D. We were rolling it out last week and the coordination between API, UX, and Doc release schedules can take up to 2 weeks.

Clearly nobody has been writing release notes for a while now. I'll see if I can track down who is responsible for keeping them up-to-date.

1 Like 1 ·
Neils Shi avatar image Neils Shi Kevin commented ·

Thanks for pointing this out. Sorry for the inconvenience.

0 Likes 0 ·
Kevin avatar image Kevin commented ·

@Neils Shi Well, that confirms that this is a bug. If you do a page search on the "Get Draft Items" API page that you linked to, or the "Get Entity Draft Items" field, you will see that there is no "UnitAmount" field.

This field is not present in the GetDraftItemsResponse or GetEntityDraftItemsResponse we get in Unity.

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.