Orders
Overview
Players can acquire an item found in your store by ordering it. After a player places an order for an item and pays for it, the Cloud Fulfillment service is triggered and the player is granted the item they ordered.
- Player orders can be viewed and refunded from the Admin Portal.
Permissions
Permissions are used to grant access to specific resources within our services. Make sure your account has the following permissions before you attempt to manage orders in the Admin Portal. For a full list of permissions that impact orders management, see the Platform/Commerce tab of the permissions reference.
Usage | Permission Tag | Action |
---|---|---|
Query user orders | ADMIN:NAMESPACE:{namespace}:USER:{userId}:ORDER | Read |
Get user orders history | ADMIN:NAMESPACE:{namespace}:USER:{userId}:ORDER | Read |
Download user order receipt | ADMIN:NAMESPACE:{namespace}:USER:{userId}:ORDER | Read |
Refund order | ADMIN:NAMESPACE:{namespace}:USER:{userId}:ORDER | Update |
Permissions work slightly differently depending on whether they are assigned to IAM Clients or Roles assigned to users. For more information, read the Authentication and Authorization documentation.
Manage Orders in the Admin Portal
Query an Order
In the Admin Portal, choose the Publisher Namespace.
Go to the E-Commerce section and open the Orders menu.
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 who made the order, or the Payment Processor Reference ID. You can also filter your search by order Status. The possible order statuses are explained in the table below. When you're done setting your search parameters, press Enter.
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 the chargeback. Chargeback Reversed Chargeback Reversed indicates that you have successfully disputed a 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 the order. Refunding Refunding occurs when our platform has already sent a refund request to the 3rd 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 has been left unpaid for so long that it's expired. Unpaid orders expire after 10 minutes. The list of orders will appear. Click View in an order's Action column to open more detailed information about the order.
The Order Details page will appear. Here you can see more detailed information about the order. You can also open the player's order history by clicking the Order History button.
Click the Order History button so see a complete order history for the selected player.
Download an Order Receipt
In the Admin Portal, choose the Publisher Namespace.
Go to the E-Commerce section and open the Orders menu.
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 who made the order, or the Payment Processor Reference ID. You can also filter your search by order Status. The possible order statuses are explained in the table below. When you're done setting your search parameters, press Enter.
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 the chargeback. Chargeback Reversed Chargeback Reversed indicates that you have successfully disputed a 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 the order. Refunding Refunding occurs when our platform has already sent a refund request to the 3rd 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 has been left unpaid for so long that it's expired. Unpaid orders expire after 10 minutes. The Orders list will appear. 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 Admin Portal, choose the Publisher Namespace.
Go to the E-Commerce section and open the Orders menu.
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 who made the order, or the Payment Processor Reference ID. You can also filter your search by order Status. The possible order statuses are explained in the table below. When you're done setting your search parameters, press Enter.
The Orders list 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 Client SDKs
Our SDK can be used to allow a game client to create an order.
Create an Order
The following function can be triggered to create an order. When an order is created, the ordered items will be identified by their Item IDs, a unique identifier created by our platform for each item you create. For more information about items, see the Catalog documentation.
The ordered item will be granted automatically to the player as an Entitlement 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 item that they can. You can verify this using the Check Entitlement function.
ErrorCode.ExceedItemMaxCountPerUser
Cancel an Order
You can 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
Call this function to retrieve information about a particular order. The order number is used to retrieve the information about the order. That information includes 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
This function returns a list of all of the orders the player has made. The list will include 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. 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, whereas Size refers to how many records will be displayed per page. So for example, 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
This function can be used to retrieve a player's order history. Each order the player has made will be listed, along with the status each order went through and at what time. For example, precise timestamps will be given for when each order was Unpaid, Paid, Fulfilled, and so on.
- 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
}
});
Related Concepts
- Read Wallets to learn more about how users can store virtual currency they can use to make orders.
- Read more about Fulfillment.