question

Grant McNamara avatar image
Grant McNamara asked

What is wrong with the Javascript SDK AddUserVirtualCurrency?

I am trying to use the AddUserVirtualCurrency sdk function but its not working. I have it formatted right and everything is correct.

function rc(response,error){
  if (error){
    console.log(error)
  }
}
function reward(){
  var xauth=localStorage.SessionTicket;
  var head={"X-Authorization":xauth};
  var r={"Amount":100,"VirtualCurrency":"RT"};
  PlayFabClientSDK.AddUserVirtualCurrency(r,rc,extraHeaders=head)
}

I checked xauth and its a correct session ticket.

I have no idea whats going wrong.

Account Management
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

·
Seth Du avatar image
Seth Du answered

By default, players(clients) are not allowed to add VC on their own, which obviously will cause financial system to collapse in the game. Hence this kind of action can only be performed by administrator (server/admin API).

If you intend to do so, you may navigate to [Game Manager] -> [Title Settings] -> [API Features] to enable the permission.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

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.