Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Consumes the specified quantity of a consumable. For more information see Consumable-based ecosystems for more information on implementing and using consumable products.
Syntax
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.
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*
An XAsyncBlock defining the asynchronous work being done. The XAsyncBlock can be used to poll for the call's status and retrieve call results. See XAsyncBlock for more information.
Return value
Type: HRESULT
HRESULT success or error code.
Remarks
To retrieve the result of this function call XStoreReportConsumableFulfillmentResult after calling this function.
The following code snippet shows an example of using a quantity of a consumable.
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
See also
XStore
Consumable-based ecosystems
XStoreReportConsumableFulfillmentResult