Use the Accounts sub-API to manage the shipping settings for all the
products under your account and all associated sub-accounts.

Changes you make to the
[shipping settings](https://support.google.com/merchants/answer/12570809)
will apply to all products. To update the shipping for individual products, use
the Merchant Products API.

For more information, see
[Set up shipping settings](https://support.google.com/merchants/answer/6069284).

## Overview of shipping settings

The
[`accounts.shippingSettings`](https://developers.google.com/merchant/api/reference/rest/accounts_v1/accounts.shippingSettings)
resource lets you retrieve and update the shipping settings of your advanced
account and all associated sub-accounts.

Advanced accounts are usually used by integrators, aggregators, and channel
partners who manage online stores and API services for multiple businesses.
Businesses that have multiple online stores or brands that are sold on separate
websites can also choose to have sub-accounts under a single advanced account.

> [!NOTE]
> **Note:** The `accounts.shippingSettings` resource cannot be used with shipping settings created through account-linking or by manual upload of order tracking history. Those shipping settings are not returned, modified, or deleted by calls to this endpoint. For more information, see [About letting Google calculate your shipping speeds](https://support.google.com/merchants/answer/10165931).

Google can update the estimated delivery time for some products automatically.

### Add shipping settings

To add or update the shipping settings for your account, use the
[`accounts.shippingSettings.insert`](https://developers.google.com/merchant/api/reference/rest/accounts_v1/accounts.shippingSettings/insert)
method.

The following sample request sets the shipping price, loyalty programs that this
shipping service is limited to, and the currency code.

### 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

Replace the following:

- <var translate="no">{ACCOUNT_ID}</var>: The unique identifier of your Merchant Center account.
- <var translate="no">{COUNTRY_CODE}</var>: The CLDR (Common Locale Data Repository) code of the country to which this service applies. Must match that of the prices in rate groups.
- <var translate="no">{SERVICE_NAME}</var>: Name of the service.
- <var translate="no">{PROGRAM_LABEL}</var>: Loyalty program label set in your loyalty program settings in Merchant Center.
- <var translate="no">{SHIPPING_LABEL}</var>: A list of shipping labels defining the products to which this rate group applies.
- <var translate="no">{PRICE}</var>: The price represented as a number in micros. For example, 1 USD = 1000000 micros.
- <var translate="no">{CURRENCY_CODE}</var>: The currency of the price using three-letter acronyms.

For more information on specified fields, see [reference
documentation](https://developers.google.com/merchant/api/reference/rest/accounts_v1/accounts.shippingSettings#service).

The request body should contain the full resource body of the
`accounts.shippingSettings` resource, even if you are just updating a single
attribute, as any **NULL** or missing values in the request body results in
nulling out the existing values.

Here's a sample response from a successful call:

    {
      "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"
    }

Here's a sample you can use to update the shipping settings for a given
account using the [client libraries](https://developers.google.com/merchant/api/client-libraries):

### 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()

### Retrieve shipping settings

The following requests show how you can retrieve the shipping settings of a
Merchant Center account:

### 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

Here's a sample you can use to retrieve the shipping settings information
for a given account using the
[client libraries](https://developers.google.com/merchant/api/client-libraries):

### 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()

### Add warehouse settings

To add or update the warehouse settings that store and handle inventory for your
account, use the
[`accounts.shippingSettings.insert`](https://developers.google.com/merchant/api/reference/rest/accounts_v1/accounts.shippingSettings/insert)
method.

Here's how to use Merchant API to manage your warehouses:

1. To retrieve all your existing `shippingsettings` and `warehouses`, make a
   `GET` request using the
   [`accounts.shippingSettings.getShippingSettings`](https://developers.google.com/merchant/api/reference/rest/accounts_v1/accounts.shippingSettings/getShippingSettings)
   method.

2. Create a request using the [`account.shippingSettings.insert`](https://developers.google.com/merchant/api/reference/rest/accounts_v1/accounts.shippingSettings/insert)
   method. Copy the `shippingsettings` resource from the response of the `GET`
   request to the insert request.

   > [!NOTE]
   > **Note:** If you don't copy all the existing fields returned in the response obtained from the GET request, those field values are deleted from your account in the `accounts.shippingSettings.insert` request.

3. To add information about warehouses using the insert call, populate details
   about it in the `warehouses` resource in the request body.

4. Run the insert request.

The following sample request shows how to use the
`accounts.shippingSettings.insert` method to update warehouse setting for your
account. The request sets the time of day that an order can be accepted and
begin processing, handling days, and the shipping address.

    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}"
          }
        }
      ]
    }

Replace the following:

- <var translate="no">{ACCOUNT_ID}</var>: The unique identifier of your Merchant Center account.
- <var translate="no">{WAREHOUSE_NAME}</var>: The name of the warehouse.
- <var translate="no">{ADDRESS}</var>: The shipping address of the warehouse.
- <var translate="no">{CITY_NAME}</var>: City, town, or commune. It can also include dependent localities or sub localities. For example, neighborhoods or suburbs.
- <var translate="no">{POSTAL_CODE}</var>: Postal code or ZIP. For example, 94043.
- <var translate="no">{REGION_CODE}</var>: The [CLDR country
  code](https://github.com/unicode-org/cldr/blob/latest/common/main/en.xml). For example, "US".

Here's a sample response from a successful call:

    {
      "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"
    }

### Set postal code groups

Use the Accounts sub-API to manage regions, called **postalCodeGroups**, for
a Merchant Center account.

The **postalCodeGroups** resource is a list of groupings, where each grouping is
a list of multiple postal codes that share the same shipping settings.

Use the Merchant API to manage your **postalCodeGroups** as follows:

1. Make a **get** call to retrieve all your **shippingsettings** and
   **postalCodeGroups**.

2. Copy the **shippingsettings** from the **get** call to the **update** call.

   > [!NOTE]
   > **Note:** If you fail to copy all the **shippingsettings** , the **update** call deletes them from your account.

3. If you don't use transit time labels in your shipping service, remove the
   following entry from the request body.

           "transitTimeLabels": [
           "all other labels"
       ],

4. Populate the regions you want to use in the **postalCodeGroups** section for
   the **update** call.

5. Make an **update** call with the **shippingsettings** and
   **postalCodeGroups** resources.

### Add same-day delivery

You can use Merchant API to configure same-day delivery shipping services if you
have local inventory. See [Add in-store information to local
products](https://developers.google.com/merchant/api/guides/inventories/add-local-inventory)
(**addlocalinventory**).

Same-day delivery shipping services have **local_delivery** as their
**shipmentType**.

The following caveats apply:

- All **local_delivery** shipping services are considered same-day deliveries.
- You cannot change the **deliveryTime** information for local deliveries.

To set up same-day delivery for your local inventory products, use the
`accounts.shippingSettings.insert` method.

Here's a sample request that sets the shipment type, `storeConfig` (a list of
stores your products are delivered from), and rate groups.

    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}"
                }
              }
            }
          ]
        }
      ]
    }

Replace the following:

- <var translate="no">{SHIPMENT_TYPE}</var>: Type of locations this service ships orders to which includes:
  - `SHIPMENT_TYPE_UNSPECIFIED`
  - `DELIVERY`
  - `LOCAL_DELIVERY`
  - `COLLECTION_POINT`
- <var translate="no">{SHIPPING_LABEL}</var>: A list of shipping labels defining the products to which this rate group applies.

Here's a sample response from a successful call:

    {
      "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"
    }

### Add next-day delivery

Orders placed after your same-day delivery cutoff time are scheduled for
next-day delivery by default.

To turn off next-day delivery, set
**no_delivery_post_cutoff** to **true**.

If you turn off next-day delivery, your shipping services are only visible
before the cutoff time each day.

Next-day delivery is available only when the **shipmentType** is
**local_delivery**.

## Add a return policy

If you list products through Shopping Ads or organic listings, you can use
**returnpolicyonline** to create, view, edit, or delete online return policies
with the following attributes:

- Target countries, see [Set up your return policies for Shopping Ads and free listings](https://support.google.com/merchants/answer/10220642#zippy=%2Cstep-select-the-countries-this-return-policy-applies-to).
- Restocking fees
- Return methods
- Return item condition
- Return reason category
- Return policy URLs, see [Set up your return policies for Shopping Ads and free listings](https://support.google.com/merchants/answer/10220642#zippy=%2Cstep-select-the-countries-this-return-policy-applies-to%2Cstep-return-policy-url).

Products sold through Shopping Ads or organic listings don't require a
return address.

For more details, see
[Set up your return policies for Shopping Ads and organic listings](https://support.google.com/merchants/answer/10220642).

You can use **returnpolicyonline.create** to add a return policy. The response
includes the updated policy.

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