Currency
Overview
AccelByte Gaming Services (AGS) Starter Currency allows you to configure the currencies you want to accept for transactions. You can configure both real-world and virtual currencies to allow your players to make transactions within your game. Making currencies is the first step to creating stores, as prices and payments rely on currency to function.
Manage Currencies in the Admin Portal
Create a Currency
After you create a currency in the Admin Portal, it becomes available to your players and can be used to make transactions. To create a new currency, follow the steps below.
In your desired game title, expand the E-Commerce menu and select Currencies.
On the Currencies page, click Add to add a new currency
The Add Currency form will appear. Fill out in the following fields:
Currency Type: Select Real if you want to create a real-world currency or Virtual if you want to create a virtual currency.
Currency Code: Input the unique identifying code for the currency. Follow ISO_4217 standardization which uses USD for the United States of America dollar. For virtual currencies, you can create your own code.
Symbol: Type the currency symbol used to denote the currency, such as $ for USD. Input Unicode if you want to add a symbol that is not on your keyboard. For virtual currencies, you can input any character combination you like, up to 8 characters.
Once completed, click Add. Your new currency will be added to the list.
Implement Currencies using the Client SDKs
Our SDK can be used to allow game clients to retrieve information about the currencies you’ve configured in the Admin Portal.
Retrieve the List of Supported Currencies
Use the following code to retrieve the list of currencies supported by a namespace. Replace MyNamespace with the name of your desired namespace.
- Unreal Engine
- Unity
FString Namespace = FString("MyNamespace");
FRegistry::Currency.GetCurrencyList(Namespace, THandler < TArray < FAccelByteModelsCurrencyList >> ::CreateLambda([](const TArray < FAccelByteModelsCurrencyList > & Result) {
// Do something if GetCurrencyList has been successful
}),
FErrorHandler::CreateLambda([](int32 ErrorCode,
const FString & ErrorMessage) {
// Do something if GetCurrencyList has an error
UE_LOG(LogTemp, Error, TEXT("Error GetCurrencyList, Error Code: %d Error Message: %s"), ErrorCode, * ErrorMessage);
}));
string @namespace = "MyNamespace";
AccelBytePlugin.GetCurrencies().GetCurrencyList(result => {
if (result.IsError) {
// Do something if GetCurrencyList has an error
Debug.Log($ "Error GetCurrencyList, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
} else {
// Do something if GetCurrencyList has been successful
}
}, @namespace);
Related Concepts
- See our AGS Starter E-commerce documentation to learn more about how to set up your in-game or online store.