Usa la sub-API de Accounts para administrar la configuración de envío de todos los productos de tu cuenta y de todas las cuentas secundarias asociadas.
Los cambios que realices en la configuración de envío se aplicarán a todos los productos. Para actualizar el envío de productos individuales, usa la API de Merchant Products.
Para obtener más información, consulta Cómo configurar las opciones de envío.
Descripción general de la configuración de envío
El recurso
accounts.shippingSettings
te permite recuperar y actualizar la configuración de envío de tu cuenta avanzada
y de todas las cuentas secundarias asociadas.
Las cuentas avanzadas suelen ser utilizadas por integradores, agregadores y socios de canal que administran tiendas en línea y servicios de API para varias empresas. Las empresas que tienen varias tiendas o marcas en línea que se venden en sitios web independientes también pueden optar por tener cuentas secundarias en una sola cuenta avanzada.
Google puede actualizar automáticamente el tiempo de entrega estimado de algunos productos.
Cómo agregar la configuración de envío
Para agregar o actualizar la configuración de envío de tu cuenta, usa el
accounts.shippingSettings.insert
método.
En la siguiente solicitud de ejemplo, se establecen el precio de envío, los programas de lealtad a los que se limita este servicio de envío y el código de moneda.
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
Reemplaza lo siguiente:
- {ACCOUNT_ID}: Es el identificador único de tu cuenta de Merchant Center.
- {COUNTRY_CODE}: Es el código CLDR (Common Locale Data Repository) del país al que se aplica este servicio. Debe coincidir con el de los precios de los grupos de tarifas.
- {SERVICE_NAME}: Es el nombre del servicio.
- {PROGRAM_LABEL}: Es la etiqueta del programa de lealtad que se estableció en la configuración de Merchant Center.
- {SHIPPING_LABEL}: Es una lista de etiquetas de envío que definen los productos a los que se aplica este grupo de tarifas.
- {PRICE}: Es el precio representado como un número en micros. Por ejemplo, USD 1 = 1,000,000 micros.
- {CURRENCY_CODE}: Es la moneda del precio con acrónimos de tres letras.
Para obtener más información sobre los campos especificados, consulta la documentación de referencia.
El cuerpo de la solicitud debe contener el cuerpo completo del recurso accounts.shippingSettings, incluso si solo actualizas un atributo, ya que cualquier valor NULL o faltante en el cuerpo de la solicitud anula los valores existentes.
Esta es una respuesta de ejemplo de una llamada correcta:
{
"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"
}
Este es un ejemplo que puedes usar para actualizar la configuración de envío de una cuenta determinada con las bibliotecas cliente:
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()
Cómo recuperar la configuración de envío
En las siguientes solicitudes, se muestra cómo puedes recuperar la configuración de envío de una cuenta de 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
Este es un ejemplo que puedes usar para recuperar la información de la configuración de envío de una cuenta determinada con las bibliotecas cliente:
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()
Cómo agregar la configuración del almacén
Para agregar o actualizar la configuración del almacén que almacena y administra el inventario de tu
cuenta, usa el
accounts.shippingSettings.insert
método.
A continuación, se muestra cómo usar la API de Merchant para administrar tus almacenes:
Para recuperar todos tus
shippingsettingsywarehousesexistentes, realiza unaGETsolicitud con elaccounts.shippingSettings.getShippingSettingsmétodo.Crea una solicitud con el
account.shippingSettings.insertmétodo. Copia el recursoshippingsettingsde la respuesta de la solicitudGETa la solicitud de inserción.Para agregar información sobre los almacenes con la llamada de inserción, completa los detalles en el recurso
warehousesdel cuerpo de la solicitud.Ejecuta la solicitud de inserción.
En la siguiente solicitud de ejemplo, se muestra cómo usar el método accounts.shippingSettings.insert para actualizar la configuración del almacén de tu cuenta. La solicitud establece la hora del día en que se puede aceptar un pedido y comenzar a procesarse, los días de procesamiento y la dirección de envío.
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}"
}
}
]
}
Reemplaza lo siguiente:
- {ACCOUNT_ID}: Es el identificador único de tu cuenta de Merchant Center.
- {WAREHOUSE_NAME}: Es el nombre del almacén.
- {ADDRESS}: Es la dirección de envío del almacén.
- {CITY_NAME}: Es la ciudad, el pueblo o la comuna. También puede incluir localidades dependientes o secundarias. Por ejemplo, barrios o suburbios.
- {POSTAL_CODE}: Es el código postal. Por ejemplo, 94043.
- {REGION_CODE}: El código de país CLDR. Por ejemplo, "US".
Esta es una respuesta de ejemplo de una llamada correcta:
{
"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"
}
Cómo establecer grupos de códigos postales
Usa la sub-API de Accounts para administrar las regiones, llamadas postalCodeGroups, para una cuenta de Merchant Center.
El recurso postalCodeGroups es una lista de agrupaciones, en la que cada una es una lista de varios códigos postales que comparten la misma configuración de envío.
Usa la API de Merchant para administrar tus postalCodeGroups de la siguiente manera:
Realiza una llamada get para recuperar todos tus shippingsettings y postalCodeGroups.
Copia los shippingsettings de la llamada get a la llamada update.
Si no usas etiquetas de tiempo de tránsito en tu servicio de envío, quita la siguiente entrada del cuerpo de la solicitud.
"transitTimeLabels": [ "all other labels" ],Completa las regiones que deseas usar en la sección postalCodeGroups para la llamada update.
Realiza una llamada update con los recursos shippingsettings y postalCodeGroups.
Cómo agregar entregas en el mismo día
Puedes usar la API de Merchant para configurar servicios de envío de entrega en el mismo día si tienes inventario local. Consulta Cómo agregar información en la tienda a productos locales (addlocalinventory).
Los servicios de envío de entrega en el mismo día tienen local_delivery como su shipmentType.
Se aplican las siguientes advertencias:
- Todos los servicios de envío local_delivery se consideran entregas en el mismo día.
- No puedes cambiar la información de deliveryTime para las entregas locales.
Para configurar la entrega en el mismo día para tus productos del inventario local, usa el método accounts.shippingSettings.insert.
Esta es una solicitud de ejemplo que establece el tipo de envío, storeConfig (una lista de tiendas desde las que se entregan tus productos) y los grupos de tarifas.
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}"
}
}
}
]
}
]
}
Reemplaza lo siguiente:
- {SHIPMENT_TYPE}: Es el tipo de ubicaciones a las que este servicio envía
pedidos, que incluye lo siguiente:
SHIPMENT_TYPE_UNSPECIFIEDDELIVERYLOCAL_DELIVERYCOLLECTION_POINT
- {SHIPPING_LABEL}: Es una lista de etiquetas de envío que definen los productos a los que se aplica este grupo de tarifas.
Esta es una respuesta de ejemplo de una llamada correcta:
{
"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"
}
Cómo agregar entregas al día siguiente
Los pedidos que se realizan después del horario límite de entrega en el mismo día se programan para la entrega al día siguiente de forma predeterminada.
Para desactivar la entrega al día siguiente, establece no_delivery_post_cutoff en true.
Si desactivas la entrega al día siguiente, tus servicios de envío solo serán visibles antes del horario límite de cada día.
La entrega al día siguiente solo está disponible cuando el shipmentType es local_delivery.
Cómo agregar una política de devoluciones
Si publicas productos a través de anuncios de Shopping o fichas orgánicas, puedes usar returnpolicyonline para crear, ver, editar o borrar políticas de devoluciones en línea con los siguientes atributos:
- Países objetivo (consulta Cómo configurar tus políticas de devoluciones para los anuncios de Shopping y las fichas gratuitas)
- Tarifas de reposición
- Métodos de devolución
- Condición del artículo devuelto
- Categoría del motivo de la devolución
- URLs de la política de devoluciones (consulta Cómo configurar tus políticas de devoluciones para los anuncios de Shopping y las fichas gratuitas)
Los productos que se venden a través de anuncios de Shopping o fichas orgánicas no requieren una dirección de devolución.
Para obtener más detalles, consulta Cómo configurar tus políticas de devoluciones para los anuncios de Shopping y las fichas orgánicas.
Puedes usar returnpolicyonline.create para agregar una política de devoluciones. La respuesta incluye la política actualizada.
POST https://merchantapi.googleapis.com/v1/{ACCOUNT_ID}/returnpolicyonline