> ## 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 文件的 Commerce 一節中進一步說明。

## 用戶端功能

GDK 可讓遊戲實作多種類型的遊戲內附加元件和產品類型，例如消耗性產品、耐久性產品 (可下載內容)、訂閱、套件組合和試用版。XStore API 集提供從用戶端查詢、宣傳和管理這些產品所需的功能。如需功能完整的遊戲內商店範例，請參閱 [GDK 遊戲內商店範例](https://github.com/microsoft/Xbox-GDK-Samples/tree/main/Samples/Live/InGameStore)。

Fundamentals 一節中的下列文章涵蓋這些 API 和案例：

* [基本商店作業](/zh-TW/publishing/xstore-commerce/xstore-basic-operations) - 查詢可供銷售的項目以及使用者擁有的項目
* [如何使用沒有套件的耐久性產品](/zh-TW/publishing/xstore-commerce/xstore-dwob) - 使用沒有獨立下載套件的耐久性產品。
* [管理和授權可下載內容 (DLC)](/zh-TW/publishing/xstore-commerce/xstore-dlc) - 使用具有下載套件的傳統耐久性產品。
* [以消耗性產品為基礎的生態系統](/zh-TW/publishing/xstore-commerce/xstore-consumables) - 在您的遊戲中設定和配置以消耗性產品為基礎的營利模式。
* [為您的遊戲實作試用版](/zh-TW/publishing/xstore-commerce/xstore-trials) - 實作內建於遊戲中的試用版。
* [套件組合和季票](/zh-TW/publishing/xstore-commerce/xstore-bundles-season-passes) - 使用套件組合和季票，透過您的產品為客戶提供價值並提升參與度。
* [遊戲的產品共用模型](/zh-TW/publishing/xstore-commerce/xstore-product-sharing) - XBOX 主機和 Windows PC 上 GDK 遊戲的授權模型，以及使用者之間的共用如何套用。

## 伺服器端功能

支援用戶端 API 並允許服務對服務呼叫的 Microsoft Store 服務分為下列服務：

* [Collections](/zh-TW/publishing/xstore-commerce/xstore-query-entitlements) - 提供使用者擁有或有權使用之產品的相關資訊，並履行消耗性產品。也可供授權的合作夥伴用來偵測 Game Pass 訂閱狀態。
* [Clawback](/zh-TW/publishing/xstore-commerce/xstore-managing-consumables) - 可讓合作夥伴服務偵測和管理針對已履行之消耗性產品向使用者發出的退款。
* [Purchase](/zh-TW/reference/microsoft-store-apis/xstore-v8-grant) - 可讓合作夥伴服務將免費項目新增至使用者的帳戶。
* Recurrence - 提供使用者訂閱的詳細資訊，並可讓合作夥伴服務代表使用者管理這些訂閱。

### 向 Microsoft Store 服務進行驗證

如需如何向 Microsoft Store 服務驗證您服務的詳細資訊，請參閱[要求 User Store ID 以進行服務對服務驗證](/zh-TW/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](/zh-TW/reference/microsoft-store-apis/xstore-v8-query-for-products)
* **Inventory 用戶端 API** - 所有與查詢項目擁有權相關的用戶端功能，現在都透過 XStore API 處理。<br />範例：[XStoreQueryEntitledProductsAsync](/zh-TW/reference/system/xstore/xstore_members) 會傳回目前使用者在當下有權使用的項目。
* **Catalog Browse API** - 所有與查詢可在遊戲內購買之產品相關的用戶端功能，現在都透過 XStore API 處理。沒有伺服器對伺服器的選項可用來查詢可在您遊戲中銷售的產品。<br />範例：[XStoreQueryAssociatedProductsAsync](/zh-TW/reference/system/xstore/xstore_members) 會傳回可作為遊戲內商店一部分銷售的產品。
* **試用版和授權** - 所有與試用版授權相關的用戶端功能，現在都是 XStore API 的一部分。範例：[XStoreQueryGameLicenseAsync](/zh-TW/reference/system/xstore/xstore_members) 會傳回目前遊戲的授權資訊，包括任何試用版授權資訊。如需在您自己的服務上驗證用戶端授權的功能，請參閱[使用授權權杖在您的服務上驗證授權](/zh-TW/publishing/xstore-commerce/xstore-license-tokens)。

## 參考 API 文件

* [XStore (API 內容)](/zh-TW/reference/system/xstore/xstore_members)
  * 函式
    * [XStoreQueryEntitledProductsAsync](/zh-TW/reference/system/xstore/xstore_members)
    * [XStoreQueryAssociatedProductsAsync](/zh-TW/reference/system/xstore/xstore_members)
    * [XStoreQueryGameLicenseAsync](/zh-TW/reference/system/xstore/xstore_members)

## 另請參閱

[Partner Center 中的初始設定](/zh-TW/publishing/xstore-commerce/xstore-initial-configuration)

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

[從您的服務管理產品](/zh-TW/publishing/xstore-commerce/xstore-authenticating-service)

[PC 特定考量](/zh-TW/publishing/xstore-commerce/xstore-pc)

[XStore API 參考](/zh-TW/reference/system/xstore/xstore_members)


## Related topics

- [XBOX 遊戲開發文件](/zh-TW/index.md)
- [XBOX 合作夥伴加入流程:取得存取權限與發行](/zh-TW/home/onboarding.md)
- [服務 C API 概觀 - PFLocalization.h](/zh-TW/services/playfab/api-references/c/pflocalization/pflocalization_members.md)
- [服務 C API 概觀 - PFStatistics.h](/zh-TW/services/playfab/api-references/c/pfstatistics/pfstatistics_members.md)
- [服務 C API 概觀 - PFLeaderboards.h](/zh-TW/services/playfab/api-references/c/pfleaderboards/pfleaderboards_members.md)
