使用 Accounts 子 API 管理您账号下所有产品以及所有关联子账号的配送设置。
您对配送设置所做的更改将应用于所有商品。如需更新单个商品的配送信息,请使用 Merchant Products API。
如需了解详情,请参阅设置配送设置。
配送设置概览
通过 accounts.shippingSettings
资源,您可以检索和更新高级账号及所有关联子账号的配送设置。
高级账号通常供为多家企业管理网上商店和 API 服务的集成商、汇总商和渠道合作伙伴使用。如果商家拥有多个网店或品牌,并且在不同的网站上销售商品,则商家还可以选择在单个高级账号下拥有子账号。
Google 可以自动更新部分商品的预计送货时间。
添加配送设置
如需为账号添加或更新配送设置,请使用 accounts.shippingSettings.insert
方法。
以下示例请求设置了配送价格、此配送服务仅限使用的会员回馈计划以及币种代码。
HTTP
POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/shippingSettings:insert
{
"etag": "",
"name": "accounts/ACCOUNT_ID/shippingSetting",
"services": [
{
"deliveryCountries": [
"COUNTRY_CODE"
],
"serviceName": "SERVICE_NAME",
"active": false,
"deliveryTime": {},
"loyaltyPrograms": [
{
"programLabel": "PROGRAM_LABEL"
}
],
"minimumOrderValue": {
"amountMicros": PRICE,
"currencyCode": "CURRENCY_CODE"
},
"currencyCode": "USD",
"rateGroups": [
{
"applicableShippingLabels": [
"SHIPPING_LABEL"
],
"singleValue": {
"flatRate": {
"amountMicros": 10000000,
"currencyCode": "USD"
}
}
}
]
}
]
}
cURL
curl --request POST \
'https://merchantapi.googleapis.com/accounts/v1/accounts/ACCOUNT_ID/shippingSettings:insert' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"name":"SHIPPING_SETTING_NAME","services":[{"serviceName":"SERVICE_NAME","currencyCode":"CURRENCY_CODE","rateGroups":[{"applicableShippingLabels":["SHIPPING_LABEL"],"carrierRates":[{"name":"new","carrier":"CARRIER_NAME","carrierService":"CARRIER_SERVICE","originPostalCode":"ZIPCODE"}],"singleValue":{"flatRate":{"amountMicros":10000000,"currencyCode":"USD"}}}],"deliveryCountries":["COUNTRY_CODE"],"deliveryTime":{"maxHandlingDays":2,"minHandlingDays":1},"minimumOrderValue":{"amountMicros":50000000,"currencyCode":"USD"},"active":false}]}' \
--compressed
替换以下内容:
- ACCOUNT_ID:您的 Merchant Center 账号的唯一标识符。
- COUNTRY_CODE:相应服务所适用的国家/地区的 CLDR(通用语言区域数据代码库)代码。必须与费率组中的价格一致。
- SERVICE_NAME:服务的名称。
- CARRIER_NAME:运输公司的名称。例如,UPS 和 FedEx。
- CARRIER_SERVICE:运营商支持的服务。
如需查看运输公司服务的完整列表,请参阅运输公司费率(仅适用于澳大利亚、德国、英国和美国)。
- PROGRAM_LABEL:您在 Merchant Center 的会员回馈活动设置中设定的会员回馈活动标签。
- SHIPPING_LABEL:一个配送标签列表,用于定义此费率组所适用的产品。
- PRICE:以微为单位表示的价格,以数字形式呈现。例如,1 美元 = 100 万微美元。
- CURRENCY_CODE:价格的币种,使用三个字母的缩写。
如需详细了解指定字段,请参阅参考文档。
请求正文应包含 accounts.shippingSettings
资源的完整资源正文,即使您只是更新单个属性也是如此,因为请求正文中的任何 NULL 值或缺失值都会导致现有值变为 null。
以下是成功调用的示例响应:
{
"name": "accounts/ACCOUNT_ID/shippingSettings",
"services": [
{
"serviceName": "SERVICE_NAME",
"active": false,
"deliveryCountries": [
"COUNTRY_CODE"
],
"currencyCode": "CURRENCY_CODE",
"rateGroups": [
{
"applicableShippingLabels": [
"SHIPPING_LABEL"
],
"singleValue": {
"flatRate": {
"amountMicros": "PRICE",
"currencyCode": "CURRENCY_CODE"
}
}
}
],
"shipmentType": "LOCAL_DELIVERY",
"storeConfig": {
"storeServiceType": "ALL_STORES",
"cutoffConfig": {
"localCutoffTime": {
"hour": "7",
"minute": "40"
},
"noDeliveryPostCutoff": false
},
"serviceRadius": {
"value": "40",
"unit": "KILOMETERS"
}
}
}
],
"etag": "OAJCTQgBEAAaRwoEdGVzdBIEIgJVUxoDVVNEIggiBggHECgoACoeCAESDwoNCAESCU9WRVJTSVpFRBoJIgcIAhCAwtcvWAWSAQCaAQQIAhAo"
}
以下示例展示了如何使用客户端库更新指定账号的配送设置:
Java
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1.DeliveryTime;
import com.google.shopping.merchant.accounts.v1.InsertShippingSettingsRequest;
import com.google.shopping.merchant.accounts.v1.RateGroup;
import com.google.shopping.merchant.accounts.v1.Service;
import com.google.shopping.merchant.accounts.v1.Service.ShipmentType;
import com.google.shopping.merchant.accounts.v1.ShippingSettings;
import com.google.shopping.merchant.accounts.v1.ShippingSettingsServiceClient;
import com.google.shopping.merchant.accounts.v1.ShippingSettingsServiceSettings;
import com.google.shopping.merchant.accounts.v1.Value;
import com.google.shopping.type.Price;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;
/** This class demonstrates how to insert a ShippingSettings for a Merchant Center account. */
public class InsertShippingSettingsSample {
private static String getParent(String accountId) {
return String.format("accounts/%s", accountId);
}
public static void insertShippingSettings(Config config) throws Exception {
// Obtains OAuth token based on the user's configuration.
GoogleCredentials credential = new Authenticator().authenticate();
// Creates service settings using the credentials retrieved above.
ShippingSettingsServiceSettings shippingSettingsServiceSettings =
ShippingSettingsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credential))
.build();
// Creates parent to identify where to insert the shippingsettings.
String parent = getParent(config.getAccountId().toString());
// Calls the API and catches and prints any network failures/errors.
try (ShippingSettingsServiceClient shippingSettingsServiceClient =
ShippingSettingsServiceClient.create(shippingSettingsServiceSettings)) {
InsertShippingSettingsRequest request =
InsertShippingSettingsRequest.newBuilder()
.setParent(parent)
.setShippingSetting(
ShippingSettings.newBuilder()
// Etag needs to be an empty string on initial insert
// On future inserts, call GET first to get the Etag
// Then use the retrieved Etag on future inserts.
// NOTE THAT ON THE INITIAL INSERT, YOUR SHIPPING SETTINGS WILL
// NOT BE STORED, YOU HAVE TO CALL INSERT AGAIN WITH YOUR
// RETRIEVED ETAG.
// .setEtag("")
.setEtag("PPa=")
.addServices(
Service.newBuilder()
.setServiceName("Canadian Postal Service")
.setActive(true)
.addDeliveryCountries("CA")
.setCurrencyCode("CAD")
.setDeliveryTime(
DeliveryTime.newBuilder()
.setMinTransitDays(0)
.setMaxTransitDays(3)
.setMinHandlingDays(0)
.setMaxHandlingDays(3)
.build())
.addRateGroups(
RateGroup.newBuilder()
.addApplicableShippingLabels("Oversized")
.addApplicableShippingLabels("Perishable")
.setSingleValue(Value.newBuilder().setPricePercentage("5.4"))
.setName("Oversized and Perishable items")
.build())
.setShipmentType(ShipmentType.DELIVERY)
.setMinimumOrderValue(
Price.newBuilder()
.setAmountMicros(10000000)
.setCurrencyCode("CAD")
.build())
.build())
.build())
.build();
System.out.println("Sending insert ShippingSettings request");
ShippingSettings response = shippingSettingsServiceClient.insertShippingSettings(request);
System.out.println("Inserted ShippingSettings Name below");
System.out.println(response.getName());
// You can apply ShippingSettings to specific products by using the `shippingLabel` field
// on the product.
} catch (Exception e) {
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
insertShippingSettings(config);
}
}
PHP
use Google\ApiCore\ApiException;
use Google\Shopping\Merchant\Accounts\V1\Client\ShippingSettingsServiceClient;
use Google\Shopping\Merchant\Accounts\V1\DeliveryTime;
use Google\Shopping\Merchant\Accounts\V1\InsertShippingSettingsRequest;
use Google\Shopping\Merchant\Accounts\V1\RateGroup;
use Google\Shopping\Merchant\Accounts\V1\Service;
use Google\Shopping\Merchant\Accounts\V1\Service\ShipmentType;
use Google\Shopping\Merchant\Accounts\V1\ShippingSettings;
use Google\Shopping\Merchant\Accounts\V1\Value;
use Google\Shopping\Type\Price;
/**
* This class demonstrates how to insert a ShippingSettings for a Merchant Center account.
*/
class InsertShippingSettings
{
/**
* A helper function to create the parent string.
*
* @param string $accountId The account ID.
* @return string The parent in the format "accounts/{accountId}".
*/
private static function getParent(string $accountId): string
{
return sprintf("accounts/%s", $accountId);
}
/**
* Inserts shipping settings for the specified Merchant Center account.
*
* @param array $config The configuration data containing the account ID.
* @return void
*/
public static function insertShippingSettings($config)
{
// Gets the OAuth credentials to make the request.
$credentials = Authentication::useServiceAccountOrTokenFile();
// Creates options config containing credentials for the client to use.
$options = ['credentials' => $credentials];
// Creates a client.
$shippingSettingsServiceClient = new ShippingSettingsServiceClient($options);
// Creates parent to identify where to insert the shippingsettings.
$parent = self::getParent($config['accountId']);
// Calls the API and catches and prints any network failures/errors.
try {
$request = (new InsertShippingSettingsRequest())
->setParent($parent)
->setShippingSetting(
(new ShippingSettings())
// Etag needs to be an empty string on initial insert
// On future inserts, call GET first to get the Etag
// Then use the retrieved Etag on future inserts.
// NOTE THAT ON THE INITIAL INSERT, YOUR SHIPPING SETTINGS WILL
// NOT BE STORED, YOU HAVE TO CALL INSERT AGAIN WITH YOUR
// RETRIEVED ETAG.
->setEtag("")
->setServices([
(new Service())
->setServiceName("Canadian Postal Service")
->setActive(true)
->setDeliveryCountries(["CA"])
->setCurrencyCode("CAD")
->setDeliveryTime(
(new DeliveryTime())
->setMinTransitDays(0)
->setMaxTransitDays(3)
->setMinHandlingDays(0)
->setMaxHandlingDays(3)
)
->setRateGroups(
[(new RateGroup())
->setApplicableShippingLabels(["Oversized","Perishable"])
->setSingleValue((new Value())->setPricePercentage("5.4"))
->setName("Oversized and Perishable items")]
)
->setShipmentType(ShipmentType::DELIVERY)
->setMinimumOrderValue(
(new Price())
->setAmountMicros(10000000)
->setCurrencyCode("CAD")
)
])
);
print "Sending insert ShippingSettings request" . PHP_EOL;
$response = $shippingSettingsServiceClient->insertShippingSettings($request);
print "Inserted ShippingSettings below" . PHP_EOL;
print_r($response);
// You can apply ShippingSettings to specific products by using the `shippingLabel` field
// on the product.
} catch (ApiException $e) {
print $e->getMessage();
}
}
/**
* Helper to execute the sample.
*
* @return void
*/
public function callSample(): void
{
$config = Config::generateConfig();
// Makes the call to insert shipping settings for the MC account.
self::insertShippingSettings($config);
}
}
// Run the script
$sample = new InsertShippingSettings();
$sample->callSample();
Python
from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1 import DeliveryTime
from google.shopping.merchant_accounts_v1 import InsertShippingSettingsRequest
from google.shopping.merchant_accounts_v1 import RateGroup
from google.shopping.merchant_accounts_v1 import Service
from google.shopping.merchant_accounts_v1 import ShippingSettings
from google.shopping.merchant_accounts_v1 import ShippingSettingsServiceClient
from google.shopping.merchant_accounts_v1 import Value
_ACCOUNT = configuration.Configuration().read_merchant_info()
_PARENT = f"accounts/{_ACCOUNT}"
def insert_shipping_settings():
"""Inserts a ShippingSettings for a Merchant Center account."""
# Gets OAuth Credentials.
credentials = generate_user_credentials.main()
# Creates a client.
client = ShippingSettingsServiceClient(credentials=credentials)
# Creates the request.
request = InsertShippingSettingsRequest(
parent=_PARENT,
shipping_setting=ShippingSettings(
# Etag needs to be an empty string on initial insert
# On future inserts, call GET first to get the Etag
# Then use the retrieved Etag on future inserts.
# NOTE THAT ON THE INITIAL INSERT, YOUR SHIPPING SETTINGS WILL
# NOT BE STORED, YOU HAVE TO CALL INSERT AGAIN WITH YOUR
# RETRIEVED ETAG.
etag="",
services=[
Service(
service_name="Canadian Postal Service",
active=True,
delivery_countries=["CA"],
currency_code="CAD",
delivery_time=DeliveryTime(
min_transit_days=0,
max_transit_days=3,
min_handling_days=0,
max_handling_days=3,
),
rate_groups=[
RateGroup(
applicable_shipping_labels=[
"Oversized",
"Perishable",
],
single_value=Value(price_percentage="5.4"),
name="Oversized and Perishable items",
)
],
shipment_type=Service.ShipmentType.DELIVERY,
minimum_order_value={
"amount_micros": 10000000,
"currency_code": "CAD",
},
)
],
),
)
# Makes the request and prints the inserted ShippingSettings name.
try:
response = client.insert_shipping_settings(request=request)
print("Inserted ShippingSettings below")
print(response)
# You can apply ShippingSettings to specific products by using the
# `shippingLabel` field on the product.
except RuntimeError as e:
print(e)
if __name__ == "__main__":
insert_shipping_settings()
检索配送设置
以下请求展示了如何检索 Merchant Center 账号的配送设置:
HTTP
GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/shippingSettings
cURL
curl \
'https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/shippingSettings' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
以下示例展示了如何使用客户端库检索指定账号的配送设置信息:
Java
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1.GetShippingSettingsRequest;
import com.google.shopping.merchant.accounts.v1.ShippingSettings;
import com.google.shopping.merchant.accounts.v1.ShippingSettingsName;
import com.google.shopping.merchant.accounts.v1.ShippingSettingsServiceClient;
import com.google.shopping.merchant.accounts.v1.ShippingSettingsServiceSettings;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;
/** This class demonstrates how to get the ShippingSettings for a given Merchant Center account. */
public class GetShippingSettingsSample {
public static void getShippingSettings(Config config) throws Exception {
// Obtains OAuth token based on the user's configuration.
GoogleCredentials credential = new Authenticator().authenticate();
// Creates service settings using the credentials retrieved above.
ShippingSettingsServiceSettings shippingSettingsServiceSettings =
ShippingSettingsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credential))
.build();
// Creates ShippingSettings name to identify ShippingSettings.
String name =
ShippingSettingsName.newBuilder()
.setAccount(config.getAccountId().toString())
.build()
.toString();
// Calls the API and catches and prints any network failures/errors.
try (ShippingSettingsServiceClient shippingSettingsServiceClient =
ShippingSettingsServiceClient.create(shippingSettingsServiceSettings)) {
// The name has the format: accounts/{account}/shippingSettings
GetShippingSettingsRequest request =
GetShippingSettingsRequest.newBuilder().setName(name).build();
System.out.println("Sending Get ShippingSettings request:");
ShippingSettings response = shippingSettingsServiceClient.getShippingSettings(request);
System.out.println("Retrieved ShippingSettings below");
System.out.println(response);
} catch (Exception e) {
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
getShippingSettings(config);
}
}
PHP
use Google\ApiCore\ApiException;
use Google\Shopping\Merchant\Accounts\V1\Client\ShippingSettingsServiceClient;
use Google\Shopping\Merchant\Accounts\V1\GetShippingSettingsRequest;
/**
* This class demonstrates how to get the ShippingSettings for a given Merchant Center account.
*/
class GetShippingSettings
{
/**
* Retrieves the shipping settings for the specified Merchant Center account.
*
* @param array $config The configuration data containing the account ID.
* @return void
*/
public static function getShippingSettings($config)
{
// Gets the OAuth credentials to make the request.
$credentials = Authentication::useServiceAccountOrTokenFile();
// Creates options config containing credentials for the client to use.
$options = ['credentials' => $credentials];
// Creates a client.
$shippingSettingsServiceClient = new ShippingSettingsServiceClient($options);
// Creates ShippingSettings name to identify ShippingSettings.
// The name has the format: accounts/{account}/shippingSettings
$name = "accounts/" . $config['accountId'] . "/shippingSettings";
// Calls the API and catches and prints any network failures/errors.
try {
$request = (new GetShippingSettingsRequest())
->setName($name);
print "Sending Get ShippingSettings request:" . PHP_EOL;
$response = $shippingSettingsServiceClient->getShippingSettings($request);
print "Retrieved ShippingSettings below" . PHP_EOL;
print_r($response);
} catch (ApiException $e) {
print $e->getMessage();
}
}
/**
* Helper to execute the sample.
*
* @return void
*/
public function callSample(): void
{
$config = Config::generateConfig();
// Makes the call to get shipping settings for the MC account.
self::getShippingSettings($config);
}
}
// Run the script
$sample = new GetShippingSettings();
$sample->callSample();
Python
from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1 import GetShippingSettingsRequest
from google.shopping.merchant_accounts_v1 import ShippingSettingsServiceClient
_ACCOUNT = configuration.Configuration().read_merchant_info()
_PARENT = f"accounts/{_ACCOUNT}"
def get_shipping_settings():
"""Gets the ShippingSettings for a given Merchant Center account."""
# Gets OAuth Credentials.
credentials = generate_user_credentials.main()
# Creates a client.
client = ShippingSettingsServiceClient(credentials=credentials)
# Creates the Shipping Settings name
name = _PARENT + "/shippingSettings"
# Creates the request.
request = GetShippingSettingsRequest(name=name)
# Makes the request and prints the retrieved ShippingSettings.
try:
response = client.get_shipping_settings(request=request)
print("Retrieved ShippingSettings below")
print(response)
except RuntimeError as e:
print(e)
if __name__ == "__main__":
get_shipping_settings()
添加仓库设置
如需添加或更新用于存储和处理您账号的商品目录的仓库设置,请使用 accounts.shippingSettings.insert
方法。
以下是使用 Merchant API 管理仓库的方法:
如需检索所有现有的
shippingsettings
和warehouses
,请使用accounts.shippingSettings.getShippingSettings
方法发出GET
请求。使用
account.shippingSettings.insert
方法创建请求。将GET
请求的响应中的shippingsettings
资源复制到插入请求中。如需使用 insert 调用添加有关仓库的信息,请在请求正文的
warehouses
资源中填充有关仓库的详细信息。运行插入请求。
以下示例请求展示了如何使用 accounts.shippingSettings.insert
方法更新账号的仓库设置。该请求会设置可接受订单并开始处理订单的时间、处理天数和送货地址。
POST https://merchantapi.googleapis.com/accounts/v1/accounts/ACCOUNT_ID/shippingSettings:insert
{
"etag": "",
"name": "accounts/ACCOUNT_ID/shippingSetting",
"warehouses": [
{
"cutoffTime": {
"hour": 7,
"minute": 50
},
"handlingDays": 7,
"name": "WAREHOUSE_NAME",
"shippingAddress": {
"streetAddress": "ADDRESS",
"administrativeArea": "CA",
"city": "CITY_NAME",
"postalCode": "POSTAL_CODE",
"regionCode": "REGION_CODE"
}
}
]
}
替换以下内容:
- ACCOUNT_ID:您的 Merchant Center 账号的唯一标识符。
- WAREHOUSE_NAME:数据仓库的名称。
- ADDRESS:仓库的送货地址。
- CITY_NAME:城市、城镇或公社。还可以包括附属地区或次级地区。例如,社区或郊区。
- POSTAL_CODE:邮政编码。例如 94043。
- REGION_CODE:CLDR 国家/地区代码。 例如,“US”。
以下是成功调用的示例响应:
{
"name": "accounts/ACCOUNT_ID/shippingSettings",
"warehouses": [
{
"name": "WAREHOUSE_NAME",
"shippingAddress": {
"streetAddress": "ADDRESS",
"city": "CITY_NAME",
"administrativeArea": "CA",
"postalCode": "POSTAL_CODE",
"regionCode": "REGION_CODE"
},
"cutoffTime": {
"hour": 7,
"minute": 50
},
"handlingDays": "7",
"businessDayConfig": {
"businessDays": [
"MONDAY",
"TUESDAY",
"WEDNESDAY",
"THURSDAY",
"FRIDAY"
]
}
}
],
"etag": "OAJiUAjB0au+FBABGgR0ZXN0Ii4KAlVTGgJDQSoKQ2FsaWZvcm5pYWIFOTQwNDNyETExMXcgMzFzdCBTdHJlZXQuKgQIBxAyMAc4ATgCOAM4BDgF"
}
设置邮政编码组
使用 Accounts 子 API 管理 Merchant Center 账号的地区(称为 postalCodeGroups)。
postalCodeGroups 资源是一个分组列表,其中每个分组都是一个邮政编码列表,这些邮政编码具有相同的配送设置。
您可以使用 Merchant API 管理 postalCodeGroups,具体如下所示:
发出 get 调用,以检索所有 shippingsettings 和 postalCodeGroups。
将 get 调用中的 shippingsettings 复制到 update 调用中。
如果您在配送服务中未使用运输时间标签,请从请求正文中移除以下条目。
"transitTimeLabels": [ "all other labels" ],
在 update 调用的 postalCodeGroups 部分中填充您要使用的区域。
使用 shippingsettings 和 postalCodeGroups 资源进行 update 调用。
添加当天送达服务
如果您有本地商品目录,则可以使用 Merchant API 配置当天送达配送服务。请参阅向本地商品添加实体店信息 (addlocalinventory)。
当天送达配送服务的 shipmentType 为 local_delivery。
请注意以下事项:
- 所有 local_delivery 配送服务均视为当天送达。
- 您无法更改本地配送的 deliveryTime 信息。
如需为本地商品目录中的商品设置当天送达服务,请使用 accounts.shippingSettings.insert
方法。
以下是一个示例请求,用于设置配送类型、storeConfig
(商品配送来源商店的列表)和费率组。
POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/shippingSettings:insert
{
"etag": "",
"name": "accounts/ACCOUNT_ID/shippingSetting",
"services": [
{
"deliveryCountries": [
"COUNTRY_CODE"
],
"serviceName": "SERVICE_NAME",
"active": false,
"currencyCode": "CURRENCY_CODE",
"shipmentType": "SHIPMENT_TYPE",
"storeConfig": {
"cutoffConfig": {
"localCutoffTime": {
"hour": 7,
"minute": 40
}
},
"serviceRadius": {
"unit": "KILOMETERS",
"value": 40
},
"storeCodes": [],
"storeServiceType": "ALL_STORES"
},
"rateGroups": [
{
"applicableShippingLabels": [
"SHIPPING_LABEL"
],
"singleValue": {
"flatRate": {
"amountMicros": PRICE,
"currencyCode": "CURRENCY_CODE"
}
}
}
]
}
]
}
替换以下内容:
- SHIPMENT_TYPE:此服务配送订单的地点类型,包括:
SHIPMENT_TYPE_UNSPECIFIED
DELIVERY
LOCAL_DELIVERY
COLLECTION_POINT
- SHIPPING_LABEL:一个配送标签列表,用于定义此费率组所适用的产品。
以下是成功调用的示例响应:
{
"name": "accounts/ACCOUNT_ID/shippingSettings",
"services": [
{
"serviceName": "SERVICE_NAME",
"active": false,
"deliveryCountries": [
"COUNTRY_CODE"
],
"currencyCode": "CURRENCY_CODE",
"rateGroups": [
{
"applicableShippingLabels": [
"SHIPPING_LABEL"
],
"singleValue": {
"flatRate": {
"amountMicros": "PRICE",
"currencyCode": "CURRENCY_CODE"
}
}
}
],
"shipmentType": "SHIPMENT_TYPE",
"storeConfig": {
"storeServiceType": "ALL_STORES",
"cutoffConfig": {
"localCutoffTime": {
"hour": "7",
"minute": "40"
},
"noDeliveryPostCutoff": false
},
"serviceRadius": {
"value": "40",
"unit": "KILOMETERS"
}
}
}
],
"etag": "OAJCTQgBEAAaRwoEdGVzdBIEIgJVUxoDVVNEIggiBggHECgoACoeCAESDwoNCAESCU9WRVJTSVpFRBoJIgcIAhCAwtcvWAWSAQCaAQQIAhAo"
}
添加次日送达服务
默认情况下,在当天送达截止时间之后下单的订单会安排在次日送达。
如需关闭次日送达,请将 no_delivery_post_cutoff 设置为 true。
如果您关闭次日送达功能,您的配送服务将仅在每天的截止时间之前显示。
只有当 shipmentType 为 local_delivery 时,才能使用次日送达服务。
添加退货政策
如果您通过购物广告或自然搜索商品详情展示商品,可以使用 returnpolicyonline 创建、查看、修改或删除在线退货政策,并使用以下属性:
- 目标国家/地区,请参阅为购物广告和非付费商品详情设置退货政策。
- 重新上架费
- 退货方式
- 退回商品状况
- 退货原因类别
- 退货政策网址,请参阅为购物广告和非付费商品详情设置退货政策。
通过购物广告或自然商品详情销售的商品无需提供退货地址。
如需了解详情,请参阅为购物广告和自然商品详情设置退货政策。
您可以使用 returnpolicyonline.create 添加退货政策。响应中包含更新后的政策。
POST https://merchantapi.googleapis.com/v1/{ACCOUNT_ID}/returnpolicyonline