> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XStoreReportConsumableFulfillmentAsync

> XStoreReportConsumableFulfillmentAsync

# XStoreReportConsumableFulfillmentAsync

指定した数量の消耗型製品を消費します。消耗型製品の実装と使用の詳細については、[消費型ベースのエコシステム](https://docs.xbox.com/ja-jp/publishing/xstore-commerce/xstore-consumables.md) を参照してください。

## Syntax

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

### Parameters

*storeContextHandle*   \_In\_\
型: XStoreContextHandle

[XStoreCreateContext](https://docs.xbox.com/ja-jp/reference/system/xstore/functions/xstorecreatecontext.md) によって返されたユーザーのストア コンテキスト ハンドル。

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

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

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

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

*trackingId*   \_In\_\
型: GUID

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

*async*   \_Inout\_\
型: [XAsyncBlock\*](https://docs.xbox.com/ja-jp/reference/system/xasync/structs/xasyncblock.md)

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

### Return value

型: HRESULT

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

## Remarks

この関数の結果を取得するには、この関数を呼び出した後に [XStoreReportConsumableFulfillmentResult](https://docs.xbox.com/ja-jp/reference/system/xstore/functions/xstorereportconsumablefulfillmentresult.md) を呼び出します。

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

```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://docs.xbox.com/ja-jp/publishing/xstore-commerce/xstore-consumables.md)

## See also

[XStore](https://docs.xbox.com/ja-jp/reference/system/xstore/xstore_members.md)\
[消費型ベースのエコシステム](https://docs.xbox.com/ja-jp/publishing/xstore-commerce/xstore-consumables.md)
[XStoreReportConsumableFulfillmentResult](https://docs.xbox.com/ja-jp/reference/system/xstore/functions/xstorereportconsumablefulfillmentresult.md)


## Related topics

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