update economy balances of selected players using player id

From admin point of view how to update economy balances of selected players using player id?

im here for the same question :slight_smile:

through cloud code?

yes through cloud code. I just found out today that we can’t update economy now, maybe it’ll be on the next update.

https://cloud-code-sdk-documentation.cloud.unity3d.com/economy/v2.4/currenciesapi#setPlayerCurrencyBalance
Is this useful?

have you tried this before?

const _ = require("lodash-4.17");
const { CurrenciesApi } = require("@unity-services/economy-2.4");

module.exports = async ({ params, context, logger }) => {
  // Log an info message with the parameters provided to the script and the invocation context
  const {amount} = params;
  const { CurrenciesApi } = require("@unity-services/economy-2.4");
  const { projectId, playerId, accessToken} = context;
  const currencyApi = new CurrenciesApi({ accessToken });
  const currencyId = "TEST1";
  const balance = amount;
  const currencyBalanceRequest = { currencyId, balance };
  const request = { projectId, playerId, currencyId, currencyBalanceRequest };
  const response = await currencyApi.setPlayerCurrencyBalance(request);
 
  return {
    amount : amount + 1
  };
};

I tried this on cloud code web, it worked.