GS2-Money
Tip
GS2-Money2 is a microservice that, as the name suggests, corresponds to version 2.
See GS2-Money for documentation on previous versions.
This function handles in-game resources that have a value equivalent to cash. Be sure to use this function when handling resources that are considered prepaid (home-grown) under the Japanese Funds Settlement Act.
Balance
GS2-Money2 does not manage the balance of the player’s billable currency in simple quantities, but manages quantities by value at the time of purchase.
For example, if a player purchases 100 units of billable currency for 1USD, the value of one unit of billable currency is equivalent to 0.01USD. At the same time, let’s say you can purchase 1,200 pieces of billable currency for 10USD. One way to handle this is to set the unit price of the currency at 0.01USD and treat the 200 units as free as extras, or to treat them at a different unit price of 0.008334USD if purchased for 10USD.
If the latter method is adopted, GS2-Money2 has the ability to separately manage the “balance of paid currency with a unit price of 0.01USD” and “balance of paid currency with a unit price of 0.008334USD” respectively.
What are the advantages of choosing the latter?
Obviously, the latter is more complicated to account for and may seem to offer no advantages. As a service provider, you are absolutely right. However, let’s change the position and consider it from the perspective of a game player.
Some games have a billed currency (a.k.a. free currency) that has a cash equivalent value of zero USD distributed by the management. To encourage players to purchase the currency, let’s assume that the game sells attractive products that can only be purchased with the paid currency (a.k.a. paid currency) for 300 pieces of the paid currency.
If a player purchases 1,200 pieces of paid currency for 10USD and is given 1,000 pieces of paid currency and 200 pieces of free currency, then The player can only purchase 3 times the item that can be purchased with 300 units of paid currency. On the other hand, if the player treats all 1,200 units as paid currency at a unit price of 0.008334USD, the player can purchase the item four times. This difference has some impact on player psychology.
The specification should be carefully considered whether to give priority to accounting convenience or player profit.
Slots
GS2-Money2 supports multiple wallets. The key to differentiating between multiple wallets is the slot.
This feature exists to comply with the policies of some platforms that do not allow users to bring in paid currency purchased on other platforms.
However, these policies only apply to paid currency, so for free currency there is a feature that can be used by all slots.
Purchased currency
GS2-Money2 has changed from GS2-Money in that it can now hold billing currency purchased in multiple currencies in a single wallet.
Consumption Priority
When players spend billed currency, they can choose whether to give priority to free currency or paid currency. Generally, the free currency is given priority, but for accounting reasons, the paid currency may be given priority.
When consuming paid-for currency, the oldest deposit is consumed first.
Receipt validation
We have the ability to validate receipts received when purchasing additional content from game distribution platforms. The receipt is checked to ensure that it was issued by the correct platform operator and that it has not been used in the game in the past.
This feature helps prevent attacks that attempt to use fraudulent receipts to obtain billable currency.
Transaction Log
In addition to the receipt verification history, all additions and subtractions of billing currency are recorded. And several times a day, we calculate how much unused billing currency is currently pooled in the game in the form of cash equivalents.
Depending on the situation, it may be necessary to take steps to deposit a portion of the unused balance with a third-party institution, and the results of this calculation can be used at that time.
Legal Procedures
GS2-Money2 collects the data required for various legal processes and makes it available through the API, but the legal process itself must be performed by you, or your organization.
GS2 is not responsible for, and cannot advise you on, what procedures are required. Please consult with your legal counsel.
Implementation Example.
Retrieve balance
var item = await gs2.Money2.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Wallet(
slot: 0
).ModelAsync();
const auto Domain = Gs2->Money2->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Wallet(
0 // slot
);
const auto item = Domain.Model();
Adding balances
The SDK for the game engine cannot handle the process of adding the balance.
Please implement it by adding the balance as a reward for GS2-Showcase purchases.
Spending the balance
We do not recommend using this API to spend balances. It is recommended that you perform some kind of processing instead of consuming the billed currency through GS2-Showcase or other services.
var result = await gs2.Money2.Namespace(
namespaceName: "namespace-0001"
).Me(
gameSession: GameSession
).Wallet(
slot: 0
).WithdrawAsync(
withdrawCount: 50,
paidOnly: false
);
var item = await result.ModelAsync();
const auto Future = Gs2->Money2->Namespace(
"namespace-0001" // namespaceName
)->Me(
AccessToken
)->Wallet(
0 // slot
)->Withdraw(
50,
nullptr // paidOnly
);
Future->StartSynchronousTask();
if (Future->GetTask().IsError()) return false;