Subtract Currency
API to subtract player's currency.
URL Verification
This API uses the service-api.playnanoo.com domain.
API Information
- URL:
https://service-api.playnanoo.com/currency/v20250301/subtract - Method:
PUT - Authentication Required: Yes
DeviceInfo Inheritance
The Req class of this API inherits from DeviceInfo. All properties of DeviceInfo are automatically included.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| currency_code | string | Required | Currency code |
| currency_amount | double | Required | Amount of currency to subtract |
Response Data
Res Class
| Field | Type | Description |
|---|---|---|
| currency_amount | double | Currency amount owned after subtraction |
Unity C# Implementation
BaseResponse Class
Base class for all API responses.
public class BaseResponse
{
public string ErrorCode;
public string Message;
public string WithdrawalKey;
public string BlockKey;
}
Field descriptions:
ErrorCode: Error codeMessage: Error messageWithdrawalKey: Key required for recovery if account is in withdrawal grace period (provided only for accounts in withdrawal grace period)BlockKey: Key provided for blocked accounts (provided only for blocked accounts)
Subtract Currency Class
using System;
using System.Collections;
using UnityEngine.Networking;
public class CurrencySubtract
{
static string path = "https://service-api.playnanoo.com/currency/v20250301/subtract";
[Serializable]
public class Req : DeviceInfo
{
public string currency_code;
public double currency_amount;
public IEnumerator Send(string currencyCode, double currencyAmount, Action<Res> onSuccess, Action<BaseResponse> onError)
{
if (!string.IsNullOrEmpty(currencyCode)) this.currency_code = currencyCode;
this.currency_amount = currencyAmount;
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
path,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}
[Serializable]
public class Res : BaseResponse
{
public double currency_amount;
}
}
Usage Example
public void SubtractCurrency()
{
CurrencySubtract.Req req = new CurrencySubtract.Req();
StartCoroutine(req.Send(
currencyCode: "GOLD",
currencyAmount: 100,
onSuccess: res =>
{
Debug.Log("Subtract currency successful");
Debug.Log($"GOLD owned after subtraction: {res.currency_amount}");
},
onError: error =>
{
Debug.LogError($"Subtract currency failed: [{error.ErrorCode}] {error.Message}");
}
));
}
Insufficient Currency
An error will occur if there is not enough currency to subtract. Make sure you have sufficient currency before subtracting.
Subtract Currency
This API subtracts the player's currency. It returns the remaining currency amount after subtraction in the response.