Skip to main content
Version: 5.7.0

SellUserItem

Allows a quantity of a specified user item to be sold. If any quantity of the user item remains, it will be returned, potentially with the associated itemDef (with language fields limited to the current or default language), along with the currency refunded and currency balances.

ServiceOperation
userItemsSELL_USER_ITEM

Method Parameters

ParameterDescription
itemIdThe unique id of the user item.
versionThe version of the user item being sold.
quantityThe quantity of the user item to sell.
shopIdThe id identifying the store the item is being purchased from (not yet supported). Use null or empty string to specify the default shop price.
includeDefIf true and any quantity of the user item remains, the associated item definition will be included in the response.

Usage

http://localhost:3000
string itemId = "aaa-bbb-ccc-ddd";
int version = 1;
int quantity = 1;
string shopId = "";
bool includeDef = true;
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};

_bc.UserItemsService.SellUserItem(itemId, version, quantity, shopId, includeDef, successCallback, failureCallback);
JSON Response
{
"data": {
"item": {},
"currencyRefunded": {
"coins": 400
},
"currencyBalances": {
"createdAt": 1566850026783,
"currencyMap": {
"coins": {
"consumed": 200,
"balance": 3000200,
"purchased": 0,
"awarded": 3000400
}
},
"playerId": "55ffc16e-f92b-44f3-98b0-68a7a4f24106",
"updatedAt": 1566850242013
}
},
"status": 200
}