Skip to main content
Version: 6.0.0

BuyProduct

public BackndReturnObject BuyProduct(string uuid);
public BackndReturnObject BuyProduct(string uuid, string details);

Parameters

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

Description

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

Example

Synchronous

string uuid = Backnd.GameCash.GetProductList().Rows()[0]["uuid"]["S"].ToString();
Backnd.GameCash.BuyProduct(uuid);
Backnd.GameCash.BuyProduct(uuid , "Purchase Long Sword");

Asynchronous

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

Backnd.GameCash.BuyProduct(uuid, (callback) =>
{
// Post-process
});

Backnd.GameCash.BuyProduct(uuid , "Purchase Long Sword", (callback) =>
{
// Post-process
});
}

Return cases

Success cases

When the item is purchased successfully
statusCode : 201

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

When there is an attempt to purchase a non-existent item
statusCode : 404
errorCode : NotFoundException