如要有效使用 Merchant API,請務必瞭解註冊、驗證和授權的概念。兩者在確保安全且正確存取 Merchant Center 資料方面,各有不同用途。
術語
註冊、驗證和授權相關,但各有不同意義和用途。
驗證:在此程序中,服務會驗證發出 API 要求的使用者或應用程式身分。Merchant API 使用標準 Google 機制,例如 OAuth 2.0。詳情請參閱「驗證要求」和「以自己的帳戶進行驗證」。
授權:這個程序會判斷通過驗證的使用者或應用程式,可使用 Merchant Center 帳戶執行哪些動作。系統會根據 Merchant Center 帳戶中授予已驗證使用者的角色和權限,回答「你可以做什麼?」這個問題。舉例來說,使用者可能獲授權讀取產品資料,但無法修改帳戶設定。
註冊:就 Merchant API 而言,這是一次性的設定程序,可讓 Google 針對你管理的商家帳戶,傳送重要的服務公告。註冊後,系統會將開發人員電子郵件地址新增至主要 Merchant Center 帳戶,並連結至您用於驗證的 Google Cloud 專案 ID。建立連結後,應用程式就能接收您管理的所有商家帳戶服務公告。詳情請參閱「建立 Google Cloud 專案」。
註冊
註冊程序是啟用應用程式以使用 Merchant API 的關鍵。以下是一些注意事項:
必要條件
如要註冊使用 Merchant API,必須符合下列條件:
Merchant Center 帳戶:你必須擁有現有的 Merchant Center 帳戶。
管理員存取權:用來發起註冊呼叫的 Google 使用者帳戶,必須對註冊的 Merchant Center 帳戶具備管理員權限。
Google Cloud 專案:應用程式必須與 Google Cloud 專案建立關聯。這個專案會提供應用程式驗證所需的憑證 (例如 OAuth 2.0 用戶端 ID)。
無法註冊共用 Google Cloud 專案的原因
Google OAuth Playground 和 APIs Explorer 等工具會使用 Google 擁有的共用 Google Cloud 專案。您無法透過共用專案註冊,原因如下:
這些憑證僅供測試和探索,不適用於正式環境應用程式身分。
註冊這些工具表示共用工具與特定 Merchant Center 資料之間存在連結,可能會導致不必要的通訊。
應用程式需要專屬的 Google Cloud 專案,這樣 Google 傳送給您的 Merchant API 通訊內容,才會與實際用量相關。
不過,您可以使用 OAuth Playground 和 API Explorer 網路應用程式,透過 Merchant API 進行實驗和非正式用途。
找出 Google Cloud 專案 ID
您可以在 Google Cloud 控制台中找到專案 ID 和專案編號。詳情請參閱「找出專案名稱、編號和 ID」。
撥打註冊電話
使用 Accounts 子 API 中的 registerGcp 方法進行註冊。這項呼叫會將 Google Cloud 專案編號與 Merchant Center 帳戶建立關聯。
在過程中,您應提供與用於呼叫 API 的個別使用者相關聯的電子郵件地址。這個電子郵件必須屬於具備 Merchant Center 帳戶管理員存取權的使用者。
關於電子郵件欄位
有效溝通是關鍵。Google 會傳送重要更新、強制性服務公告 (MSA)、開發人員問卷調查,以及與 Merchant API 相關的其他機會。妥善管理聯絡人可確保這些訊息傳達給合適的人員。
用途:Google 會使用這個電子郵件地址做為 API 相關通訊的主要聯絡方式。
電子郵件地址擁有者:應為負責 API 整合的個別開發人員或重要技術聯絡人電子郵件地址。
最佳做法:
請務必使用個人的公司電子郵件地址。
請勿使用一般群組別名或服務帳戶電子郵件地址。我們希望通訊內容能傳達給人類收件者。
聯絡人管理適用的 users 資源
註冊呼叫中的電子郵件地址會設定初始聯絡人,但如要以更穩健的方式管理聯絡人和權限,請使用 Merchant API accounts.users 資源,或 Merchant Center 使用者介面中的使用者管理設定。如要進一步瞭解如何使用 Merchant Center,請參閱「管理帳戶中的使用者」。
如何善用這些功能:
新增所有開發人員:將負責 API 整合的開發人員新增為 Merchant Center 帳戶的使用者。
指派 API_DEVELOPER 角色:除了標準角色 (「管理員」、「標準」),您還可以指派 API_DEVELOPER 角色給使用者。具體來說,請將這個角色指派給應接收 API 相關通訊內容的使用者。您可以將這項角色與其他角色合併。
優點:
清楚劃分:將 API 聯絡人管理作業與一次性註冊作業分離。
彈性:隨著團隊成員異動更新聯絡人。
目標明確的通訊:確保 API 相關新聞傳達給適當的對象。
即使您在註冊時提供電子郵件地址,我們仍強烈建議您新增具有 API_DEVELOPER 角色的使用者,藉此管理 API 聯絡人。
[null,null,["上次更新時間:2025-09-12 (世界標準時間)。"],[],[],null,["To effectively use Merchant API, it's important to understand the concepts of\n**registration, authentication,** and **authorization**. They serve distinct\npurposes in ensuring secure and correct access to Merchant Center data.\n\nTerminology\n\nRegistration, authentication and authorization are related, but each has a\ndistinct meaning and purpose.\n\n- **Authentication** : In this process the service verifies the identity of the user or application making an API request. Merchant API uses standard Google mechanisms like [OAuth\n 2.0](/identity/protocols/oauth2). For more information, see [Authenticate\n requests](/merchant/api/guides/authorization/access-client-accounts) and [Authenticate as your own\n account](/merchant/api/guides/authorization/access-your-account).\n- **Authorization**: This process determines what actions the authenticated user or application is permitted to perform using a Merchant Center account. It answers the question: \"What can you do?\" based on the roles and permissions granted to the authenticated user within the Merchant Center account. For example, a user might be authorized to read product data, but not to modify account settings.\n- **Registration** : With respect to Merchant API, this is a one-time setup process that lets Google send you important service announcements for the merchant accounts you manage. Registration adds your developer email addresses to your main Merchant Center account and links it to the Google Cloud Project ID(s) you use for authentication. This linkage lets your application, receive service announcements for all the merchant accounts you manage. For more information, see [Create a Google Cloud\n Project](/workspace/guides/create-project).\n\nRegistration\n\nThe registration process is crucial for enabling your application to use the\nMerchant API. Here's what you need to know:\n\nPrerequisites\n\nRegistering to use Merchant API requires the following:\n\n- **Merchant Center Account**: You need an existing Merchant Center account.\n- **Admin Access:** The Google user account you use to initiate the registration call must have Admin privileges on the Merchant Center account you are registering.\n- **Google Cloud Project**: Your application must be associated with a Google Cloud Project. This project provides the necessary credentials (like OAuth 2.0 Client IDs) for your application to authenticate.\n\nWhy you can't register a shared Google Cloud project\n\nTools like the Google OAuth Playground and APIs Explorer use shared,\nGoogle-owned Google Cloud projects. You cannot register with shared projects\nbecause:\n\n- They are meant for testing and exploration, not for production application identity.\n- Registering them would imply a link between the shared tool and your specific Merchant Center data and may result in unwanted communication.\n\nYour application needs its own dedicated Google Cloud project so the Merchant\nAPI communications Google sends to you remain relevant for your actual usage.\n\nNevertheless, you can use the OAuth Playground and API Explorer webapps to use\nthe Merchant API for experimentation and non-production use cases.\n\nFind your Google Cloud Project ID\n\nYou can find your **Project ID** and **Project Number** in the Google Cloud\nConsole. For details, see [Find the project name, number, and\nID](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects).\n| **Tip:** The Project ID is a unique string, and the Project Number is a unique integer. The registration process typically uses the Project Number.\n\nMake the registration call\n\nRegister using the\n[`registerGcp`](/merchant/api/reference/rest/accounts_v1/accounts.developerRegistration/registerGcp)\nmethod within the `Accounts` sub-API. This call associates your Google Cloud\nProject Number with the Merchant Center account.\n\nDuring the process, you should provide an email address associated with an\nindividual user that you use to call the API. This email must belong to a user\nwith Admin access to the Merchant Center account.\n\nAbout the email field\n\nEffective communication is key. Google sends important updates, Mandatory\nService Announcements (MSAs), developer surveys, and other opportunities related\nto the Merchant API. Proper contact management ensures that these reach the\nright people.\n\n- **Purpose**: Google uses this email address as a primary contact for API-related communications.\n- **Whose email**: This should be the email address of an individual developer or a key technical contact who is responsible for the API integration.\n- **Best Practices** :\n - **DO**: Use an individual's corporate email address.\n - **DO NOT**: Use general group aliases or service account emails. We intend communications for human recipients.\n\nThe `users` resource for contact management\n\nWhile the email address in the registration call sets an initial contact, the\nmore robust way to manage contacts and permissions is using the Merchant API\n[`accounts.users`](/merchant/api/reference/rest/accounts_v1/accounts.users)\nresource or the user management settings in the Merchant Center UI. For more\ninformation on using Merchant Center, see [Manage people on your\naccount](https://support.google.com/merchants/answer/12160472?#manageusers).\n\nTake advantage of these features as follows:\n\n1. **Add all developers**: Add developers working on the API integration as users of the Merchant Center account.\n2. **Assign the `API_DEVELOPER` role** : Besides standard roles (**Admin** , **Standard** ), you can assign users the `API_DEVELOPER` role. In particular, assign this role to users who should receive API-related communications. You can combine it with other roles.\n3. **Benefits** :\n - **Clear separation**: Decouples API contact management from the one-time registration.\n - **Flexibility**: Update contacts as team members change.\n - **Targeted communication**: Ensures API-specific news goes to the relevant people.\n\nEven if you provided an email address during registration, we strongly recommend\nmanaging API contacts by adding users with the `API_DEVELOPER` role.\n\nReferences\n\nFor more information, see the following:\n\n- [Quickstart guide](/merchant/api/guides/quickstart)\n- [`DeveloperRegistration`](/merchant/api/reference/rest/accounts_v1/accounts.developerRegistration) methods"]]