XStoreShowRedeemTokenUIAsync
Triggers a token redemption for the current user for a specified token.
Syntax
HRESULT XStoreShowRedeemTokenUIAsync(
const XStoreContextHandle storeContextHandle,
const char* token,
const char** allowedStoreIds,
size_t allowedStoreIdsCount,
bool disallowCsvRedemption,
XAsyncBlock* async
)
Parameters
storeContextHandle _In_
Type: XStoreContextHandle
The store context handle for the user returned by XStoreCreateContext.
token _In_z_
Type: char*
The token to redeem. This value cannot be empty or null, if you want to bring up the UI without providing a code to pre-populate in the UI pass in a single space " ".
allowedStoreIds _In_z_count_(allowedStoreIdsCount)
Type: char**
Allows you to restrict the 5x5 codes to only work with specific products.
allowedStoreIdsCount _In_
Type: size_t
The number of elements in allowedStoreIds.
disallowCsvRedemption _In_
Type: bool
Prevents CSV (gift card/money style 5x5s) from being redeemed.
async _Inout_
Type: XAsyncBlock*
An XAsyncBlock defining the asynchronous work being done. The XAsyncBlock can be used to poll for the call's status and retrieve call results. See XAsyncBlock for more information.
Return value
Type: HRESULT
HRESULT success or error code.
Remarks
To retrieve the execution result of this function call XStoreShowRedeemTokenUIResult after calling this function.
The following code snippet shows an example of launching the token redemption UI.
void CALLBACK ShowRedeemTokenUICallback(XAsyncBlock* asyncBlock)
{
HRESULT hr = XStoreShowRedeemTokenUIResult(asyncBlock);
if (FAILED(hr))
{
printf("Failed redeem token: 0x%x\r\n", hr);
return;
}
}
void ShowRedeemTokenUI(XStoreContextHandle storeContextHandle, XTaskQueueHandle taskQueueHandle, const char* token)
{
auto asyncBlock = std::make_unique<XAsyncBlock>();
ZeroMemory(asyncBlock.get(), sizeof(*asyncBlock));
asyncBlock->queue = taskQueueHandle;
asyncBlock->callback = ShowRedeemTokenUICallback;
HRESULT hr = XStoreShowRedeemTokenUIAsync(
storeContextHandle,
token,
nullptr, // Can restrict to specific store IDs
0,
false, // Can prevent CSV (cash gift cards)
asyncBlock.get());
if (FAILED(hr))
{
printf("Failed to request redeem token: 0x%x\r\n", hr);
return;
}
}
Requirements
Header: XStore.h (included in XGameRuntime.h)
Library: xgameruntime.lib
Supported platforms: Windows, Xbox One family consoles and Xbox Series consoles