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

# XStoreReportConsumableFulfillmentAsync

> XStoreReportConsumableFulfillmentAsync

# XStoreReportConsumableFulfillmentAsync

Consumes the specified quantity of a consumable.  For more information see [Consumable-based ecosystems](/publishing/xstore-commerce/xstore-consumables) for more information on implementing and using consumable products.

## Syntax

```cpp theme={null}
HRESULT XStoreReportConsumableFulfillmentAsync(  
         const XStoreContextHandle storeContextHandle,  
         const char* storeProductId,  
         uint32_t quantity,  
         GUID trackingId,  
         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\*

The Store ID of the consumable add-on that you want to report as fulfilled.

*quantity*   \_In\_\
Type: uint32\_t

The number of units of the consumable add-on that you want to report as fulfilled. For a Store-managed consumable (that is, a consumable where Microsoft keeps track of the balance), specify the number of units that have been consumed. For a game-managed consumable (that is, a consumable where the developer keeps track of the balance), specify 1.

*trackingId*   \_In\_\
Type: GUID

A developer-supplied GUID that identifies the specific transaction that the fulfillment operation is associated with for tracking purposes.

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

### Return value

Type: HRESULT

HRESULT success or error code.

## Remarks

To retrieve the result of this function call [XStoreReportConsumableFulfillmentResult](/reference/system/xstore/functions/xstorereportconsumablefulfillmentresult) after calling this function.

The following code snippet shows an example of using a quantity of a consumable.

```cpp theme={null}
void CALLBACK ReportConsumableFulfillmentCallback(XAsyncBlock* asyncBlock)
{
    XStoreConsumableResult result{};
    HRESULT hr = XStoreReportConsumableFulfillmentResult(
        asyncBlock,
        &result);

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

    printf("quantity: %d\r\n", result.quantity);
}

void ReportConsumableFulfillment(XStoreContextHandle storeContextHandle, XTaskQueueHandle taskQueueHandle, const char* storeId, uint32_t quantity, GUID trackingId)
{
    auto asyncBlock = std::make_unique<XAsyncBlock>();
    ZeroMemory(asyncBlock.get(), sizeof(*asyncBlock));
    asyncBlock->queue = taskQueueHandle;
    asyncBlock->callback = ReportConsumableFulfillmentCallback;

    HRESULT hr = XStoreReportConsumableFulfillmentAsync(
        storeContextHandle,
        storeId,
        quantity,
        trackingId,
        asyncBlock.get());

    if (FAILED(hr))
    {
        printf("Failed to report consumable fulfillment: 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

* [Consumable-based ecosystems](/publishing/xstore-commerce/xstore-consumables)

## See also

[XStore](/reference/system/xstore/xstore_members)\
[Consumable-based ecosystems](/publishing/xstore-commerce/xstore-consumables)
[XStoreReportConsumableFulfillmentResult](/reference/system/xstore/functions/xstorereportconsumablefulfillmentresult)


## Related topics

- [XStoreReportConsumableFulfillmentResult](/reference/system/xstore/functions/xstorereportconsumablefulfillmentresult.md)
- [XStoreConsumableResult](/reference/system/xstore/structs/xstoreconsumableresult.md)
- [Consumable-based ecosystems](/publishing/xstore-commerce/xstore-consumables.md)
- [Optional services](/build/gdk-and-engines/optional-services.md)
- [XStore](/reference/system/xstore/xstore_members.md)
