如果供應商直接在自家平台提供商家資訊管理服務,可以在網站內驗證商家的商家資訊。這樣就不必將商家重新導向至商家檔案使用者介面。
取得目前狀態
使用者可以對位置呼叫 locations.getVoiceOfMerchantState
,擷取目前狀態。如果布林值為 hasVoiceOfMerchant
true
,表示地點狀態良好,不需要採取任何行動。否則,如果回應中的 gain_voice_of_merchant
動作包含 verify
,您就必須完成驗證。詳情請參閱以下操作說明。
擷取驗證選項
供應商可以使用 locations.fetchVerificationOptions
方法,提示商家從可用的驗證方法清單中選擇偏好的聯絡方式。
如要擷取驗證選項,請使用下列項目:
POST https://mybusinessverifications.googleapis.com/v1/{locationId}:fetchVerificationOptions { "languageCode": "en" }
啟動驗證程序
選擇驗證方法後,請使用 locations.verify
啟動驗證程序。
呼叫此函式後,該地點會進入已驗證狀態,或傳回錯誤狀態。
POST https://mybusinessverifications.googleapis.com/v1/locations/{locationId} :verify // Use only one of the below verification methods // For postcard verification: { "method": "ADDRESS", "languageCode": "en", "addressInput": { "mailerContactName": "Ann Droyd" } } // For phone verification: { "method": "PHONE_CALL", "languageCode": "en", "phoneInput": { "phoneNumber": "800-555-0136" } } // For SMS verification: { "method": "SMS", "languageCode": "en", "phoneInput": { "phoneNumber": "800-555-0136" } } // For email verification: { "method": "EMAIL", "languageCode": "en", "emailInput": { "emailAddress": "ex@google.com" } }
擷取目前的驗證
locations.verifications.list
呼叫會擷取驗證要求記錄,以及呼叫中指定位置的狀態。
如要擷取所有驗證要求,請使用下列指令:
GET https://mybusinessverifications.googleapis.com/v1/locations/{locationId} /verifications
完成待處理的驗證
通常需要 PIN 碼和
locations.verifications.complete
方法,才能完成商家驗證。
如要完成待處理的驗證,請使用下列項目:
POST https://mybusinessverifications.googleapis.com/v1/locations/{locationId} /verifications/{verificationId}:complete { "pin": "123456" }
使用 API 驗證 Google 商家檔案的最佳做法
建立地點
透過 GBP 商家資訊 API,您可以嵌入平台來提供地點建立功能。請按照下列步驟,要求商家新增地點:
向商家收集商家名稱、地址、類別等位置資訊。
- 呼叫
googleLocations.search
端點。 - 在 API 要求中提供地點資料,例如商家名稱、類別、地址、電話號碼和網站。
或者,按照下列步驟搜尋可能的相符位置:
- 查詢可能相符的位置。
- 請商家選擇正確的地點。
- 如果地點回應中存在
requestAdminRightsUrl
,請協助商家在 Google 商家檔案中要求該地點的存取權和擁有權。 - 如果
requestAdminRightsUrl
不存在,請使用地點回應中的地點 ID 建立新地點。 - 確認新位置。
注意:如果初始查詢沒有任何可能的地點相符結果,請使用空白地點 ID 建立新地點。然後驗證新地點。
地點驗證
如要使用 Google 商家檔案 API 啟動驗證程序,請按照下列步驟操作:
- 呼叫
accounts.locations.list
方法,列出 Google 帳戶的所有地點。 - 選取要驗證的地點。
- 呼叫
GetVoiceOfMerchant
API 方法,確認該地點是否需要驗證。 - 如果回應傳回驗證,請呼叫
fetchVerificationOptions
,取得可用於驗證該位置的方法清單。 - 仔細檢查
verificationOption
資料是否包含正確的地址、電話號碼和電子郵件地址。 - 商家選取最合適的驗證方式後,請呼叫
locations.verify
方法,啟動適當的驗證程序。如要確認啟動程序是否正在進行,請呼叫locations.verifications.list.
- 使用商家 PIN 碼呼叫
locations.verification.complete
方法。 - 呼叫
GetVoiceOfMerchant
API 方法。如果是HasVoiceOfMerchant = true
,代表你已成功驗證該地點。
注意:如果地點可進行AUTO
驗證,商家就不必執行任何驗證步驟
如要進一步瞭解 Google 商家檔案驗證,請參閱這篇說明中心支援文章。