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

# 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 和场景：

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

## 服务端功能

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

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

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

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

<Note>
  如果你熟悉 X-token 身份验证，Collections 服务确实支持 X-token。
</Note>

但是，其他 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 服务的扩展功能。<br />示例：[https://collections.mp.microsoft.com/v8.0/collections/b2bLicensePreview](/reference/microsoft-store-apis/xstore-v8-query-for-products)
* **Inventory 客户端 API** - 与查询物品所有权相关的所有客户端功能现在通过 XStore API 处理。<br />示例：[XStoreQueryEntitledProductsAsync](/reference/system/xstore/xstore_members) 返回当前用户此刻有权使用的物品。
* **Catalog 浏览 API** - 与在游戏中查询可购买产品相关的所有客户端功能现在通过 XStore API 处理。没有查询游戏中可销售产品的服务到服务选项。<br />示例：[XStoreQueryAssociatedProductsAsync](/reference/system/xstore/xstore_members) 返回可作为游戏内商店的一部分销售的产品。
* **试玩和许可证** - 与试玩许可证相关的所有客户端功能现在都是 XStore API 的一部分。示例：[XStoreQueryGameLicenseAsync](/reference/system/xstore/xstore_members) 返回当前游戏的许可证信息，包括任何试玩许可证信息。有关如何在你自己的服务上验证客户端许可证的能力，请参阅[使用许可证令牌在你的服务上校验授权](/publishing/xstore-commerce/xstore-license-tokens)。

## 参考 API 文档

* [XStore（API 内容）](/reference/system/xstore/xstore_members)
  * 函数
    * [XStoreQueryEntitledProductsAsync](/reference/system/xstore/xstore_members)
    * [XStoreQueryAssociatedProductsAsync](/reference/system/xstore/xstore_members)
    * [XStoreQueryGameLicenseAsync](/reference/system/xstore/xstore_members)

## 另请参阅

[合作伙伴中心的初始配置](/publishing/xstore-commerce/xstore-initial-configuration)

[商店基本操作](/publishing/xstore-commerce/xstore-basic-operations)

[从你的服务管理产品](/publishing/xstore-commerce/xstore-authenticating-service)

[PC 特有注意事项](/publishing/xstore-commerce/xstore-pc)

[XStore API 参考](/reference/system/xstore/xstore_members)


## Related topics

- [XStore 商务概述](/zh-CN/publishing/xstore-commerce/xstore-commerce-overview.md)
- [XStoreQueryGameLicenseAsync](/zh-CN/reference/system/xstore/functions/xstorequerygamelicenseasync.md)
- [技术功能](/zh-CN/publishing/game-publishing/concepts/properties-technical-capabilities.md)
- [基于消耗品的生态系统](/zh-CN/publishing/xstore-commerce/xstore-consumables.md)
- [从你的服务管理消耗品产品](/zh-CN/publishing/xstore-commerce/xstore-managing-consumables.md)
