次の方法で共有


Player Item Management - Subtract User Virtual Currency

NOTE: This is a Legacy Economy API, and is in bugfix-only mode. All new Economy features are being developed only for version 2. 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.

POST https://titleId.playfabapi.com/Server/SubtractUserVirtualCurrency

Request Header

Name Required Type Description
X-SecretKey True

string

This API requires a title secret key, available to title admins, from PlayFab Game Manager.

Request Body

Name Required Type Description
Amount True

number

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

PlayFabId True

string

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

VirtualCurrency True

string

Name of the virtual currency which is to be decremented.

CustomTags

object

The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).

Responses

Name Type Description
200 OK

ModifyUserVirtualCurrencyResult

400 Bad Request

ApiErrorWrapper

This is the outer wrapper for all responses with errors

Security

X-SecretKey

This API requires a title secret key, available to title admins, from PlayFab Game Manager.

Type: apiKey
In: header

Definitions

Name Description
ApiErrorWrapper

The basic wrapper around every failed API response

ModifyUserVirtualCurrencyResult
SubtractUserVirtualCurrencyRequest

ApiErrorWrapper

The basic wrapper around every failed API response

Name Type Description
code

integer

Numerical HTTP code

error

string

Playfab error code

errorCode

integer

Numerical PlayFab error code

errorDetails

object

Detailed description of individual issues with the request object

errorMessage

string

Description for the PlayFab errorCode

status

string

String HTTP code

ModifyUserVirtualCurrencyResult

Name Type Description
Balance

number

Balance of the virtual currency after modification.

BalanceChange

number

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.

SubtractUserVirtualCurrencyRequest

Name Type Description
Amount

number

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

CustomTags

object

The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).

PlayFabId

string

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

VirtualCurrency

string

Name of the virtual currency which is to be decremented.

Error Codes

Name Code
InvalidVirtualCurrency 1051
VirtualCurrencyCurrentlyUnavailable 1512