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

# 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](/reference/system/xstore/functions/xstorecreatecontext).

*productKinds*   \_In\_\
Tipo: [XStoreProductKind](/reference/system/xstore/enums/xstoreproductkind)

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)](/publishing/xstore-commerce/xstore-dlc).

*async*   \_Inout\_\
Tipo: [XAsyncBlock\*](/reference/system/xasync/structs/xasyncblock)

Un [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) que define el trabajo asincrónico que se está realizando. El [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) se puede usar para sondear el estado de la llamada y recuperar los resultados de la llamada. Consulte [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) 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](/reference/system/xstore/functions/xstorequeryproductforpackageresult) 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](/reference/system/xstore/xstore_members)\
[XStoreQueryProductForPackageResult](/reference/system/xstore/functions/xstorequeryproductforpackageresult)\
[XStoreQueryAssociatedProductsAsync](/reference/system/xstore/functions/xstorequeryassociatedproductsasync)\
[XStoreQueryEntitledProductsAsync](/reference/system/xstore/functions/xstorequeryentitledproductsasync)\
[XStoreQueryProductsAsync](/reference/system/xstore/functions/xstorequeryproductsasync)\
[XStoreQueryProductForCurrentGameAsync](/reference/system/xstore/functions/xstorequeryproductforcurrentgameasync)\
[XStoreQueryProductForPackageAsync](/reference/system/xstore/functions/xstorequeryproductforpackageasync)


## Related topics

- [XStoreQueryProductForPackageResult](/es/reference/system/xstore/functions/xstorequeryproductforpackageresult.md)
- [XStoreQueryProductsAsync](/es/reference/system/xstore/functions/xstorequeryproductsasync.md)
- [XStoreQueryProductsResult](/es/reference/system/xstore/functions/xstorequeryproductsresult.md)
- [XStoreQueryProductForCurrentGameAsync](/es/reference/system/xstore/functions/xstorequeryproductforcurrentgameasync.md)
- [XStoreQueryAssociatedProductsForStoreIdResult](/es/reference/system/xstore/functions/xstorequeryassociatedproductsforstoreidresult.md)
