Orders
Overview
AccelByte Gaming Services (AGS) Starter Orders service enables players to order items found in your store. After a player places an order and pays for an item through the Orders service, the Fulfillment service is triggered and the player is granted their item. Player orders can be viewed and refunded in the Admin Portal.
Manage Orders in the Admin Portal
Query an Order
In the Admin Portal, choose the desired Game Title, expand the E-Commerce menu, and click Orders.
In the Orders menu, find the desired order using either the email address of the player who made the order, the Full Order ID of the order, the User ID of the player, or the Payment Processor Reference ID. You can also filter your search by order Status. Order statuses are explained in the table below. When you’re done setting your search parameters, press Enter to search.
Order Status
Status Description ALL Display all orders, regardless of status. Unpaid Unpaid orders occur if there has been an issue with the payment process or when the player did not proceed to payment. Paid Paid orders are orders that have been successfully paid for. Chargeback Chargeback indicates that the player has issued a complaint regarding the transaction to their credit card or payment provider and that they have been issued a refund. You can either accept or dispute chargebacks. Chargeback Reversed Chargeback Reversed indicates that you have successfully disputed the chargeback request and the disputed funds have been returned to you. Fulfilled Fulfilled indicates that the order was successful and the player has been granted the item. Fulfill Failed Fulfill Failed occurs when the ordered item is no longer available, so the order cannot be fulfilled. If this happens, you’ll need to refund the player for their order. Refunding Refunding occurs when our platform has already sent a refund request to the third-party payment provider but has not yet received a notification. Refunded Refunded indicates that the refund for the order has been successfully processed. Refund Failed Refund Failed indicates that a technical issue has prevented the refund from being processed. Closed Closed indicates that an order was left unpaid until it expired. Unpaid orders expire after 10 minutes. The list of Orders will appear. Click View in an order’s Action column to view more detailed information about the order.
The Order Details page will appear. Here you can see more detailed information about the order or open the player’s order history by clicking the Order History button.
If you click the Order History button, the player’s complete order history will appear.
Download an Order Receipt
In the desired Game Title, expand the E-Commerce menu and click Orders.
In the Orders menu, find the desired order using either the email address of the player who made the order, the Full Order ID of the order, the User ID of the player, or the Payment Processor Reference ID. You can also filter your search by order Status. When you’re done setting your search parameters, press Enter to search.
The list of orders will appea. Click View next to an order to open it.
In the Order Details panel, click the Order Receipt button.
The download will start immediately. The order receipt will be saved as a PDF file.
Refund an Order
In the desired Game Title, expand the E-Commerce menu and click Orders.
In the Orders menu, find the desired order using either the email address of the player who made the order, the Full Order ID of the order, the User ID of the player, or the Payment Processor Reference ID. You can also filter your search by order Status. When you’re done setting your search parameters, press Enter to search.
The list of Orders will appear. Click View next to an order to open it.
In the Order Details panel, click the Refund button.
The Refund order form will appear. Type the reason for the refund in the Reason field. Once completed, click Refund.
Implement Orders using the Client SDKs
Our SDKs can be used to allow game clients to create orders.
Create an Order
Use the following function to create an order. When an order is created, the ordered items are identified by their Item IDs, a unique identifier created by our platform for each item you create. For more information about items, see our AGS Starter E-commerce documentation.
The ordered item will be granted automatically to the player as an Entitlements after the payment is successful.
- Unreal Engine
- Unity
FAccelByteModelsOrderCreate OrderCreate;
// You can check the link above to see the catalog documentation to get more information about the item, the item information need to fill up the order create request
OrderCreate.ItemId = FString("SomeItemId");
OrderCreate.Price = 500;
OrderCreate.Region = FString("SomeRegion");
OrderCreate.Language = FString("SomeLanguage");
OrderCreate.Quantity = 2;
OrderCreate.CurrencyCode = FString("SomeCurrencyCode");
OrderCreate.DiscountedPrice = 200;
OrderCreate.ReturnUrl = FString("https://accelbyte.io");
FRegistry::Order.CreateNewOrder(OrderCreate, THandler<FAccelByteModelsOrderInfo>::CreateLambda([](const FAccelByteModelsOrderInfo& Result)
{
// Do something if CreateNewOrder has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if CreateNewOrder has an error
UE_LOG(LogTemp, Log, TEXT("Error CreateNewOrder, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
OrderRequest orderRequest = new OrderRequest
{
// You can check the link above about the catalog to get the item information that the player gonna create the order
itemId = "SomeItemId",
price = 200,
currencyCode = "SomeCurrencyCode",
quantity = 2,
discountedPrice = 200,
language = "SomeLanguage",
region = "SomeRegion",
returnUrl = "https://accelbyte.io"
};
AccelBytePlugin.GetOrders().CreateOrder(orderRequest, result =>
{
if (result.IsError)
{
// Do something if CreateOrder has an error
Debug.Log($"Error CreateOrder, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if CreateOrder has been successful
}
});
If you encounter the following error, it means that the player already owns the maximum number of the items that they can own or purchase. You can verify this using the Check Entitlement function.
ErrorCode.ExceedItemMaxCountPerUser
Cancel an Order
Use the following code to allow players to cancel orders they’ve made in-game.
- Unreal Engine
- Unity
FString OrderNo = "MyOrderNumber";
FRegistry::Order.CancelOrder(OrderNo, THandler<FAccelByteModelsOrderInfo>::CreateLambda([](const FAccelByteModelsOrderInfo& OnError)
{
// Do something if CancelOrder has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if CancelOrder has an error
UE_LOG(LogTemp, Log, TEXT("Error CancelOrder, Error Code: %d, Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string orderNo = "MyOrderNumber";
AccelBytePlugin.GetOrders().CancelOrder(orderNo, result =>
{
if (result.IsError)
{
// Do something if CancelOrder has an error
Debug.Log($"Error CancelOrder, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if CancelOrder has been successful
}
});
Retrieve an Order
Use the following function to retrieve information about a particular order. The order number is used to retrieve information about the order, including the User ID of the player that made the order, the Item ID of the item ordered, the price of that item, the current Status of the order, and other information.
- Unreal Engine
- Unity
FString OrderNo = "MyOrderNumber";
FRegistry::Order.GetUserOrder(OrderNo, THandler<FAccelByteModelsOrderInfo>::CreateLambda([](const FAccelByteModelsOrderInfo& Result)
{
// Do something if GetUserOrder has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetUserOrder has an error
UE_LOG(LogTemp, Log, TEXT("Error GetUserOrder, Error Code: %d, Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string orderNo = "MyOrderNumber";
AccelBytePlugin.GetOrders().GetUserOrder(orderNo, result =>
{
if (result.IsError)
{
// Do something if GetUserOrder has an error
Debug.Log($"Error GetUserOrder, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if GetUSerOrder has been successful
}
});
Retrieve a List of a Player’s Orders
Use the following function to retrieve a list of all of the orders a player has made. The list will include the User ID of the player, the Item IDs of the items ordered, the prices of each item, the current status of any orders, and other information.
You can define the pagination of these records by setting the Page and Size parameters in the function below. Page refers to the offset, or which record you want to start on, and Size dictates how many records will be displayed per page, e.g, if you set Page to 1 and Size to 5, the player’s orders will be displayed starting from their first order, with five orders appearing on each page.
- Unreal Engine
- Unity
int32 Page = 2;
int32 Size = 5;
FRegistry::Order.GetUserOrders(Page, Size, THandler<FAccelByteModelsPagedOrderInfo>::CreateLambda([](const FAccelByteModelsPagedOrderInfo& Result)
{
// Do something if GetUserORders has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetUserOrders has an error
UE_LOG(LogTemp, Log, TEXT("Error GetUserOrders, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
uint page = 2;
uint size = 5;
AccelBytePlugin.GetOrders().GetUserOrders(page, size, result =>
{
if (result.IsError)
{
// Do something if GetUserOrders has an error
Debug.Log($"Error GetUserORders, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if GetUserOrders has been successful
}
});
Retrieve a Player’s Complete Order History
Use the following function to retrieve a player’s order history. Each order the player has made will be listed, along with the status of each order throughout the order process.
- Unreal Engine
- Unity
FString OrderNo = FString("MyOrderNumber");
FRegistry::Order.GetUserOrderHistory(OrderNo, THandler<TArray<FAccelByteModelsOrderHistoryInfo>>::CreateLambda([](const TArray<FAccelByteModelsOrderHistoryInfo>& Result)
{
// Do something if GetUserOrderHistory has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetUserOrderHistory has an error
UE_LOG(LogTemp, Log, TEXT("Error GetUserORderHistory, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string orderNo = "MyOrderNumber";
AccelBytePlugin.GetOrders().GetUserOrderHistory(orderNo, result =>
{
if (result.IsError)
{
// Do something if GetUserOrderHistory has an error
Debug.Log($"Error GetUserOrderHistory, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if GetUSerOrderHistory has been successful
}
});