Skip to main content
Version: SDK-5.11.6

UseTBC

public BackendReturnObject UseTBC(string uuid);
public BackendReturnObject UseTBC(string uuid, string details);

Parameters

ValueTypeDescription
uuidstringGetProductList's BRO Return Value > JsonArray >(JsonObject) inDate > value
detailsstring(Optional) Additional information to be stored in TBC usage history

Description

You can purchase a game item using its uuid.
The game item uuid can be obtained via TBC.GetProductList().
TBC of the item will be subtracted from the game user's TBC.

Example

Synchronous

string uuid = Backend.TBC.GetProductList().Rows()[0]["uuid"]["S"].ToString();
Backend.TBC.UseTBC(uuid);
Backend.TBC.UseTBC(uuid , "Purchase Long Sword");

Asynchronous

Backend.TBC.GetProductList((callback) =>
{
string uuid = callback.Rows()[0]["uuid"]["S"].ToString();

Backend.TBC.UseTBC(uuid, (callback) =>
{
// Post-process
});

Backend.TBC.UseTBC(uuid , "Purchase Long Sword", (callback) =>
{
// Post-process
});
}

SendQueue

SendQueue.Enqueue(Backend.TBC.GetProductList, (callback) =>
{
string uuid = callback.Rows()[0]["uuid"]["S"].ToString();

SendQueue.Enqueue(Backend.TBC.UseTBC, uuid, (callback) =>
{
// Post-process
});

SendQueue.Enqueue(Backend.TBC.UseTBC, uuid , "Purchase Long Sword", (callback) =>
{
// Post-process
});
}

Return cases

Success cases

When the item is purchased successfully
statusCode : 201
message : Success returnValue : { usedTBC: 450, amountTBC: 947.047 }

Error cases

When there is not enough TBC to purchase the cash item of the corresponding uuid
statusCode : 400
errorCode : BadParameterException
message : bad usedTBC, Invalid usedTBC

When there is an attempt to purchase a non-existent item
statusCode : 404
errorCode : NotFoundException
message : proudctId not found, proudctId cannot be found