Skip to main content

Implement Fulfillment on a Game Server

Last updated on November 4, 2026

Overview​

This article walks you through how to implement code redemption and how to enable your game server to grant items to your players.

Code redemption​

A player can redeem a campaign code to receive entitlements, such as games, in-game items, or coins. To redeem a code, call RedeemCode from the Fulfillment API. The code will be redeemed and the player will receive their entitlements under the following conditions:

  • The code exists in the game namespace
  • The maximum redemption limit hasn't been reached
  • The time and date of the redemption falls within the redemption period
FString Code = FString("MyRedeemCode");
FString Region = FString("US"); // Leave it blank if you want to use the default value from user token
FString Language = FString("en"); // Leave it blank if you want to use the default value from user token

auto ApiClient = AccelByteOnlineSubsystemPtr->GetApiClient();
auto FulfillmentApi = ApiClient->GetFulfillmentApi().Pin();

FulfillmentApi->RedeemCode(Code, Region, Language, THandler<FAccelByteModelsFulfillmentResult>::CreateLambda([](const FAccelByteModelsFulfillmentResult& Result)
{
// Do something if RedeemCode succeeds
}),
FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if RedeemCode fails
UE_LOG(LogTemp, Log, TEXT("Error RedeemCode, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));

Game server grants items to players​

Use Fulfillment V3 to grant items from a trusted game server or backend:

PUT /platform/v3/admin/namespaces/{namespace}/users/{userId}/fulfillments/{transactionId}

Your target environment must support this endpoint. Use a server access token with the ADMIN:NAMESPACE:{namespace}:USER:{userId}:FULFILLMENT permission and the UPDATE action (2). A client configured only with the legacy CREATE permission needs this additional permission. Keep server credentials out of game clients.

Create and persist a transaction ID for each logical grant before sending the request. Reuse the same ID and payload when retrying that grant. A new reward must use a new ID, even if the user, item, and quantity are unchanged. Do not generate a new ID for each retry.

The endpoint accepts FulfillmentV2Request and returns FulfillmentV2Result; the model names do not change the endpoint version. Use FulfillmentV3Request only for the separate bulk endpoint.

Choose an integration​

The following published Extend SDK versions contain the methods used below. These are verified reference versions, not the minimum versions that introduced V3. Follow each SDK's installation instructions and check compatibility before upgrading.

IntegrationPublished reference versionGrant method
Go Extend SDKv0.89.1FulfillmentService.FulfillItemsV3Short
Java Extend SDKv0.82.0Fulfillment.fulfillItemsV3
C# Extend SDKv0.81.0Fulfillment.FulfillItemsV3
Python Extend SDKv0.85.1platform.fulfill_items_v3

In the Unreal SDK 28.10.1 and Unity SDK 17.17.1, FulfillUserItem still calls the deprecated V1 endpoint. For V3, use the REST request below from your trusted server, or call a backend implemented with an Extend SDK. Do not substitute a V3 URL into a V1 SDK method: the request and response structures differ.

REST request​

Replace the environment variables below with your server's values. AB_BASE_URL is the environment URL without /platform; AB_ACCESS_TOKEN is a server access token. Replace AB_ITEM_ID with a catalog item ID and AB_TRANSACTION_ID with the persisted ID for this grant.

curl --fail-with-body --request PUT \
"${AB_BASE_URL}/platform/v3/admin/namespaces/${AB_NAMESPACE}/users/${AB_USER_ID}/fulfillments/${AB_TRANSACTION_ID}" \
--header "Authorization: Bearer ${AB_ACCESS_TOKEN}" \
--header 'Content-Type: application/json' \
--data "{\"items\":[{\"itemId\":\"${AB_ITEM_ID}\",\"quantity\":1,\"source\":\"REWARD\"}]}"

An HTTP 200 response can contain a partially failed transaction. Check state and stateInfo, as described in Handle the result.

Extend SDK examples​

These examples assume that you have initialized an authenticated sdk or fulfillmentService for your environment. Replace the placeholders with your namespace, player ID, item ID, and persisted transaction ID. Handle SDK exceptions or returned errors through your application's error policy.

using System;
using System.Collections.Generic;
using AccelByte.Sdk.Api.Platform.Model;
using AccelByte.Sdk.Api.Platform.Operation;

var body = new FulfillmentV2Request
{
Items = new List<FulfillmentV2RequestItem>
{
new FulfillmentV2RequestItem
{
ItemId = "<ItemId>",
Quantity = 1,
Source = FulfillmentV2RequestItemSource.REWARD
}
}
};
var operation = FulfillItemsV3.Builder.Build(
body, "<YourNamespace>", "<PersistedTransactionId>", "<PlayerUserId>");
var result = sdk.Platform.Fulfillment.FulfillItemsV3(operation);
if (result == null || result.State != FulfillmentV2ResultState.FULFILLED)
{
// Inspect StateInfo and classify the failure before retrying.
throw new InvalidOperationException("Fulfillment is incomplete; inspect the transaction.");
}

Handle the result​

  • Treat state == "FULFILLED" as transaction completion. Empty entitlementSummaries do not mean failure: an already completed transaction returns no new grants, and some item types use other summaries.
  • For FULFILL_FAILED, inspect stateInfo.failedList and nested bundle items for errors. Successful components can remain granted. Correct the cause before retrying; do not retry permanent configuration errors indefinitely.
  • Use Retry Fulfillment V3 to retry a saved transaction without resending its body, or repeat the original grant with the same transaction ID and payload. Successful components whose state was saved are skipped.
  • Asset writes and fulfillment state persistence are not atomic. After an interruption or an ambiguous network failure, reconcile the transaction and granted assets before retrying. V3 does not provide an unconditional exactly-once guarantee.

For supported item types, request fields, transaction queries, and revocation limitations, see Manage item fulfillments with third-party stores.