In-App Purchase
Implementing Noctua Gold
Displaying Noctua Gold In-Game
To get noctua gold, use the GetNoctuaGold
method provided by the Noctua SDK.
try {
NoctuaGoldData noctuaGold = await Noctua.IAP.GetNoctuaGold();
Debug.Log(noctuaGold.VipLevel);
Debug.Log(noctuaGold.GoldAmount);
Debug.Log(noctuaGold.BoundGoldAmount);
Debug.Log(noctuaGold.TotalGoldAmount);
Debug.Log(noctuaGold.EligibleGoldAmount);
} catch(Exception e) {
if (e is NoctuaException noctuaEx)
{
Debug.Log("NoctuaException: " + noctuaEx.ErrorCode + " : " + noctuaEx.Message);
outputConsole.text = "NoctuaException: " + noctuaEx.ErrorCode + " : " + noctuaEx.Message;
} else {
Debug.Log("Exception: " + e);
outputConsole.text = "Exception: " + e;
}
}
This method retrieves noctua gold data. You can use EligibleGoldAmount
to display the user's Noctua Gold balance in your in-game UI.
When to use
You need to call this API each time you want to display the user's Noctua Gold balance, as well as during these operations:
- Before displaying in-game item list
- After successful purchase