Theaccounts.shippingSettingsresource 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.
Google can update the estimated delivery time for some products automatically.
ACCOUNT_ID: The unique identifier of your Merchant Center
account.
COUNTRY_CODE: The CLDR (Common Locale Data Repository)
code of the country to which this service applies. Must match that of the
prices in rate groups.
SERVICE_NAME: Name of the service.
CARRIER_NAME: The name of the carrier. For example, UPS
and Fedex.
The request body should contain the full resource body of theaccounts.shippingSettingsresource, even if you are just updating a single
attribute, as anyNULLor missing values in the request body results in
nulling out the existing values.
Here's a sample you can use to update the shipping settings for a given account
using theclient libraries:
Java
importcom.google.api.gax.core.FixedCredentialsProvider;importcom.google.auth.oauth2.GoogleCredentials;importcom.google.shopping.merchant.accounts.v1.DeliveryTime;importcom.google.shopping.merchant.accounts.v1.InsertShippingSettingsRequest;importcom.google.shopping.merchant.accounts.v1.RateGroup;importcom.google.shopping.merchant.accounts.v1.Service;importcom.google.shopping.merchant.accounts.v1.Service.ShipmentType;importcom.google.shopping.merchant.accounts.v1.ShippingSettings;importcom.google.shopping.merchant.accounts.v1.ShippingSettingsServiceClient;importcom.google.shopping.merchant.accounts.v1.ShippingSettingsServiceSettings;importcom.google.shopping.merchant.accounts.v1.Value;importcom.google.shopping.type.Price;importshopping.merchant.samples.utils.Authenticator;importshopping.merchant.samples.utils.Config;/** This class demonstrates how to insert a ShippingSettings for a Merchant Center account. */publicclassInsertShippingSettingsSample{privatestaticStringgetParent(StringaccountId){returnString.format("accounts/%s",accountId);}publicstaticvoidinsertShippingSettings(Configconfig)throwsException{// Obtains OAuth token based on the user's configuration.GoogleCredentialscredential=newAuthenticator().authenticate();// Creates service settings using the credentials retrieved above.ShippingSettingsServiceSettingsshippingSettingsServiceSettings=ShippingSettingsServiceSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create(credential)).build();// Creates parent to identify where to insert the shippingsettings.Stringparent=getParent(config.getAccountId().toString());// Calls the API and catches and prints any network failures/errors.try(ShippingSettingsServiceClientshippingSettingsServiceClient=ShippingSettingsServiceClient.create(shippingSettingsServiceSettings)){InsertShippingSettingsRequestrequest=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");ShippingSettingsresponse=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(Exceptione){System.out.println(e);}}publicstaticvoidmain(String[]args)throwsException{Configconfig=Config.load();insertShippingSettings(config);}}
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();
fromexamples.authenticationimportconfigurationfromexamples.authenticationimportgenerate_user_credentialsfromgoogle.shopping.merchant_accounts_v1importDeliveryTimefromgoogle.shopping.merchant_accounts_v1importInsertShippingSettingsRequestfromgoogle.shopping.merchant_accounts_v1importRateGroupfromgoogle.shopping.merchant_accounts_v1importServicefromgoogle.shopping.merchant_accounts_v1importShippingSettingsfromgoogle.shopping.merchant_accounts_v1importShippingSettingsServiceClientfromgoogle.shopping.merchant_accounts_v1importValue_ACCOUNT=configuration.Configuration().read_merchant_info()_PARENT=f"accounts/{_ACCOUNT}"definsert_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.exceptRuntimeErrorase:print(e)if__name__=="__main__":insert_shipping_settings()
Here's a sample you can use to retrieve the shipping settings information for a
given account using theclient libraries:
Java
importcom.google.api.gax.core.FixedCredentialsProvider;importcom.google.auth.oauth2.GoogleCredentials;importcom.google.shopping.merchant.accounts.v1.GetShippingSettingsRequest;importcom.google.shopping.merchant.accounts.v1.ShippingSettings;importcom.google.shopping.merchant.accounts.v1.ShippingSettingsName;importcom.google.shopping.merchant.accounts.v1.ShippingSettingsServiceClient;importcom.google.shopping.merchant.accounts.v1.ShippingSettingsServiceSettings;importshopping.merchant.samples.utils.Authenticator;importshopping.merchant.samples.utils.Config;/** This class demonstrates how to get the ShippingSettings for a given Merchant Center account. */publicclassGetShippingSettingsSample{publicstaticvoidgetShippingSettings(Configconfig)throwsException{// Obtains OAuth token based on the user's configuration.GoogleCredentialscredential=newAuthenticator().authenticate();// Creates service settings using the credentials retrieved above.ShippingSettingsServiceSettingsshippingSettingsServiceSettings=ShippingSettingsServiceSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create(credential)).build();// Creates ShippingSettings name to identify ShippingSettings.Stringname=ShippingSettingsName.newBuilder().setAccount(config.getAccountId().toString()).build().toString();// Calls the API and catches and prints any network failures/errors.try(ShippingSettingsServiceClientshippingSettingsServiceClient=ShippingSettingsServiceClient.create(shippingSettingsServiceSettings)){// The name has the format: accounts/{account}/shippingSettingsGetShippingSettingsRequestrequest=GetShippingSettingsRequest.newBuilder().setName(name).build();System.out.println("Sending Get ShippingSettings request:");ShippingSettingsresponse=shippingSettingsServiceClient.getShippingSettings(request);System.out.println("Retrieved ShippingSettings below");System.out.println(response);}catch(Exceptione){System.out.println(e);}}publicstaticvoidmain(String[]args)throwsException{Configconfig=Config.load();getShippingSettings(config);}}
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();
fromexamples.authenticationimportconfigurationfromexamples.authenticationimportgenerate_user_credentialsfromgoogle.shopping.merchant_accounts_v1importGetShippingSettingsRequestfromgoogle.shopping.merchant_accounts_v1importShippingSettingsServiceClient_ACCOUNT=configuration.Configuration().read_merchant_info()_PARENT=f"accounts/{_ACCOUNT}"defget_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 namename=_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)exceptRuntimeErrorase:print(e)if__name__=="__main__":get_shipping_settings()
Create a request using theaccount.shippingSettings.insertmethod. Copy theshippingsettingsresource from the response of theGETrequest to the insert request.
To add information about warehouses using the insert call, populate details
about it in thewarehousesresource in the request body.
Run the insert request.
The following sample request shows how to use theaccounts.shippingSettings.insertmethod 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.
Use the Accounts sub-API to manage regions, calledpostalCodeGroups, for a
Merchant Center account.
ThepostalCodeGroupsresource 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 yourpostalCodeGroupsas follows:
Make agetcall to retrieve all yourshippingsettingsandpostalCodeGroups.
Copy theshippingsettingsfrom thegetcall to theupdatecall.
If you don't use transit time labels in your shipping service, remove the
following entry from the request body.
"transitTimeLabels": ["all other labels"],
Populate the regions you want to use in thepostalCodeGroupssection for
theupdatecall.
Make anupdatecall with theshippingsettingsandpostalCodeGroupsresources.
Add same-day delivery
You can use Merchant API to configure same-day delivery shipping services if you
have local inventory. SeeAdd in-store information to local
products(addlocalinventory).
Orders placed after your same-day delivery cutoff time are scheduled for
next-day delivery by default.
To turn off next-day delivery, setno_delivery_post_cutofftotrue.
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 theshipmentTypeislocal_delivery.
Add a return policy
If you list products through Shopping Ads or organic listings, you can usereturnpolicyonlineto create, view, edit, or delete online return policies
with the following attributes:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eUse the Merchant Accounts API to manage shipping settings for all products under your account, including sub-accounts.\u003c/p\u003e\n"],["\u003cp\u003eManage shipping regions by defining postal code groups with specific settings.\u003c/p\u003e\n"],["\u003cp\u003eConfigure same-day and next-day delivery options for products with local inventory.\u003c/p\u003e\n"],["\u003cp\u003eAdd and manage online return policies for products sold through Shopping Ads or organic listings.\u003c/p\u003e\n"],["\u003cp\u003eGoogle can automatically update estimated delivery times for certain products.\u003c/p\u003e\n"]]],["The Merchant Accounts API manages shipping settings for all products under an account, including sub-accounts. Use `accounts.shippingSettings.insert` to add or update these settings, applying changes to all products unless using the Merchant Products API for individual updates. Manage regions via `postalCodeGroups` by retrieving, copying, and updating `shippingSettings` and `postalCodeGroups`. Configure same-day delivery for local inventory and set next-day delivery options. Also, you can add return policies using `returnpolicyonline.create`.\n"],null,[]]