直接在平台上提供商家資訊管理服務的供應商,可以在自家網站上驗證商家的商家資訊。這樣一來,就不需要將商家重新導向至商家檔案 UI。
取得目前狀態
使用者可以呼叫位置的 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 驗證 GBP 的最佳做法
建立地點
您可以使用 GBP Business Information API 嵌入平台,提供建立地點的功能。請務必按照下列步驟,要求商家新增地點:
向商家收集商家名稱、地址、類別等地點資訊。
- 呼叫
googleLocations.search
端點。 - 在 API 要求中提供位置資料,例如商家名稱、類別、地址、電話號碼和網站。
或者,您也可以按照下列步驟搜尋可能相符的位置:
- 查詢可能相符的位置。
- 請商家選擇正確的地點。
- 如果地點回應中包含
requestAdminRightsUrl
,請協助商家在 Google 商家檔案中要求該地點的存取權和擁有權。 - 如果
requestAdminRightsUrl
不存在,請在位置回應中使用 Place ID 建立新位置。 - 確認新位置。
注意:如果初始查詢未顯示任何可能符合條件的地點,請使用空白地點 ID 建立新地點。然後驗證新位置。
地點驗證
如要使用 GBP API 開始驗證程序,請按照下列步驟操作:
- 呼叫
accounts.locations.list
方法,即可列出 Google 帳戶的所有地點。 - 選取要驗證的地點。
- 呼叫
GetVoiceOfMerchant
API 方法,確認該位置是否需要驗證。 - 如果回應傳回驗證,請呼叫
fetchVerificationOptions
,取得可用於驗證該位置的方法清單。 - 仔細檢查
verificationOption
資料是否包含正確的地址、電話號碼和電子郵件地址。 - 商家選取最合適的驗證選項後,請呼叫
locations.verify
方法,以便啟動適當的驗證程序。如要確認啟動程序是否正在進行,請呼叫locations.verifications.list.
- 使用商家的 PIN 呼叫
locations.verification.complete
方法。 - 呼叫
GetVoiceOfMerchant
API 方法。如果是HasVoiceOfMerchant = true
,表示您已成功驗證地點。
注意:如果商家所在地點可使用AUTO
驗證,商家就不需要執行任何驗證步驟
如要進一步瞭解 GBP 驗證,請參閱這篇說明中心支援文章。