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

This API must be enabled for use as an option in the game manager website. It is disabled by default.

SubtractUserVirtualCurrencyRequest
Request Properties
Amount (required) int32

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

VirtualCurrency (required) String

Name of the virtual currency which is to be decremented.

POST https://{{TitleID}}.playfabapi.com/Client/SubtractUserVirtualCurrency
    Content-Type: application/json
    X-Authentication: <user_session_ticket_value>
{
  "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

SessionTicket

Possible Error Codes

Name Code
APINotEnabledForGameClientAccess 1082
InvalidVirtualCurrency 1051