Skip to main content

Orders

Last updated on

Overview

AccelByte Foundations’ 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

  1. In the Admin Portal, choose the desired Game Title, expand the E-Commerce menu, and click Orders.

  2. 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
    StatusDescription
    ALLDisplay all orders, regardless of status.
    UnpaidUnpaid orders occur if there has been an issue with the payment process or when the player did not proceed to payment.
    PaidPaid orders are orders that have been successfully paid for.
    ChargebackChargeback 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 ReversedChargeback Reversed indicates that you have successfully disputed the chargeback request and the disputed funds have been returned to you.
    FulfilledFulfilled indicates that the order was successful and the player has been granted the item.
    Fulfill FailedFulfill 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.
    RefundingRefunding occurs when our platform has already sent a refund request to the third-party payment provider but has not yet received a notification.
    RefundedRefunded indicates that the refund for the order has been successfully processed.
    Refund FailedRefund Failed indicates that a technical issue has prevented the refund from being processed.
    ClosedClosed indicates that an order was left unpaid until it expired. Unpaid orders expire after 10 minutes.
  3. The list of Orders will appear. Click View in an order’s Action column to view more detailed information about the order.

    Query an Order

  4. 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.

    Query an Order

  5. If you click the Order History button, the player’s complete order history will appear.

    Query an Order

Download an Order Receipt

  1. In the desired Game Title, expand the E-Commerce menu and click Orders.

  2. 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.

  3. The list of orders will appea. Click View next to an order to open it.

  4. In the Order Details panel, click the Order Receipt button.

  5. The download will start immediately. The order receipt will be saved as a PDF file.

Refund an Order

  1. In the desired Game Title, expand the E-Commerce menu and click Orders.

  2. 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.

  3. The list of Orders will appear. Click View next to an order to open it.

  4. In the Order Details panel, click the Refund button.

    Refund an Order

  5. The Refund order form will appear. Type the reason for the refund in the Reason field. Once completed, click Refund.

    Refund an Order

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 Foundations E-commerce documentation.

The ordered item will be granted automatically to the player as an Entitlements after the payment is successful.

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);
}));
NOTE

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.

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);
}));

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.

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);
}));

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.

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);
}));

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.

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);
}));