Documentation

SubtractUserVirtualCurrency

Decrements the user's balance of the specified virtual currency by the stated amount. It is possible to make a VC balance negative with this API.

Request Details

SubtractUserVirtualCurrencyRequest
Request Properties
Amount (required) int32

Amount to be subtracted from the user balance of the specified virtual currency.

PlayFabId (required) String

PlayFab unique identifier of the user whose virtual currency balance is to be decreased.

VirtualCurrency (required) String

Name of the virtual currency which is to be decremented.

POST https://{{TitleID}}.playfabapi.com/Server/SubtractUserVirtualCurrency
    Content-Type: application/json
    X-SecretKey: <developer_secret_key>
{
  "PlayFabId": "20394883",
  "VirtualCurrency": "GC",
  "Amount": 100
}
        

Response Details

ModifyUserVirtualCurrencyResult
Result Properties
Balance (required) int32

Balance of the virtual currency after modification.

BalanceChange (required) int32

Amount added or subtracted from the user's virtual currency. Maximum VC balance is Int32 (2,147,483,647). Any increase over this value will be discarded.

PlayFabId String

User currency was subtracted from.

VirtualCurrency String

Name of the virtual currency which was modified.

Sample Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
  "code": 200,
  "status": "OK",
  "data": {
    "PlayFabId": "B456AE0",
    "VirtualCurrency": "GC",
    "BalanceChange": 10,
    "Balance": 1500
  }
}

Authentication

SecretKey

Possible Error Codes

Name Code
InvalidVirtualCurrency 1051