Accounts サブ API を使用すると、アカウントのすべての商品と、関連付けられたすべてのサブアカウントの配送設定を管理できます。
配送設定を変更すると、すべての商品に適用されます。個々の商品の配送を更新するには、Merchant Products API を使用します。
詳しくは、 配送設定を設定するをご覧ください。
配送設定の概要
accounts.shippingSettings
リソースを使用すると、アドバンス
アカウントと関連付けられたすべてのサブアカウントの配送設定を取得して更新できます。
アドバンス アカウントは通常、複数の企業のオンライン ストアと API サービスを管理するインテグレータ、アグリゲータ、チャネル パートナーによって使用されます。 複数のオンライン ストアや、別々のウェブサイトで販売されるブランドを持つ企業も、1 つのアドバンス アカウントの下にサブアカウントを作成できます。
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 {ACCESS_TOKEN}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"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"}}}]}]}' \
--compressed
次のように置き換えます。
- {ACCOUNT_ID}: Merchant Center アカウントの一意の識別子 。
- {COUNTRY_CODE}: このサービスが適用される国の CLDR(Common Locale Data Repository) コード。料金グループの料金と一致している必要があります。
- {SERVICE_NAME}: サービスの名前。
- {PROGRAM_LABEL}: Merchant Center のポイント プログラム設定で設定する ポイント プログラム ラベル。
- {SHIPPING_LABEL}: この料金グループが適用される 商品を定義する配送ラベルのリスト。
- {PRICE}: マイクロ単位の数値で表される価格。例: 1 米ドル = 1,000,000 マイクロ。
- {CURRENCY_CODE}: 3 文字の略語を使用した価格の通貨。
指定されたフィールドについて詳しくは、リファレンス ドキュメントをご覧ください。
リクエスト本文には、1 つの属性のみを更新する場合でも、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 {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をすべて取得するには、GETリクエストをaccounts.shippingSettings.getShippingSettingsメソッドを使用して行います。account.shippingSettings.insertメソッドを使用してリクエストを作成します。GETリクエストのレスポンスからshippingsettingsリソースをコピーして、挿入リクエストに貼り付けます。挿入呼び出しを使用して倉庫に関する情報を追加するには、リクエスト本文の
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_UNSPECIFIEDDELIVERYLOCAL_DELIVERYCOLLECTION_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 を使用して、次の属性でオンライン返品に関するポリシーを作成、表示、編集、削除できます。
- 対象国。詳しくは、 ショッピング広告と無料リスティングに掲載する返品に関するポリシーの設定をご覧ください。
- 返品手数料
- 返品方法
- 返品商品の状態
- 返品理由のカテゴリ
- 返品に関するポリシーの URL。詳しくは、 ショッピング広告と無料リスティングに掲載する返品に関するポリシーの設定をご覧ください。
ショッピング広告または無料リスティングで販売される商品には、返品先住所は必要ありません。
詳しくは、 ショッピング広告と無料リスティングに掲載する返品に関するポリシーの設定をご覧ください。
returnpolicyonline.create を使用して、返品に関するポリシーを追加できます。レスポンスには、更新されたポリシーが含まれます。
POST https://merchantapi.googleapis.com/v1/{ACCOUNT_ID}/returnpolicyonline