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

# XStoreQueryProductForPackageAsync

> XStoreQueryProductForPackageAsync

# XStoreQueryProductForPackageAsync

Recupera información de producto de la tienda para el paquete especificado.

## Sintaxis

```cpp theme={null}
HRESULT XStoreQueryProductForPackageAsync(  
         const XStoreContextHandle storeContextHandle,  
         XStoreProductKind productKinds,  
         const char* packageIdentifier,  
         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).

*productKinds*   \_In\_\
Tipo: [XStoreProductKind](https://docs.xbox.com/es/reference/system/xstore/enums/xstoreproductkind.md)

El tipo de productos que se van a buscar.

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

Una cadena que identifica de forma única un paquete de la tienda. Para obtener más información sobre los identificadores de paquete, consulte [Administración y concesión de licencias de contenido descargable (DLC)](https://docs.xbox.com/es/publishing/xstore-commerce/xstore-dlc.md).

*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 de error o de operación correcta HRESULT.

## Comentarios

Para recuperar la información de producto de la tienda, así como el resultado de la ejecución de esta función, llame a [XStoreQueryProductForPackageResult](https://docs.xbox.com/es/reference/system/xstore/functions/xstorequeryproductforpackageresult.md) después de llamar a esta función.

El siguiente fragmento de código muestra un ejemplo de cómo recuperar la información de producto de un paquete.

```cpp theme={null}
void CALLBACK QueryProductForPackageCallback(XAsyncBlock* asyncBlock)
{
    XStoreProductQueryHandle queryHandle = nullptr;

    HRESULT hr = XStoreQueryProductForPackageResult(
        asyncBlock,
        &queryHandle);

    if (FAILED(hr))
    {
        printf("Failed retrieve the product query handle: 0x%x\r\n", hr);
        XStoreCloseProductsQueryHandle(queryHandle);
        return;
    }

    // Use result of query

     XStoreCloseProductsQueryHandle(queryHandle);
}

void QueryProductForPackage(XStoreContextHandle storeContextHandle, const char* packageIdentifier)
{
    auto asyncBlock = std::make_unique<XAsyncBlock>();
    ZeroMemory(asyncBlock.get(), sizeof(*asyncBlock));
    asyncBlock->queue = taskQueueHandle;
    asyncBlock->callback = QueryProductForPackageCallback;

    XStoreProductKind allProductKinds =
        XStoreProductKind::Consumable |
        XStoreProductKind::Durable |
        XStoreProductKind::Game |
        XStoreProductKind::Pass |
        XStoreProductKind::UnmanagedConsumable;

    HRESULT hr = XStoreQueryProductForPackageAsync(
        storeContextHandle,
        allProductKinds,
        packageIdentifier,
        asyncBlock.get());

    if (FAILED(hr))
    {
        printf("Failed to get product for package: 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)\
[XStoreQueryProductForPackageResult](https://docs.xbox.com/es/reference/system/xstore/functions/xstorequeryproductforpackageresult.md)\
[XStoreQueryAssociatedProductsAsync](https://docs.xbox.com/es/reference/system/xstore/functions/xstorequeryassociatedproductsasync.md)\
[XStoreQueryEntitledProductsAsync](https://docs.xbox.com/es/reference/system/xstore/functions/xstorequeryentitledproductsasync.md)\
[XStoreQueryProductsAsync](https://docs.xbox.com/es/reference/system/xstore/functions/xstorequeryproductsasync.md)\
[XStoreQueryProductForCurrentGameAsync](https://docs.xbox.com/es/reference/system/xstore/functions/xstorequeryproductforcurrentgameasync.md)\
[XStoreQueryProductForPackageAsync](https://docs.xbox.com/es/reference/system/xstore/functions/xstorequeryproductforpackageasync.md)


## Related topics

- [XStoreQueryProductForPackageResult](https://docs.xbox.com/es/reference/system/xstore/functions/xstorequeryproductforpackageresult.md)
- [XStoreQueryProductsAsync](https://docs.xbox.com/es/reference/system/xstore/functions/xstorequeryproductsasync.md)
- [XStoreQueryProductsResult](https://docs.xbox.com/es/reference/system/xstore/functions/xstorequeryproductsresult.md)
- [XStoreQueryProductForCurrentGameAsync](https://docs.xbox.com/es/reference/system/xstore/functions/xstorequeryproductforcurrentgameasync.md)
- [XStoreQueryEntitledProductsAsync](https://docs.xbox.com/es/reference/system/xstore/functions/xstorequeryentitledproductsasync.md)
