> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XStoreShowRedeemTokenUIAsync

> XStoreShowRedeemTokenUIAsync

# XStoreShowRedeemTokenUIAsync

Triggers a token redemption for the current user for a specified token.

## Syntax

```cpp theme={null}
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](/reference/system/xstore/functions/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\*](/reference/system/xasync/structs/xasyncblock)

An [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) defining the asynchronous work being done. The [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) can be used to poll for the call's status and retrieve call results. See [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) for more information.

### Return value

Type: HRESULT

HRESULT success or error code.

## Remarks

To retrieve the execution result of this function call [XStoreShowRedeemTokenUIResult](/reference/system/xstore/functions/xstoreshowredeemtokenuiresult) after calling this function.

The following code snippet shows an example of launching the token redemption UI.

```cpp theme={null}
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

## See also

[XStore](/reference/system/xstore/xstore_members)\
[XStoreShowRedeemTokenUIResult](/reference/system/xstore/functions/xstoreshowredeemtokenuiresult)


## Related topics

- [XStoreShowRedeemTokenUIResult](/reference/system/xstore/functions/xstoreshowredeemtokenuiresult.md)
- [XStore](/reference/system/xstore/xstore_members.md)
- [Unity C# API wrappers for the GDK](/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [Services C API overview - PFInventory.h](/services/playfab/api-references/c/pfinventory/pfinventory_members.md)
- [PFInventoryRedeemMicrosoftStoreInventoryItemsRequest](/services/playfab/api-references/c/pfinventorytypes/structs/pfinventoryredeemmicrosoftstoreinventoryitemsrequest.md)
