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

指定した数量の消耗型製品を消費します。消耗型製品の実装と使用の詳細については、[消費型ベースのエコシステム](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-consumable-based-ecosystems) を参照してください。

## Syntax

```cpp theme={null}
HRESULT XStoreReportConsumableFulfillmentAsync(  
         const XStoreContextHandle storeContextHandle,  
         const char* storeProductId,  
         uint32_t quantity,  
         GUID trackingId,  
         XAsyncBlock* async  
)  
```

### Parameters

*storeContextHandle*   \_In\_\
型: XStoreContextHandle

[XStoreCreateContext](/reference/system/xstore/functions/xstorecreatecontext) によって返されたユーザーのストア コンテキスト ハンドル。

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

使用済みとして報告する消耗型アドオンのストア ID。

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

使用済みとして報告する消耗型アドオンの単位数。ストア管理の消耗型製品 (Microsoft が残高を管理している消耗型製品) の場合は、消費された単位数を指定します。ゲーム管理の消耗型製品 (開発者が残高を管理している消耗型製品) の場合は、1 を指定します。

*trackingId*   \_In\_\
型: GUID

追跡の目的で、消費処理に関連付けられる特定のトランザクションを識別する、開発者が指定する GUID。

*async*   \_Inout\_\
型: [XAsyncBlock\*](/reference/system/xasync/structs/xasyncblock)

実行される非同期処理を定義する [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)。[XAsyncBlock](/reference/system/xasync/structs/xasyncblock) を使用して呼び出しの状態をポーリングしたり、呼び出し結果を取得したりできます。詳細については、[XAsyncBlock](/reference/system/xasync/structs/xasyncblock) を参照してください。

### Return value

型: HRESULT

HRESULT の成功またはエラー コード。

## Remarks

この関数の結果を取得するには、この関数を呼び出した後に [XStoreReportConsumableFulfillmentResult](/reference/system/xstore/functions/xstorereportconsumablefulfillmentresult) を呼び出します。

次のコード スニペットは、消耗型製品の一定数量を使用する例を示しています。

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

**ヘッダー:** XStore.h (XGameRuntime.h に含まれる)

**ライブラリ:** xgameruntime.lib

**サポートされているプラットフォーム:** Windows、XBOX One ファミリー本体および XBOX Series 本体

## Conceptual documentation

* [消費型ベースのエコシステム](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-consumable-based-ecosystems)

## See also

[XStore](/reference/system/xstore/xstore_members)\
[消費型ベースのエコシステム](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-consumable-based-ecosystems)
[XStoreReportConsumableFulfillmentResult](/reference/system/xstore/functions/xstorereportconsumablefulfillmentresult)


## Related topics

- [XStoreReportConsumableFulfillmentResult](/ja-jp/reference/system/xstore/functions/xstorereportconsumablefulfillmentresult.md)
- [XStoreConsumableResult](/ja-jp/reference/system/xstore/structs/xstoreconsumableresult.md)
- [消費型ベースのエコシステム](/ja-jp/publishing/xstore-commerce/xstore-consumables.md)
- [オプション サービス](/ja-jp/build/gdk-and-engines/optional-services.md)
- [XStore](/ja-jp/reference/system/xstore/xstore_members.md)
