hi, the code is attached to screenshots. get draft item is working fine, but i think the setup for price options is not right and hence giving errors. Please help ! thanks for answers
hi, the code is attached to screenshots. get draft item is working fine, but i think the setup for price options is not right and hence giving errors. Please help ! thanks for answers
For UGC items created through the API but without setting the PriceOption property in the API request, if you never save the item in Game Manager and never update the item's PriceOption using the API, the PriceOption property of the item is null, in this case, the PriceOption property and the Price property need to be initialized before adding a new price. So, you may need to add some checking code in your AzureFunction to check if PriceOption and Price are null. Here is the checking code:
hi, thanks for replies -- status is ok but now i'm getting this error. I even tried to comment cp.UnitAmount = 1 to see if that is causing issue but with it commenting too, same error i am getting.
The error message indicates that there are two identical prices in the Prices list in the UpdateDraftItem API request body. So, if you want to add a new price for the Item, you may first check if the price already exists in the Prices list. If you want to modify an existing price in the Prices list, you can directly traverse the Prices list and modify it.
thankyou, now it's working -- directly from unreal engine, i am able to create ugc item and add price too via azure function along with unit amount, everything works -- thank you so much guys !!
All that looks correct, but it seems to be hitting an error. The only thing I can think of is maybe cp.Amounts
, Item.PriceOptions
, or PriceOptions.Prices
are null and need initializing.
hi, so shall i keep like this cp.Amounts = null or ? i'm sorry as i'm fairly new to c#
Update: Sorry for the confusion, I was testing with an older version of PlayFabAllSDK which didn't have the UnitAmount property in CatalogPrice. I retest with the latest SDK and update the working code below.
You may initialize the cp.Amounts like this: cp.Amounts = new List<CatalogPriceAmount>{cpa};
Also, there is no UnitAmount property in the CatalogPrice object. And here is the working code you may refer to:
thank you , it worked but in postman results, unit amount showed null and so i uncommented cp.UnitAmount = 1 just to see, but it gave bad request error. Maybe the code to set unit amount is wrong ?
48 People are following this question.