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

# GDK 商务系统概述

> GDK 中可用的 Microsoft Store 商务系统概述 — 购买、权益、消耗品、DLC、试玩、订阅以及授权 API。

GDK 中提供的商务相关功能和服务可实现多种变现模型，并支持将后端服务深度集成到这些商务选项中。本文档概述了这些系统和选项，GDK 文档的商务部分对其进行了更深入的介绍。

## 客户端功能

GDK 允许游戏实现多种类型的游戏内附加内容和产品类型，如消耗品、耐用品（可下载内容）、订阅、捆绑包和试玩。XStore API 集合提供了从客户端查询、宣传和管理这些产品所需的功能。有关功能完整的游戏内商店示例，请参阅 [GDK In-Game Store 示例](https://github.com/microsoft/Xbox-GDK-Samples/tree/main/Samples/Live/InGameStore)。

Fundamentals 部分中的以下文章涵盖了这些 API 和场景：

* [商店基本操作](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-basic-operations.md) - 查询可销售的内容以及用户所拥有的内容
* [如何使用无包的耐用品](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-dwob.md) - 使用没有单独下载包的耐用品。
* [管理并授权可下载内容 (DLC)](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-dlc.md) - 使用带下载包的传统耐用品。
* [基于消耗品的生态系统](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-consumables.md) - 在游戏中设置和配置基于消耗品的变现模型。
* [为游戏实现试玩](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-trials.md) - 在游戏中实现内置试玩。
* [捆绑包和季票](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-bundles-season-passes.md) - 使用捆绑包和季票为客户提供价值并提升参与度。
* [游戏的产品共享模式](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-product-sharing.md) - XBOX 主机和 Windows PC 上 GDK 游戏的授权模型以及用户之间的共享方式。

## 服务端功能

支持客户端 API 并允许服务到服务调用的 Microsoft Store 服务分为以下几个服务：

* [Collections](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-query-entitlements.md) - 提供用户拥有或有权使用哪些产品的信息，并履约消耗品产品。也可用于授权合作伙伴检测 Game Pass 订阅状态。
* [Clawback](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-managing-consumables.md) - 允许合作伙伴服务检测和管理向用户发放的已履约消耗品的退款。
* [Purchase](https://docs.xbox.com/zh-CN/reference/microsoft-store-apis/xstore-v8-grant.md) - 允许合作伙伴服务向用户账号添加免费物品。
* Recurrence - 提供用户订阅的详细信息，并允许合作伙伴服务代表用户管理这些订阅。

### 与 Microsoft Store 服务进行身份验证

有关如何为你的服务与 Microsoft Store 服务进行身份验证的详细信息，请参阅[为服务到服务身份验证请求 User Store ID](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-requesting-userstoreid.md)。

> [!NOTE]
>
> 如果你熟悉 X-token 身份验证，Collections 服务确实支持 X-token。

但是，其他 Microsoft Store 服务并不支持。由于其他服务提供了宝贵的功能，我们现在建议合作伙伴将其服务到服务身份验证流程过渡到 Microsoft Entra ID 和 UserStoreId 流程。

为帮助简化身份验证流程并调用 Microsoft Store 服务，请查看 GitHub 上的 Microsoft.StoreServices 项目和示例。Microsoft.StoreServices 库帮助管理身份验证密钥，并提供包装 API 以调用 Microsoft Store 服务来管理产品。示例项目重点展示了服务如何使用 Microsoft.StoreServices 库、管理消耗品产品的示例逻辑、对退款购买的对账、续订过期凭据等。示例中包含了分步配置指南，可在你的 PC 上或通过 Azure 设置示例服务。

* [Microsoft.StoreServices 库 (GitHub)](https://github.com/microsoft/Microsoft-Store-Services)
* [Microsoft.StoreServices 示例 (GitHub)](https://github.com/microsoft/Microsoft-Store-Services-Sample)

## 面向 XDK 用户的关键信息

如果你熟悉 XDK 中的商务系统，以下定义将有助于你了解 GDK 中的等效服务名称：

* **Inventory 服务** - XDK 的 Inventory 服务的功能（查询所有权、履约消耗品等）现在由 Collections 服务处理。这包括所有用于验证所有权和消耗品数量的服务到服务场景。虽然用于 Inventory 的 X-token 可用于调用 Collections，但我们建议合作伙伴迁移到 Microsoft Entra ID 和 User Store ID 令牌身份验证流程，以使用 Microsoft Store 服务的扩展功能。\
  示例：[https://collections.mp.microsoft.com/v8.0/collections/b2bLicensePreview](https://docs.xbox.com/zh-CN/reference/microsoft-store-apis/xstore-v8-query-for-products.md)
* **Inventory 客户端 API** - 与查询物品所有权相关的所有客户端功能现在通过 XStore API 处理。\
  示例：[XStoreQueryEntitledProductsAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/xstore_members.md) 返回当前用户此刻有权使用的物品。
* **Catalog 浏览 API** - 与在游戏中查询可购买产品相关的所有客户端功能现在通过 XStore API 处理。没有查询游戏中可销售产品的服务到服务选项。\
  示例：[XStoreQueryAssociatedProductsAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/xstore_members.md) 返回可作为游戏内商店的一部分销售的产品。
* **试玩和许可证** - 与试玩许可证相关的所有客户端功能现在都是 XStore API 的一部分。示例：[XStoreQueryGameLicenseAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/xstore_members.md) 返回当前游戏的许可证信息，包括任何试玩许可证信息。有关如何在你自己的服务上验证客户端许可证的能力，请参阅[使用许可证令牌在你的服务上校验授权](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-license-tokens.md)。

## 参考 API 文档

* [XStore（API 内容）](https://docs.xbox.com/zh-CN/reference/system/xstore/xstore_members.md)
  * 函数
    * [XStoreQueryEntitledProductsAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/xstore_members.md)
    * [XStoreQueryAssociatedProductsAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/xstore_members.md)
    * [XStoreQueryGameLicenseAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/xstore_members.md)

## 另请参阅

[Partner Center 的初始配置](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-initial-configuration.md)

[商店基本操作](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-basic-operations.md)

[从你的服务管理产品](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-authenticating-service.md)

[PC 特有注意事项](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-pc.md)

[XStore API 参考](https://docs.xbox.com/zh-CN/reference/system/xstore/xstore_members.md)


## Related topics

- [GDK 商务系统概述](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-commerce-overview.md)
- [XStoreQueryGameLicenseAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstorequerygamelicenseasync.md)
- [XStoreQueryAssociatedProductsAsync](https://docs.xbox.com/zh-CN/reference/system/xstore/functions/xstorequeryassociatedproductsasync.md)
- [技术功能](https://docs.xbox.com/zh-CN/publishing/game-publishing/concepts/properties-technical-capabilities.md)
- [基于消耗品的生态系统](https://docs.xbox.com/zh-CN/publishing/xstore-commerce/xstore-consumables.md)
