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

# XStoreQueryProductForCurrentGameAsync

> XStoreQueryProductForCurrentGameAsync

Provides store product information for the currently running game, its skus and availabilities, and other metadata.

## Syntax

```cpp theme={null}
HRESULT XStoreQueryProductForCurrentGameAsync(  
         const XStoreContextHandle storeContextHandle,  
         XAsyncBlock* async  
)  
```

### Parameters

*storeContextHandle*   \_In\_\
Type: XStoreContextHandle

The store context handle for the user returned by [XStoreCreateContext](https://docs.xbox.com/reference/system/xstore/functions/xstorecreatecontext.md).

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

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

### Return value

Type: HRESULT

HRESULT success or error code.

## Remarks

To retrieve the store product information as well as the execution result of this function call [XStoreQueryProductForCurrentGameResult](https://docs.xbox.com/reference/system/xstore/functions/xstorequeryproductforcurrentgameresult.md) after calling this function.

The following code snippet shows an example of retrieving store product information for the currently running game.

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

    HRESULT hr = XStoreQueryProductForCurrentGameResult(
        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 QueryProductForCurrentGame(XStoreContextHandle storeContextHandle, XTaskQueueHandle taskQueueHandle)
{
    auto asyncBlock = std::make_unique<XAsyncBlock>();
    ZeroMemory(asyncBlock.get(), sizeof(*asyncBlock));
    asyncBlock->queue = taskQueueHandle;

    asyncBlock->callback = QueryProductForCurrentGameCallback;

    HRESULT hr = XStoreQueryProductForCurrentGameAsync(
        storeContextHandle,
        asyncBlock.get());

    if (FAILED(hr))
    {
        printf("Failed to get product for current game: 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

## Conceptual documentation

* [Implement in-game purchases in your game](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/pc-dev/tutorials/pc-e2e-guide/e2e-services/e2e-in-game-purchases)
* [Basic store operations](https://docs.xbox.com/publishing/xstore-commerce/xstore-basic-operations.md)

## See also

[XStore](https://docs.xbox.com/reference/system/xstore/xstore_members.md)\
[XStoreQueryProductForCurrentGameResult](https://docs.xbox.com/reference/system/xstore/functions/xstorequeryproductforcurrentgameresult.md)\
[XStoreQueryAssociatedProductsAsync](https://docs.xbox.com/reference/system/xstore/functions/xstorequeryassociatedproductsasync.md)\
[XStoreQueryEntitledProductsAsync](https://docs.xbox.com/reference/system/xstore/functions/xstorequeryentitledproductsasync.md)\
[XStoreQueryProductsAsync](https://docs.xbox.com/reference/system/xstore/functions/xstorequeryproductsasync.md)\
[XStoreQueryProductForCurrentGameAsync](https://docs.xbox.com/reference/system/xstore/functions/xstorequeryproductforcurrentgameasync.md)\
[XStoreQueryProductForPackageAsync](https://docs.xbox.com/reference/system/xstore/functions/xstorequeryproductforpackageasync.md)


## Related topics

- [XStoreQueryProductForCurrentGameResult](https://docs.xbox.com/reference/system/xstore/functions/xstorequeryproductforcurrentgameresult.md)
- [XStoreQueryProductsAsync](https://docs.xbox.com/reference/system/xstore/functions/xstorequeryproductsasync.md)
- [XStoreQueryProductForPackageAsync](https://docs.xbox.com/reference/system/xstore/functions/xstorequeryproductforpackageasync.md)
- [XStoreQueryProductsResult](https://docs.xbox.com/reference/system/xstore/functions/xstorequeryproductsresult.md)
- [XStoreQueryProductForPackageResult](https://docs.xbox.com/reference/system/xstore/functions/xstorequeryproductforpackageresult.md)
