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

Consume la cantidad especificada de un consumible.  Para obtener más información sobre cómo implementar y usar productos consumibles, consulte [Ecosistemas basados en consumibles](/publishing/xstore-commerce/xstore-consumables).

## Sintaxis

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

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

El identificador de la tienda (Store ID) del complemento consumible que quiere notificar como consumido.

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

El número de unidades del complemento consumible que quiere notificar como consumidas. Para un consumible administrado por la Tienda (es decir, un consumible cuyo saldo lo controla Microsoft), especifique el número de unidades que se han consumido. Para un consumible administrado por el juego (es decir, un consumible cuyo saldo lo controla el desarrollador), especifique 1.

*trackingId*   \_In\_\
Tipo: GUID

Un GUID proporcionado por el desarrollador que identifica la transacción específica a la que está asociada la operación de consumo con fines de seguimiento.

*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 HRESULT de éxito o de error.

## Comentarios

Para recuperar el resultado de esta función, llame a [XStoreReportConsumableFulfillmentResult](/reference/system/xstore/functions/xstorereportconsumablefulfillmentresult) después de llamar a esta función.

El siguiente fragmento de código muestra un ejemplo de uso de una cantidad de un consumible.

```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;
    }
}
```

## Requisitos

**Encabezado:** XStore.h (incluido en XGameRuntime.h)

**Biblioteca:** xgameruntime.lib

**Plataformas compatibles:** Windows, consolas de la familia XBOX One y consolas XBOX Series

## Documentación conceptual

* [Ecosistemas basados en consumibles](/publishing/xstore-commerce/xstore-consumables)

## Consulte también

[XStore](/reference/system/xstore/xstore_members)\
[Ecosistemas basados en consumibles](/publishing/xstore-commerce/xstore-consumables)
[XStoreReportConsumableFulfillmentResult](/reference/system/xstore/functions/xstorereportconsumablefulfillmentresult)
