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

# 啟用 XStore 開發和測試

> 在沙箱中為 XStore API 開發和測試設定您的 XBOX 產品，包括權利、授權和測試帳戶需求。

遊戲會使用 [XStore API](/zh-TW/reference/system/xstore/xstore_members) 對與您的遊戲及其相關產品 (例如附加元件) 關聯的授權和權利執行作業。許多 `XStore` 作業會操作由 Microsoft Store 服務管理的遊戲相關資訊。

<Note>
  此頁面已較先前版本大幅更新。
</Note>

自 2023 年 6 月起，大部分[\*](#exceptions) `XStore` API 測試不再需要將組建設定為可授權 (例如 contentIdOverride)，也不再需要每個帳戶都擁有遊戲的權利。

當您在開發沙箱中測試商務時，單一測試帳戶上的所有購買都必須在同一個沙箱中完成。將測試帳戶切換到另一個沙箱並購買更多項目，會導致該帳戶在兩個沙箱中的查詢結果都不如預期。這是因為對單一帳戶而言，購買的授權和資訊會繫結到最初購買該項目的沙箱。

在 PC 上的開發沙箱中測試商務時，請確定登入 Microsoft Store 應用程式和 XBOX 應用程式的帳戶相同。在沙箱中時，用於 Microsoft Store 中項目的認證會特別繫結到 XBOX 帳戶。這對於確保所有作業都與專門發佈到作用中沙箱的產品互動至關重要。如需詳細資訊，請參閱[處理 PC 上商店帳戶不相符的案例](/zh-TW/publishing/xstore-commerce/xstore-mismatched-accounts)。

若要測試大部分[\*](#exceptions) `XStore` API，請確定遊戲設定包含從 Partner Center 衍生的適當值。

<a id="exceptions" />

* **與授權相關的 API，例如 [XStoreQueryGameLicenseAsync](/zh-TW/reference/system/xstore/xstore_members)，需要完整授權的內容才能正常運作。** 如需完整詳細資料，請參閱[啟用授權測試](/zh-TW/publishing/xstore-commerce/xstore-licensing-setup)。

## 將遊戲 ID 套用至 MicrosoftGameConfig

首先，在 [Partner Center](/zh-TW/publishing/xstore-commerce/xstore-initial-configuration) 上發佈您的遊戲和附加元件。

接著在遊戲的設定檔中，確定這些值與您設定的遊戲相符：

```xml theme={null}
  <Identity
    Name="41336MicrosoftATG.InGameStoreXS"
    Publisher="CN=A4954634-DF4B-47C7-AB70-D3215D246AF1"
    Version="2023.5.5.0" />
  <StoreId>9NTL0QDWZ4FS</StoreId>
  <MSAAppId>000000004C2690C8</MSAAppId>
  <TitleId>62ab3c24</TitleId>
```

### Identity

位於 Partner Center 的 **Game setup > Identity details** 下。

在 PC 上：必須嚴格符合 Partner Center 中指派給您遊戲的值。

雖然主機上並非必要，但在建立要提交至 Partner Center 的套件時應加以檢查。

`Identity` 節點中的 `Name` 必須符合 **Package/Identity/Name**；`Identity` 節點中的 `Publisher` 必須符合 **Package/Identity/Publisher**。

<img src="https://mintcdn.com/microsoft-4404708b/iADzli99B7EWodAv/images/xstore/identitydetails_appidentity.png?fit=max&auto=format&n=iADzli99B7EWodAv&q=85&s=f0f690902c8867bbae062a337589d182" alt="Game setup > Identity details，其中圈出 Package/Identity/Name 和 Publisher" data-og-width="1124" width="1124" data-og-height="427" height="427" data-path="images/xstore/identitydetails_appidentity.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/microsoft-4404708b/iADzli99B7EWodAv/images/xstore/identitydetails_appidentity.png?w=280&fit=max&auto=format&n=iADzli99B7EWodAv&q=85&s=8e2ab6246d7c53aa58e9b5198c4a6357 280w, https://mintcdn.com/microsoft-4404708b/iADzli99B7EWodAv/images/xstore/identitydetails_appidentity.png?w=560&fit=max&auto=format&n=iADzli99B7EWodAv&q=85&s=73e8f4ac014c15e5ac6a2320c982b4fd 560w, https://mintcdn.com/microsoft-4404708b/iADzli99B7EWodAv/images/xstore/identitydetails_appidentity.png?w=840&fit=max&auto=format&n=iADzli99B7EWodAv&q=85&s=e8404c21a5aaf6dacb8652172c1664bf 840w, https://mintcdn.com/microsoft-4404708b/iADzli99B7EWodAv/images/xstore/identitydetails_appidentity.png?w=1100&fit=max&auto=format&n=iADzli99B7EWodAv&q=85&s=7f782bd5e9e6b087580e58f648e56d01 1100w, https://mintcdn.com/microsoft-4404708b/iADzli99B7EWodAv/images/xstore/identitydetails_appidentity.png?w=1650&fit=max&auto=format&n=iADzli99B7EWodAv&q=85&s=2f539bda98499c8d89efca0d31587749 1650w, https://mintcdn.com/microsoft-4404708b/iADzli99B7EWodAv/images/xstore/identitydetails_appidentity.png?w=2500&fit=max&auto=format&n=iADzli99B7EWodAv&q=85&s=d2a838a12cb667aa59f82014055d4bb1 2500w" />

### StoreID

同樣位於 **Game setup > Identity details**

<img src="https://mintcdn.com/microsoft-4404708b/iADzli99B7EWodAv/images/xstore/identitydetails_storeid.png?fit=max&auto=format&n=iADzli99B7EWodAv&q=85&s=1902ced5d2643fa8c1de30281ef96723" alt="Game setup > Identity details，其中圈出 URL 和頁面上的 StoreId" data-og-width="1146" width="1146" data-og-height="722" height="722" data-path="images/xstore/identitydetails_storeid.png" data-optimize="true" data-opv="3" srcset="https://mintcdn.com/microsoft-4404708b/iADzli99B7EWodAv/images/xstore/identitydetails_storeid.png?w=280&fit=max&auto=format&n=iADzli99B7EWodAv&q=85&s=e1140c4882103ee1552f75fb24e8d816 280w, https://mintcdn.com/microsoft-4404708b/iADzli99B7EWodAv/images/xstore/identitydetails_storeid.png?w=560&fit=max&auto=format&n=iADzli99B7EWodAv&q=85&s=6a2b403d4302b0e1ae8cae6e4992cc91 560w, https://mintcdn.com/microsoft-4404708b/iADzli99B7EWodAv/images/xstore/identitydetails_storeid.png?w=840&fit=max&auto=format&n=iADzli99B7EWodAv&q=85&s=e5eaa6967e59ba7b648a91b25085e111 840w, https://mintcdn.com/microsoft-4404708b/iADzli99B7EWodAv/images/xstore/identitydetails_storeid.png?w=1100&fit=max&auto=format&n=iADzli99B7EWodAv&q=85&s=b38590d54bdb1bb89501e238dbfc8566 1100w, https://mintcdn.com/microsoft-4404708b/iADzli99B7EWodAv/images/xstore/identitydetails_storeid.png?w=1650&fit=max&auto=format&n=iADzli99B7EWodAv&q=85&s=05c68d0fb041e551eb789ee21d7030a6 1650w, https://mintcdn.com/microsoft-4404708b/iADzli99B7EWodAv/images/xstore/identitydetails_storeid.png?w=2500&fit=max&auto=format&n=iADzli99B7EWodAv&q=85&s=a3c17b86117be244a0687746e96b7f33 2500w" />

## 參考 API 文件

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

## 另請參閱

[Commerce 概觀](/zh-TW/publishing/xstore-commerce/xstore-commerce-overview)

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

[啟用授權測試](/zh-TW/publishing/xstore-commerce/xstore-licensing-setup)

[正確切換沙箱以進行商店作業](/zh-TW/publishing/xstore-commerce/xstore-switching-sandbox)

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


## Related topics

- [XBOX 需求和測試案例的變更歷程記錄](/zh-TW/publishing/certification/xr-change-history.md)
- [XBOX 主機遊戲的認證測試 XBOX 需求](/zh-TW/publishing/certification/console-cert-tested-requirements.md)
- [NDA 主題目錄 - Microsoft Learn 線上連結](/zh-TW/nda/nda-topic-directory.md)
- [XBOX 遊戲的 XBOX 需求](/zh-TW/publishing/certification/xbox-requirements.md)
- [XBOX 合作夥伴加入流程:取得存取權限與發行](/zh-TW/home/onboarding.md)
