question

benjigamedev avatar image
benjigamedev asked

Addcurrency not working

Hello,

I tried the code from your thread,

  1. voidAddCurrency()
  2. {
  3. AddUserVirtualCurrencyRequest request =newAddUserVirtualCurrencyRequest();
  4. request.VirtualCurrency="CU";//put your virtual currency code here
  5. request.Amount=100;//put the amount in here
  6. PlayFabClientAPI.AddUserVirtualCurrency(request,_OnAddCurrencyResult,_OnPlayFabError);
  7. }
  8. void_OnAddCurrencyResult(ModifyUserVirtualCurrencyResult _thisResult)
  9. {
  10. //Do all your successful handling in here
  11. Debug.Log("User has a current balance of: "+ _thisResult.Balance+" ("+ _thisResult.VirtualCurrency+") after this change: "+ _thisResult.BalanceChange);
  12. }
  13. void_OnPlayFabError(PlayFabError _thisErrorResult)
  14. {
  15. //Do all your error handling in here.
  16. Debug.LogWarning("Got an error: "+ _thisErrorResult.ErrorMessage);
  17. }

which is not working for me....

the onaddcurrencyresult is never called

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

What is the error you're getting back? Did you turn on the client's ability to use the Add call? Bear in mind that dangerous calls like this (add/subtract currency, starting custom game server sessions, etc.) are all turned off by default. You can turn them on in the Settings->API Features tab.

2 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.

benjigamedev avatar image benjigamedev commented ·

i didnot turn them on ! thanks! do i need to do this also for opencontainer items?

0 Likes 0 ·
brendan avatar image brendan benjigamedev commented ·

No, only for the API calls you see on the Settings->API Features tab.

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.