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

# XStoreShowRedeemTokenUIAsync

> XStoreShowRedeemTokenUIAsync

# XStoreShowRedeemTokenUIAsync

Desencadena un canje de token para el usuario actual con el token especificado.

## Sintaxis

```cpp theme={null}
HRESULT XStoreShowRedeemTokenUIAsync(  
         const XStoreContextHandle storeContextHandle,  
         const char* token,  
         const char** allowedStoreIds,  
         size_t allowedStoreIdsCount,  
         bool disallowCsvRedemption,  
         XAsyncBlock* async  
)  
```

### Parámetros

*storeContextHandle*   \_In\_\
Tipo: XStoreContextHandle

El identificador de contexto de la tienda para el usuario, devuelto por [XStoreCreateContext](https://docs.xbox.com/es/reference/system/xstore/functions/xstorecreatecontext.md).

*token*   \_In\_z\_\
Tipo: char\*

El token que se va a canjear. Este valor no puede estar vacío ni ser nulo; si quiere mostrar la interfaz de usuario sin proporcionar un código para rellenarla previamente, pase un único espacio " ".

*allowedStoreIds*   \_In\_z\_count\_(allowedStoreIdsCount)\
Tipo: char\*\*

Le permite restringir los códigos 5x5 para que solo funcionen con productos específicos.

*allowedStoreIdsCount*   \_In\_\
Tipo: size\_t

El número de elementos en **allowedStoreIds**.

*disallowCsvRedemption*   \_In\_\
Tipo: bool

Impide que se canjeen CSV (códigos 5x5 de tipo tarjeta regalo/dinero).

*async*   \_Inout\_\
Tipo: [XAsyncBlock\*](https://docs.xbox.com/es/reference/system/xasync/structs/xasyncblock.md)

Un [XAsyncBlock](https://docs.xbox.com/es/reference/system/xasync/structs/xasyncblock.md) que define el trabajo asincrónico que se está realizando. El [XAsyncBlock](https://docs.xbox.com/es/reference/system/xasync/structs/xasyncblock.md) se puede usar para sondear el estado de la llamada y recuperar los resultados de la llamada. Consulte [XAsyncBlock](https://docs.xbox.com/es/reference/system/xasync/structs/xasyncblock.md) para obtener más información.

### Valor devuelto

Tipo: HRESULT

Código HRESULT de éxito o de error.

## Comentarios

Para recuperar el resultado de ejecución de esta función, llame a [XStoreShowRedeemTokenUIResult](https://docs.xbox.com/es/reference/system/xstore/functions/xstoreshowredeemtokenuiresult.md) después de llamar a esta función.

El siguiente fragmento de código muestra un ejemplo de inicio de la interfaz de usuario de canje de tokens.

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


```

## Requisitos

**Encabezado:** XStore.h (incluido en XGameRuntime.h)

**Biblioteca:** xgameruntime.lib

**Plataformas compatibles:** Windows, consolas de la familia XBOX One y consolas XBOX Series

## Consulte también

[XStore](https://docs.xbox.com/es/reference/system/xstore/xstore_members.md)\
[XStoreShowRedeemTokenUIResult](https://docs.xbox.com/es/reference/system/xstore/functions/xstoreshowredeemtokenuiresult.md)


## Related topics

- [XStoreShowRedeemTokenUIResult](https://docs.xbox.com/es/reference/system/xstore/functions/xstoreshowredeemtokenuiresult.md)
- [XStore (contenido de la API)](https://docs.xbox.com/es/reference/system/xstore/xstore_members.md)
- [Uso de contenedores de C# para las API del GDK en el proyecto de Unity](https://docs.xbox.com/es/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [Redeem Microsoft Store Inventory Items](https://docs.xbox.com/api-reference/inventory/redeem-microsoft-store-inventory-items.md)
- [PFInventoryRedeemMicrosoftStoreInventoryItemsRequest](https://docs.xbox.com/es/services/playfab/api-references/c/pfinventorytypes/structs/pfinventoryredeemmicrosoftstoreinventoryitemsrequest.md)
