OmnichannelSettings API เป็นจุดเริ่มต้นในการกำหนดค่าโปรแกรมโฆษณาสินค้าคงคลังในร้าน (LIA) และข้อมูลในร้านที่แสดงฟรี (FLL)
ใช้เพื่อดำเนินการโดยอัตโนมัติ
- จัดการ (สร้างและอัปเดต) การตั้งค่า Omnichannel
- ดึงข้อมูล (รับและแสดงรายการ) การตั้งค่าช่องทาง Omni
- ขอรับการยืนยันสินค้าคงคลังสำหรับผู้ขายที่มีสิทธิ์
ดูข้อมูลเพิ่มเติมได้ที่ภาพรวมของโฆษณาสินค้าคงคลังในร้านและข้อมูลในร้านที่แสดงฟรี
ข้อกำหนดเบื้องต้น
คุณควรมี
บัญชี Merchant Center
Business Profile หากยังไม่มีบัญชี คุณก็สร้างใหม่ได้ ดูลงชื่อสมัครใช้ Business Profile
การลิงก์ระหว่าง Business Profile กับบัญชี Merchant Center หากต้องการสร้างลิงก์ คุณสามารถใช้อินเทอร์เฟซผู้ใช้ Merchant Center หรือ Merchant API (ดูลิงก์ Google Business Profile)
สร้างการตั้งค่าการเข้าถึงลูกค้าจากทุกช่องทาง (Omnichannel)
คุณสามารถใช้เมธอด omnichannelSettings.create เพื่อสร้างการตั้งค่า
Omnichannel ได้ เมธอด create รับทรัพยากร omnichannelSetting เป็นอินพุตและ
แสดงผลการตั้งค่า Omnichannel ที่สร้างขึ้น หากสำเร็จ
เมื่อสร้าง คุณต้องกรอกทั้ง regionCode และ
LsfType
- OmnichannelSetting จะพิจารณาตามประเทศ
RegionCodeกำหนด ประเทศเป้าหมาย เมื่อสร้างแล้ว คุณจะเปลี่ยนไม่ได้RegionCodeควร ทำตามกฎการตั้งชื่อที่กำหนดโดยโปรเจ็กต์ที่เก็บข้อมูลภาษาทั่วไป (CLDR) LsfTypeอิงตามหน้าผลิตภัณฑ์ ดูรายละเอียดได้ที่LsfType
ดูรายละเอียดเพิ่มเติมได้ที่เปลี่ยนประสบการณ์การใช้งานหน้าผลิตภัณฑ์สำหรับโฆษณาสินค้าคงคลังในร้าน
คุณไม่จำเป็นต้องกรอกข้อมูลทุกช่องในขั้นตอนการสร้าง แต่สามารถ
กำหนดค่าในภายหลังแทนได้ หากต้องการอัปเดต omnichannelSetting ที่มีอยู่ โปรดดูอัปเดตการตั้งค่าช่องทาง Omni
ตัวอย่างคำขอหากคุณเลือก 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{REGION_CODE}: รหัสภูมิภาคตามที่กำหนดโดย CLDR{URI}: URI ที่ถูกต้องซึ่งใช้สำหรับรีวิวที่ระบุ URI ที่ไม่มีสิทธิ์อาจ ทำให้ไม่ได้รับการอนุมัติ
หลังจากเรียกใช้คำขอสำเร็จแล้ว คุณควรเห็นการตอบกลับต่อไปนี้
{
"name": "accounts/{ACCOUNT_ID}/omnichannelSettings/{omnichannel_setting}",
"regionCode": "{REGION_CODE}",
"lsfType: "MHLSF_BASIC",
"inStock": {
"uri": "{URI}",
"state": "RUNNING"
}
}
การลงทะเบียนฟีเจอร์ LIA/FLL ที่แตกต่างกันโดยใช้ฟิลด์ omnichannelSetting จะทริกเกอร์การตรวจสอบด้วยตนเอง ซึ่งโดยปกติจะใช้เวลา 2-3 ชั่วโมงถึง 2-3 วัน
เราขอแนะนำให้คุณตรวจสอบข้อมูลที่ป้อนอีกครั้งเพื่อหลีกเลี่ยงเวลาในการรอที่ไม่จำเป็นเนื่องจากข้อมูลไม่มีสิทธิ์
หากต้องการดูการตั้งค่าแบบ Omnichannel ที่สร้างขึ้นใหม่หรือตรวจสอบสถานะของรีวิว
ให้ใช้ accounts.omnichannelSettings.get หรือ accounts.omnichannelSettings.list
โดยระบุประเทศ
ประเภทหน้าร้านในพื้นที่ (LSF)
เลือก LsfType ตามหน้าผลิตภัณฑ์ที่คุณวางแผนจะใช้
| ประเภทหน้าผลิตภัณฑ์ | LsfType | ค่า enum |
|---|---|---|
| หน้าสินค้าที่ระบุความพร้อมจำหน่ายสินค้าในร้าน | หน้าร้านในพื้นที่ที่ผู้ขายโฮสต์ (แบบพื้นฐาน) | MHLSF_BASIC |
| หน้าสินค้าของร้านค้าที่เฉพาะเจาะจงพร้อมความพร้อมจำหน่ายสินค้าและราคา | หน้าร้านในพื้นที่ที่ผู้ขายโฮสต์แบบเต็ม | MHLSF_FULL |
| หน้าสินค้าที่ไม่ระบุความพร้อมจำหน่ายสินค้าในร้านค้า | หน้าร้านในพื้นที่ที่โฮสต์โดย Google (GHLSF) | GHLSF |
หากเลือกประเภทหน้าร้านในพื้นที่ที่ผู้ขายโฮสต์ คุณจะต้องกรอกข้อมูลในช่อง URI สำหรับ inStock หรือ pickup อย่างน้อย 1 รายการด้วย
InStock
คุณใช้ InStock เพื่อให้ข้อมูลเพิ่มเติมเกี่ยวกับหน้าผลิตภัณฑ์ได้
หากเลือกประเภท LSF ที่ผู้ขายโฮสต์และระบุฟิลด์ URI ใน InStock แสดงว่าคุณต้องการแสดงผลิตภัณฑ์ที่มีความพร้อมจำหน่ายสินค้าเป็น "พร้อมจำหน่าย" เรา จะเริ่มการตรวจสอบตาม URI ที่ระบุ
หากเลือกประเภท GHLSF คุณต้องระบุช่อง InStock ที่ว่างเปล่าในคำขอ
คุณต้องทำตามกระบวนการยืนยันสินค้าคงคลังให้เสร็จสมบูรณ์เพื่อเริ่มต้นใช้งานให้เสร็จสมบูรณ์ ซึ่งแตกต่างจาก LSF ประเภทที่โฮสต์โดยผู้ขาย
ตัวอย่างโค้ดนี้สร้าง omnichannelSetting ด้วย GHLSF ดังนี้
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]
รับที่ร้าน
นอกเหนือจากความพร้อมจำหน่ายสินค้าในร้านแล้ว คุณยังปรับปรุงผลิตภัณฑ์ในร้านได้ด้วยฟีเจอร์การรับสินค้า ซึ่งมีสิทธิ์สำหรับประเภท LSF ที่โฮสต์โดยผู้ขายเท่านั้น
เมื่อมีการทำเครื่องหมายผลิตภัณฑ์สำหรับการรับสินค้า หมายความว่าลูกค้าสามารถซื้อผลิตภัณฑ์ทางออนไลน์
และรับสินค้าที่ร้านค้าได้ การตั้งค่าฟิลด์ Pickup แสดงให้เห็นว่าคุณตั้งใจที่จะแสดงผลิตภัณฑ์ที่มี SLA สำหรับการรับสินค้า เราจะเริ่มการตรวจสอบโดยอิงตาม URI ที่ระบุ
ต่อไปนี้เป็นคำขอตัวอย่างที่สร้างการตั้งค่า omnichannel ด้วย Pickup
POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings
{
"regionCode": "{REGION_CODE}",
"lsfType: "MHLSF_BASIC",
"pickup": {
"uri: "{URI}"
}
}
สั่งซื้อได้
ฟีเจอร์ สั่งซื้อได้ ช่วยให้คุณแสดงผลิตภัณฑ์ที่แสดงในหน้าร้านจริงแต่ ไม่พร้อมจำหน่ายในทันทีได้ เช่น เฟอร์นิเจอร์ขนาดใหญ่
- ลูกค้าที่กำลังมองหาผลิตภัณฑ์ที่คล้ายกันบน Google จะเห็นโฆษณาเหล่านี้ พร้อมคำอธิบายประกอบ "ที่ร้านค้า" ในผลการค้นหา
- ลูกค้าที่กำลังเรียกดูร้านค้าในหน้าผลการค้นหาของ Google Search จะเห็นสินค้าเหล่านี้มีการทำเครื่องหมายเป็น "พร้อมสำหรับการสั่งซื้อ"
ลูกค้าสามารถเลือกโฆษณาสินค้าคงคลังในร้านหรือข้อมูลในร้านที่แสดงฟรีเพื่อดูสินค้าดังกล่าวได้ เมื่อต้องการซื้อสินค้า ลูกค้าจะไปยังหน้าร้านจริง ดูสินค้า จากนั้นสั่งซื้อสินค้าให้จัดส่งไปที่บ้านหรือส่งไปที่ร้านแล้วมารับสินค้าเองก็ได้
เกี่ยวกับ (เยอรมนี ออสเตรีย และสวิตเซอร์แลนด์)
หากคุณให้บริการในออสเตรียและเยอรมนีและเลือก GHLSF คุณต้องส่งหน้าเกี่ยวกับ
หากแสดงโฆษณาในสวิตเซอร์แลนด์ คุณต้องส่งหน้า "เกี่ยวกับ" ไม่ว่าLsfType
จนกว่า URL ของหน้า "เกี่ยวกับ" จะได้รับการยืนยัน GHLSF ผู้ขายจะขอรับการยืนยันสินค้าคงคลังด้วยตนเองจาก Google ไม่ได้
สำหรับผู้ขายทั้งหมดใน 3 ประเทศนี้ บริการจะไม่เปิดใช้ฟีเจอร์ FLL/LIA จนกว่าหน้า "เกี่ยวกับ" จะได้รับการอนุมัติ
การยืนยันสินค้าคงคลัง
การยืนยันสินค้าคงคลังจำเป็นสำหรับGHLSFผู้ขายเท่านั้น ไม่รองรับสำหรับประเภท MHLSF
คุณต้องยืนยันผู้ติดต่อไม่ว่าจะก่อนหรือหลังจากเพิ่มข้อมูลผลิตภัณฑ์และข้อมูลสินค้าคงคลัง (ไม่ว่าจะใช้accounts.products.localInventories.insertหรืออินเทอร์เฟซผู้ใช้ Merchant Center) ระบุรายชื่อติดต่อสำหรับการยืนยันสินค้าคงคลัง (ชื่อและอีเมล) โดยใช้วิธีcreateหรือupdate
ผู้ติดต่อจะได้รับอีเมลที่ Google ส่งให้และสามารถยืนยัน
สถานะของตนเองได้โดยคลิกปุ่มในข้อความ
เมื่อดำเนินการเสร็จแล้ว คุณจะขอรับการยืนยัน สินค้าคงคลังได้ ดูข้อมูลเพิ่มเติมได้ที่เกี่ยวกับการยืนยันสินค้าคงคลัง
คุณเปลี่ยนผู้ติดต่อได้ในระหว่างกระบวนการยืนยันหรือหลังจากยืนยันโดยใช้ omnichannelSetting.update
หลังจากกระบวนการนี้เสร็จสมบูรณ์แล้ว Google จะตรวจสอบความถูกต้องของข้อมูลที่ให้ไว้
รับการตั้งค่าการเข้าถึงลูกค้าจากทุกช่องทาง (Omnichannel)
หากต้องการเรียกข้อมูลการกำหนดค่า omnichannelSetting ในประเทศที่ต้องการ หรือตรวจสอบ
สถานะปัจจุบันของรีวิว ให้ใช้วิธี omnichannelSettings.get
ตัวอย่างคำขอมีดังนี้
GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings/{OMNICHANNEL_SETTING}
แทนที่ค่าต่อไปนี้
{ACCOUNT_ID}: ตัวระบุที่ไม่ซ้ำกันของบัญชี Merchant Center{OMNICHANNEL_SETTING}: รหัสภูมิภาคของประเทศเป้าหมาย
ACTIVE สถานะแสดงว่ารีวิวได้รับการอนุมัติแล้ว
หากสถานะเป็น FAILED ให้แก้ไขปัญหาและทริกเกอร์การตรวจสอบใหม่โดย
โทรหา omnichannelSetting.update
ฟิลด์ LFP แบบอ่านอย่างเดียวจะแสดงสถานะการเป็นพาร์ทเนอร์ทางธุรกิจสำหรับฟีดในร้าน หากต้องการลิงก์ไปยัง
การเป็นพาร์ทเนอร์ ให้ใช้ lfpProviders.linkLfpProvider
ดูข้อมูลเพิ่มเติมเกี่ยวกับการตรวจสอบสถานะและความหมายของสถานะได้ที่ดู สถานะของการตั้งค่า Omnichannel
แสดงการตั้งค่าการเข้าถึงลูกค้าจากทุกช่องทาง (Omnichannel)
หากต้องการดึงข้อมูล 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]
อัปเดตการตั้งค่าแบบหลายช่องทาง
หากต้องการอัปเดตการกำหนดค่าของการตั้งค่า Omnichannel ที่มีอยู่ ให้ใช้เมธอด
omnichannelSettings.update
หากต้องการอัปเดต คุณต้องเพิ่มฟีเจอร์ที่ต้องการลงในมาสก์การอัปเดต และกรอกข้อมูลใน
ฟิลด์ที่เกี่ยวข้องในฟิลด์ omnichannelSetting ในคำขออัปเดต
คุณอัปเดต
lsfTypeinStockpickupodoaboutinventoryVerification
หากไม่ได้รวมแอตทริบิวต์ไว้ในมาสก์การอัปเดต ระบบจะไม่ทำการอัปเดต
หากรวมแอตทริบิวต์ไว้ในมาสก์การอัปเดต แต่ไม่ได้ตั้งค่าในคำขอ ระบบจะล้างแอตทริบิวต์นั้น
ตัวอย่างโค้ดต่อไปนี้แสดงวิธีอัปเดตช่องการยืนยันสินค้าคงคลัง
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]
ดูสถานะของการตั้งค่าช่องทาง Omni
หากต้องการตรวจสอบสถานะการตรวจสอบการเริ่มต้นใช้งาน LIA ให้ตรวจสอบReviewState
แอตทริบิวต์ที่เกี่ยวข้องของ omnichannelSetting ที่ส่งคืนโดยเมธอด
omnichannelSettings.get หรือ omnichannelSettings.list
ฟิลด์ ReviewState ใช้กับการตรวจสอบการเริ่มต้นใช้งานทั้งหมด ยกเว้นกระบวนการยืนยันพื้นที่โฆษณา และอาจมีค่าต่อไปนี้
ACTIVE: ได้รับอนุมัติแล้วFAILED: ถูกปฏิเสธRUNNING: ยังอยู่ระหว่างการตรวจสอบACTION_REQUIRED: ฟีเจอร์นี้มีเฉพาะในInStock.stateสำหรับผู้ขาย GHLSF ซึ่งหมายความว่าคุณต้องขอรับการยืนยันสินค้าคงคลังเพื่อให้ LIA แสดง
InventoryVerification.State มีค่าต่อไปนี้
SUCCEEDED: ได้รับอนุมัติแล้วINACTIVE: คุณพร้อมที่จะขอรับการยืนยันสินค้าคงคลังแล้วRUNNING: อยู่ระหว่างตรวจสอบSUSPENDED: คุณไม่ผ่านการยืนยันสินค้าคงคลังหลายครั้งเกินไป (โดยปกติคือ 5 ครั้ง) และต้องรอจึงจะขออีกครั้งได้ACTION_REQUIRED: คุณต้องดำเนินการเพิ่มเติมก่อนขอรับการยืนยันสินค้าคงคลัง
แก้ปัญหาเกี่ยวกับ OmnichannelSettings API
ส่วนนี้จะอธิบายวิธีแก้ปัญหาที่พบบ่อย
สร้างการตั้งค่าการเข้าถึงลูกค้าจากทุกช่องทาง (Omnichannel)
- โปรดตั้งค่าทั้ง
LsfTypeและRegionCode - หากเลือก
GHLSFให้ระบุInStockที่ว่างเปล่าในคำขอ - หากเลือกประเภท LSF ที่โฮสต์โดยผู้ขาย ให้ระบุ URI อย่างน้อย 1 รายการใน
InStockหรือPickup
อัปเดตการตั้งค่าแบบหลายช่องทาง
วิธีการอัปเดตสำหรับทรัพยากรนี้ต้องมีกฎเพิ่มเติมต่อไปนี้
- คุณแก้ไขรหัสภูมิภาคไม่ได้
- คุณจะทำการอัปเดตไม่ได้ขณะที่ฟีเจอร์ LIA/FLL ทำงานอยู่หรือได้รับอนุมัติแล้ว
- เมื่อเปลี่ยนจากประเภท LSF ที่โฮสต์โดยผู้ขายเป็น
GHLSFหากก่อนหน้านี้มีการกำหนดค่าInStockและPickupคุณต้องรวมไว้ในการอัปเดต มาสก์พร้อมกับการอัปเดตLsfType
เช่น หากคุณสมัครใช้ MHLSF_BASIC และ Pickup ก่อนหน้านี้และถูกปฏิเสธ
คุณจะเปลี่ยนไปใช้ 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{REGION_CODE}: รหัสภูมิภาคตามที่กำหนดไว้ใน CLDR
ขอรับการยืนยันสินค้าคงคลัง
หากแม้จะอัปเดตฟีดผลิตภัณฑ์หรือฟีดสินค้าคงคลังและยืนยันรายชื่อติดต่อแล้ว แต่
InventoryVerification.stateยังคงไม่ใช่INACTIVE ให้ทำดังนี้
- สำหรับผู้ขายในออสเตรีย เยอรมนี และสวิตเซอร์แลนด์ โปรดตรวจสอบว่าคุณได้ ดำเนินการตรวจสอบหน้า "เกี่ยวกับ" เสร็จสมบูรณ์แล้ว
- โดยจะมีความล่าช้าประมาณ 48 ชั่วโมง
- ในกรณีที่การตรวจสอบสินค้าคงคลังล้มเหลวซ้ำๆ (มากกว่า 5 ครั้ง) บริการจะบังคับใช้ระยะเวลาพัก 30 วันก่อนที่จะอนุญาตให้ส่งคำขออีกครั้ง โปรดติดต่อทีมสนับสนุนของ Google หากต้องการขอรับเงินคืนก่อน
ดูข้อมูลเพิ่มเติม
ดูรายละเอียดเพิ่มเติมได้ที่ ศูนย์ช่วยเหลือเกี่ยวกับโฆษณาสินค้าคงคลังในร้านและข้อมูลในร้านที่แสดงฟรี