question

removed avatar image
removed asked

How can I get the recharge time of a currency?

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

The virtual currency balances for the player, as well as their recharge times are returned as part of the player inventory: https://api.playfab.com/Documentation/Client/method/GetUserInventory.

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.

removed avatar image removed commented ·

According to that page, it returns a VirtualCurrencyRechargeTime object with 3 properties. 2 of which are:

        /// <summary>
        /// Time remaining (in seconds) before the next recharge increment of the virtual currency.
        /// </summary> 
public int SecondsToRecharge;
/// <summary> /// Server timestamp in UTC indicating the next time the virtual currency will be incremented. /// </summary>
public DateTime RechargeTime;

But I'd like to know how long it takes for a currency to recharge 1 unit and not the time remaining until it recharges 1 unit.

0 Likes 0 ·
brendan avatar image brendan removed commented ·

Ah, I see - so you want to be able to query the definition of the virtual currency, similar to the Admin API call ListVirtualCurrencyTypes. Right now, you would need to put that info in Title Data, as the currency definition isn't exposed via the Client or Server API. I'll add a backlog item to have it added to the Server API, so that you can query it in Cloud Script.

0 Likes 0 ·
removed avatar image removed brendan commented ·

OK I see. Btw, is the Recharge Maximum on a Virtual Currency is a daily maximum?

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.