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

# XStoreCanAcquireLicenseForStoreIdAsync

> XStoreCanAcquireLicenseForStoreIdAsync

# XStoreCanAcquireLicenseForStoreIdAsync

Retrieves a preview license for licensable content, including Durables with or without packages, and content on a disc that is currently inserted.
This API allows the game to see if the product is licensable, but without actually acquiring the license.

## Syntax

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

### Parameters

*storeContextHandle*   \_In\_\
Type: XStoreContextHandle

The store context handle for the user returned by [XStoreCreateContext](/reference/system/xstore/functions/xstorecreatecontext).

*storeProductId*   \_In\_z\_\
Type: char\*

StoreID for the product to check

*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.
For more information, see [XAsyncBlock](/reference/system/xasync/structs/xasyncblock).

### Return value

Type: HRESULT

HRESULT success or error code.

## Remarks

**XStoreCanAcquireLicenseForStoreIdAsync** provides the ability for a game to determine if the user could acquire a license for a particular piece of content without actually acquiring that license and using up that user's concurrency slot.
This function doesn't need to be used for the currently running game, since it has a license already, but it can determine if the user owns other games or content from the same publisher.
For example, a game can use this API to determine whether to reward users who own prior versions of the game (either digitally or from an inserted disc) or to up-sell products to the user.

To retrieve the preview license and the execution result of this function call [XStoreCanAcquireLicenseForStoreIdResult](/reference/system/xstore/functions/xstorecanacquirelicenseforstoreidresult) after calling this function.

This code snippet shows an example of using the following APIs:

* **XStoreCanAcquireLicenseForStoreIdAsync**
* [XStoreCanAcquireLicenseForStoreIdResult](/reference/system/xstore/functions/xstorecanacquirelicenseforstoreidresult)

```cpp theme={null}
void CALLBACK CanAcquireLicenseForStoreIdCallback(XAsyncBlock* asyncBlock)
{
    XStoreCanAcquireLicenseResult canAcquireLicenseResult{};

    HRESULT hr = XStoreCanAcquireLicenseForStoreIdResult(
        asyncBlock,
        &canAcquireLicenseResult);

    if (FAILED(hr))
    {
        printf("Failed retrieve the license result: 0x%x\r\n", hr);
        return;
    }

    printf("status       : %d\r\n", canAcquireLicenseResult.status);
    printf("licensableSku: %s\r\n", canAcquireLicenseResult.licensableSku);
}

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

    HRESULT hr = XStoreCanAcquireLicenseForStoreIdAsync(
        storeContextHandle,
        storeId,
        asyncBlock.get());

    if (FAILED(hr))
    {
        printf("Failed to get preview license for store ID: 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

* [Granting players access to add-on content](/publishing/xstore-commerce/xstore-granting-access)
* [Manage and license downloadable content (DLC)](/publishing/xstore-commerce/xstore-dlc)
* [Enabling licensing testing](/publishing/xstore-commerce/xstore-licensing-setup)

## See also

[XStore](/reference/system/xstore/xstore_members)\
[XStoreCanAcquireLicenseForStoreIdResult](/reference/system/xstore/functions/xstorecanacquirelicenseforstoreidresult)\
[How to use a durable without a package](/publishing/xstore-commerce/xstore-dwob)\
[Granting players access to add-on content](/publishing/xstore-commerce/xstore-granting-access)


## Related topics

- [XStoreCanAcquireLicenseForStoreIdResult](/reference/system/xstore/functions/xstorecanacquirelicenseforstoreidresult.md)
- [XStoreCanAcquireLicenseResult](/reference/system/xstore/structs/xstorecanacquirelicenseresult.md)
- [XStoreCanLicenseStatus](/reference/system/xstore/enums/xstorecanlicensestatus.md)
- [XStore](/reference/system/xstore/xstore_members.md)
- [Manage and license downloadable content (DLC)](/publishing/xstore-commerce/xstore-dlc.md)
