管理全通路設定

OmnichannelSettings API 是設定店面商品目錄廣告 (LIA) 和免費區域產品資訊 (FLL) 計畫的進入點。

以程式輔助方式

  • 管理 (建立及更新) 全通路設定
  • 擷取 (取得及列出) 全通路設定
  • 為符合資格的商家申請商品目錄驗證

詳情請參閱店面商品目錄廣告和免費區域產品資訊總覽

必要條件

您應該具備

  • Merchant Center 帳戶

  • 商家檔案。如果沒有帳戶,請建立一個。請參閱「註冊商家檔案」。

  • 商家檔案與 Merchant Center 帳戶之間的連結。如要建立連結,可以使用 Merchant Center 使用者介面或 Merchant API (請參閱「連結 Google 商家檔案」)。

建立全通路設定

您可以使用 omnichannelSettings.create 方法建立全通路設定。create 方法會將 omnichannelSetting 資源做為輸入內容,如果成功,則會傳回建立的無所不在設定。

建立時,您必須填寫 regionCodeLsfType

  • OmnichannelSetting 是以國家/地區為單位。RegionCode 定義目標國家/地區。建立後即無法變更。RegionCode 應遵循通用區域資料庫 (CLDR) 計畫定義的命名規則。
  • LsfType」以你的產品頁面為基礎。詳情請參閱 LsfType

詳情請參閱「變更店面商品目錄廣告的產品網頁類型」。

建立時不必填寫所有欄位,之後再設定即可。如要更新現有omnichannelSetting,請參閱「更新全方位設定」。

以下是選擇 MHLSF_BASIC 並註冊 inStock 的要求範例:

POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings

{
  "regionCode": "{REGION_CODE}",
  "lsfType: "MHLSF_BASIC",
  "inStock": {
      "uri": "{URI}"
  }
}

更改下列內容:

  • {ACCOUNT_ID}:Merchant Center 帳戶的專屬 ID
  • {REGION_CODE}:CLDR 定義的區域代碼
  • {URI}:用於指定評論的有效 URI。不符合資格的 URI 可能會導致核准遭拒。

要求成功執行後,您應該會看到以下回應:

{
  "name": "accounts/{ACCOUNT_ID}/omnichannelSettings/{omnichannel_setting}",
  "regionCode": "{REGION_CODE}",
  "lsfType: "MHLSF_BASIC",
  "inStock": {
      "uri": "{URI}",
      "state": "RUNNING"
  }
}

使用 omnichannelSetting 欄位註冊不同的店面商品目錄廣告/免費區域產品資訊功能時,會觸發人工審查,通常需要幾小時到幾天的時間。建議您仔細檢查輸入內容,以免資料不符資格而造成不必要的等待時間。

如要查看新建立的全方位通路設定或檢查評論狀態,請使用 accounts.omnichannelSettings.getaccounts.omnichannelSettings.list,並指定國家/地區。

本地店面 (LSF) 類型

根據你打算使用的產品頁面,選擇 LsfType

產品頁面類型 LsfType 列舉值
提供店內供應情形的產品頁面 商家代管的本地店面基本版 MHLSF_BASIC
提供供應情形和價格的特定商店產品頁面 商家代管的本地店面 (完整版) MHLSF_FULL
沒有店內供應情形的產品頁面 Google 代管的本地店面 (GHLSF) GHLSF

如果選擇商家代管的本地店面類型,至少須填寫 inStockpickup 的 URI 欄位。

InStock

你可以使用 InStock 提供產品頁面的詳細資訊。

如果選擇商家代管的 LSF 類型,並在 InStock 中指定 URI 欄位,即表示你打算提供有現貨的產品。我們會根據您提供的 URI 開始審查。

如果選擇 GHLSF 類型,則必須在要求中提供空白的 InStock 欄位。與商家代管的動態饋給類型不同,如要完成啟用程序,你必須完成商品目錄驗證程序。

這個程式碼範例會建立含有 GHLSFomnichannelSetting

package shopping.merchant.samples.accounts.v1;

// [START merchantapi_create_omnichannel_setting]
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1.AccountName;
import com.google.shopping.merchant.accounts.v1.CreateOmnichannelSettingRequest;
import com.google.shopping.merchant.accounts.v1.InStock;
import com.google.shopping.merchant.accounts.v1.OmnichannelSetting;
import com.google.shopping.merchant.accounts.v1.OmnichannelSetting.LsfType;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceClient;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceSettings;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;

/**
 *   This class demonstrates how to create an omnichannel setting for a given Merchant Center account
 *   in a given country
 */
public class CreateOmnichannelSettingSample {

  public static void createOmnichannelSetting(Config config, String regionCode) throws Exception {

    // Obtains OAuth token based on the user's configuration.
    GoogleCredentials credential = new Authenticator().authenticate();

    // Creates service settings using the retrieved credentials.
    OmnichannelSettingsServiceSettings omnichannelSettingsServiceSettings =
        OmnichannelSettingsServiceSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credential))
            .build();

    // Calls the API and catches and prints any network failures/errors.
    try (OmnichannelSettingsServiceClient omnichannelSettingsServiceClient =
        OmnichannelSettingsServiceClient.create(omnichannelSettingsServiceSettings)) {
      String accountId = config.getAccountId().toString();
      String parent = AccountName.newBuilder().setAccount(accountId).build().toString();

      // Creates an omnichannel setting with GHLSF type in the given country.
      CreateOmnichannelSettingRequest request =
          CreateOmnichannelSettingRequest.newBuilder()
              .setParent(parent)
              .setOmnichannelSetting(
                  OmnichannelSetting.newBuilder()
                      .setRegionCode(regionCode)
                      .setLsfType(LsfType.GHLSF)
                      .setInStock(InStock.getDefaultInstance())
                      .build())
              .build();

      System.out.println("Sending create omnichannel setting request:");
      OmnichannelSetting response =
          omnichannelSettingsServiceClient.createOmnichannelSetting(request);

      System.out.println("Inserted Omnichannel Setting below:");
      System.out.println(response);
    } catch (Exception e) {
      System.out.println("An error has occurred: ");
      System.out.println(e);
    }
  }

  public static void main(String[] args) throws Exception {
    Config config = Config.load();

    // The country which you're targeting at.
    String regionCode = "{REGION_CODE}";

    createOmnichannelSetting(config, regionCode);
  }
}
// [END merchantapi_list_omnichannel_settings]

取餐

除了店內供應情形,你也可以使用取貨功能提升店內產品的銷售成效,但這項功能僅適用於商家代管的店面商品目錄廣告類型。

如果產品標示為「取貨」,表示顧客可以在線上購買,然後到店取貨。設定 Pickup 欄位,表示你打算提供取貨服務水準協議的產品。我們會根據您提供的 URI 開始審查。

以下範例要求會使用 Pickup 建立 omnichannel 設定:

POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings

{
  "regionCode": "{REGION_CODE}",
  "lsfType: "MHLSF_BASIC",
  "pickup": {
     "uri: "{URI}"
  }
}

可訂購的展示商品

透過「可訂購的展示商品」功能,你可以展示實體商店內所陳列、但消費者無法立即購買的產品。例如,大型傢俱:

  • 在 Google 尋找相似產品的消費者,會在搜尋結果中看到有「店內有售」註解的廣告。
  • 在 Google 搜尋結果網頁瀏覽商店的消費者會看到這些產品標註為「可訂購」。

消費者可以選擇店面商品目錄廣告或免費區域產品資訊來查看商品。 如要購買商品,則可造訪實體商店,親自查看商品再下單,可要求宅配或到店取貨。

關於 (德國、奧地利和瑞士)

如果您在奧地利和德國放送廣告,並選擇 GHLSF,請務必提交簡介頁面。

如要在瑞士放送廣告,無論LsfType,都必須提交「關於」頁面。

在簡介頁面網址通過驗證前,GHLSF商家無法向 Google 申請手動商品目錄驗證。

在這些國家/地區,商家必須先通過「關於我們」頁面審核,才能啟用 FLL/LIA 功能。

商品目錄驗證

只有GHLSF商家需要進行商品目錄驗證。不支援 MHLSF 類型。

新增產品資料和商品目錄資料 (使用 accounts.products.localInventories.insert 或 Merchant Center 使用者介面) 前後,你都必須驗證聯絡人。使用 createupdate 方法提供商品目錄驗證聯絡人 (姓名和電子郵件地址)。聯絡人會收到 Google 傳送的電子郵件,並可點選郵件中的按鈕來驗證狀態。

完成後,即可申請商品目錄驗證。詳情請參閱「商品目錄驗證說明」。

您可以在驗證程序期間或驗證後,使用 omnichannelSetting.update 變更聯絡人。

完成這項程序後,Google 會驗證所提供資訊的準確性。

取得全通路設定

如要在特定國家/地區擷取 omnichannelSetting 設定,或查看評論的目前狀態,請使用 omnichannelSettings.get 方法。

以下是範例要求:

GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings/{OMNICHANNEL_SETTING}

更改下列內容:

  • {ACCOUNT_ID}:Merchant Center 帳戶的專屬 ID
  • {OMNICHANNEL_SETTING}:目標國家/地區的區域代碼

ACTIVE 狀態表示審查已獲得核准。

如果狀態為 FAILED,請解決問題,然後呼叫 omnichannelSetting.update 觸發新的審查。

唯讀的 LFP 欄位會顯示店面動態饋給合作夥伴狀態。如要連結至合作關係,請使用 lfpProviders.linkLfpProvider

如要進一步瞭解如何查看狀態及其意義,請參閱「查看全通路設定的狀態」。

列出全通路設定

如要擷取帳戶的所有 omnichannelSetting 資訊,請使用 omnichannelSettings.list 方法。

程式碼範例如下:

package shopping.merchant.samples.accounts.v1;

// [START merchantapi_list_omnichannel_settings]
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1.AccountName;
import com.google.shopping.merchant.accounts.v1.ListOmnichannelSettingsRequest;
import com.google.shopping.merchant.accounts.v1.OmnichannelSetting;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceClient;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceClient.ListOmnichannelSettingsPagedResponse;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceSettings;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;

/**
 *   This class demonstrates how to get the list of omnichannel settings for a given Merchant Center
 *   account
 */
public class ListOmnichannelSettingsSample {

  public static void omnichannelSettings(Config config) throws Exception {

    // Obtains OAuth token based on the user's configuration.
    GoogleCredentials credential = new Authenticator().authenticate();

    // Creates service settings using the retrieved credentials.
    OmnichannelSettingsServiceSettings omnichannelSettingsServiceSettings =
        OmnichannelSettingsServiceSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credential))
            .build();

    String accountId = config.getAccountId().toString();
    String parent = AccountName.newBuilder().setAccount(accountId).build().toString();

    // Calls the API and catches and prints any network failures/errors.
    try (OmnichannelSettingsServiceClient omnichannelSettingsServiceClient =
        OmnichannelSettingsServiceClient.create(omnichannelSettingsServiceSettings)) {
      ListOmnichannelSettingsRequest request =
          ListOmnichannelSettingsRequest.newBuilder().setParent(parent).build();

      System.out.println("Sending list omnichannel setting request:");
      ListOmnichannelSettingsPagedResponse response =
          omnichannelSettingsServiceClient.listOmnichannelSettings(request);

      int count = 0;

      // Iterates over all the entries in the response.
      for (OmnichannelSetting omnichannelSetting : response.iterateAll()) {
        System.out.println(omnichannelSetting);
        count++;
      }
      System.out.println(String.format("The following count of elements were returned: %d", count));
    } catch (Exception e) {
      System.out.println("An error has occurred: ");
      System.out.println(e);
    }
  }

  public static void main(String[] args) throws Exception {
    Config config = Config.load();

    omnichannelSettings(config);
  }
}
// [END merchantapi_list_omnichannel_settings]

更新全通路設定

如要更新現有全方位通路設定的設定,請使用 omnichannelSettings.update 方法。

如要更新,請務必將所需功能新增至更新遮罩,並在更新要求的 omnichannelSetting 欄位中填入對應欄位。你可以更新任何

  • lsfType
  • inStock
  • pickup
  • odo
  • about
  • inventoryVerification

如果屬性未納入更新遮罩,就不會更新。

如果更新遮罩中包含某項屬性,但要求中未設定該屬性,系統就會清除該屬性。

以下程式碼範例說明如何更新商品目錄驗證欄位。

package shopping.merchant.samples.accounts.v1;

// [START merchantapi_update_omnichannel_setting]
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.protobuf.FieldMask;
import com.google.shopping.merchant.accounts.v1.InventoryVerification;
import com.google.shopping.merchant.accounts.v1.OmnichannelSetting;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingName;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceClient;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceSettings;
import com.google.shopping.merchant.accounts.v1.UpdateOmnichannelSettingRequest;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;

/**
 *   This class demonstrates how to update an omnichannel setting for a given Merchant Center account
 *   in a given country
 */
public class UpdateOmnichannelSettingSample {

  public static void updateOmnichannelSettings(
      Config config, String regionCode, String contact, String email) throws Exception {

    // Obtains OAuth token based on the user's configuration.
    GoogleCredentials credential = new Authenticator().authenticate();

    // Creates service settings using the retrieved credentials.
    OmnichannelSettingsServiceSettings omnichannelSettingsServiceSettings =
        OmnichannelSettingsServiceSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credential))
            .build();

    // Calls the API and catches and prints any network failures/errors.
    try (OmnichannelSettingsServiceClient omnichannelSettingsServiceClient =
        OmnichannelSettingsServiceClient.create(omnichannelSettingsServiceSettings)) {
      String accountId = config.getAccountId().toString();
      String name =
          OmnichannelSettingName.newBuilder()
              .setAccount(accountId)
              .setOmnichannelSetting(regionCode)
              .build()
              .toString();

      OmnichannelSetting omnichannelSetting =
          OmnichannelSetting.newBuilder()
              .setName(name)
              .setInventoryVerification(
                  InventoryVerification.newBuilder()
                      .setContact(contact)
                      .setContactEmail(email)
                      .build())
              .build();
      FieldMask fieldMask = FieldMask.newBuilder().addPaths("inventory_verification").build();
      UpdateOmnichannelSettingRequest request =
          UpdateOmnichannelSettingRequest.newBuilder()
              .setOmnichannelSetting(omnichannelSetting)
              .setUpdateMask(fieldMask)
              .build();

      System.out.println("Sending update omnichannel setting request:");
      OmnichannelSetting response =
          omnichannelSettingsServiceClient.updateOmnichannelSetting(request);

      System.out.println("Updated Omnichannel Setting below:");
      System.out.println(response);
    } catch (Exception e) {
      System.out.println("An error has occurred: ");
      System.out.println(e);
    }
  }

  public static void main(String[] args) throws Exception {
    Config config = Config.load();

    // The country which you're targeting at.
    String regionCode = "{REGION_CODE}";
    // The name of the inventory verification contact you want to update.
    String contact = "{NAME}";
    // The address of the inventory verification email you want to update.
    String email = "{EMAIL}";

    updateOmnichannelSettings(config, regionCode, contact, email);
  }
}
// [END merchantapi_update_omnichannel_setting]

申請商品目錄驗證

omnichannelSettings.requestInventoryVerification 僅適用於GHLSF商家。

呼叫此 RPC 前,您必須完成下列操作:

  • 上傳產品和商品目錄資料。
  • 驗證商品目錄驗證聯絡人。
  • 如果商家位於奧地利、德國或瑞士,請完成About頁面審查。

如要確認自己是否符合資格,請撥打 omnichannelSettings.get 並查看 omnichannelSetting.inventoryVerification.state。如果顯示 INACTIVE,表示您已準備好呼叫 omnichannelSettings.requestInventoryVerification

package shopping.merchant.samples.accounts.v1;

// [START merchantapi_request_inventory_verification]
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingName;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceClient;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingsServiceSettings;
import com.google.shopping.merchant.accounts.v1.RequestInventoryVerificationRequest;
import com.google.shopping.merchant.accounts.v1.RequestInventoryVerificationResponse;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;

/**
 *   This class demonstrates how to request inventory verification for a given Merchant Center account
 *   in a given country
 */
public class RequestInventoryVerificationSample {

  public static void requestInventoryVerification(Config config, String regionCode)
      throws Exception {

    // Obtains OAuth token based on the user's configuration.
    GoogleCredentials credential = new Authenticator().authenticate();

    // Creates service settings using the retrieved credentials.
    OmnichannelSettingsServiceSettings omnichannelSettingsServiceSettings =
        OmnichannelSettingsServiceSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credential))
            .build();

    // Calls the API and catches and prints any network failures/errors.
    try (OmnichannelSettingsServiceClient omnichannelSettingsServiceClient =
        OmnichannelSettingsServiceClient.create(omnichannelSettingsServiceSettings)) {
      String accountId = config.getAccountId().toString();
      String name =
          OmnichannelSettingName.newBuilder()
              .setAccount(accountId)
              .setOmnichannelSetting(regionCode)
              .build()
              .toString();
      RequestInventoryVerificationRequest request =
          RequestInventoryVerificationRequest.newBuilder().setName(name).build();

      System.out.println("Sending request inventory verification request:");
      RequestInventoryVerificationResponse response =
          omnichannelSettingsServiceClient.requestInventoryVerification(request);

      System.out.println("Omnichannel Setting after inventory verification request below:");
      System.out.println(response);
    } catch (Exception e) {
      System.out.println("An error has occurred: ");
      System.out.println(e);
    }
  }

  public static void main(String[] args) throws Exception {
    Config config = Config.load();

    // The country which you're targeting at.
    String regionCode = "{REGION_CODE}";

    requestInventoryVerification(config, regionCode);
  }
}
// [END merchantapi_request_inventory_verification]

查看全方位通路設定的狀態。

如要查看店面商品廣告的啟用審查狀態,請檢查 omnichannelSettings.getomnichannelSettings.list 方法傳回的ReviewState omnichannelSetting 對應屬性。

ReviewState 欄位適用於所有新手上路審查 (不含商品目錄驗證程序),且可包含下列值:

  • ACTIVE:已核准。
  • FAILED:遭到拒絕。
  • RUNNING:仍在審查中。
  • ACTION_REQUIRED:這只存在於 GHLSF 商家的 InStock.state 中。也就是說,你必須申請商品目錄驗證,才能放送店面商品廣告。

InventoryVerification.State 的值如下:

  • SUCCEEDED:已核准。
  • INACTIVE:你已準備好申請商品目錄驗證。
  • RUNNING:仍在審核中
  • SUSPENDED:你商品目錄驗證失敗的次數過多 (通常為 5 次),必須等待一段時間才能再次申請。
  • ACTION_REQUIRED:如要申請商品目錄驗證,請先完成下列步驟。

本節說明如何排解常見問題。

建立全通路設定

  • 請務必設定 LsfTypeRegionCode
  • 如果選擇 GHLSF,請在要求中提供空白的 InStock
  • 如果選擇商家代管的 LSF 類型,請在 InStockPickup 中提供至少一個 URI。

更新全通路設定

更新這項資源的方法需要遵守下列額外規則:

  • 你無法修改區域代碼。
  • 如果 LIA/FLL 功能正在執行或已獲准,就無法進行更新。
  • 從商家代管的 LSF 類型變更為 GHLSF 時,如果先前已設定 InStockPickup,則必須將這些項目連同 LsfType 更新一併納入更新遮罩。

舉例來說,如果您先前已申請 MHLSF_BASICPickup,但遭到拒絕,可以傳送如下要求,改為申請 GHLSF

PATCH https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings/{REGION_CODE}?update_mask=lsf_type,in_stock,pickup

{
  "lsfType: "GHLSF",
  "inStock": {},
}

更改下列內容:

  • {ACCOUNT_ID}:Merchant Center 帳戶的專屬 ID
  • {REGION_CODE}:CLDR 定義的區域代碼

申請商品目錄驗證

如果更新產品或商品目錄動態饋給並確認聯絡人後,InventoryVerification.state 仍不是 INACTIVE

  • 奧地利、德國和瑞士的商家:請確認已完成簡介頁面審查。
  • 因此會延遲約 48 小時。
  • 如果商品目錄檢查失敗次數超過五次,服務會強制執行三十天的等待期,之後才能再次提出要求。如要申請提早退款,請與 Google 支援團隊聯絡。

瞭解詳情

詳情請參閱店面商品目錄廣告和免費區域產品資訊說明中心