از API فرعی حسابها برای مدیریت تنظیمات حمل و نقل برای همه محصولات تحت حساب خود و همه حسابهای فرعی مرتبط استفاده کنید.
تغییراتی که در تنظیمات حمل و نقل ایجاد می کنید برای همه محصولات اعمال می شود. برای بهروزرسانی ارسال برای محصولات جداگانه، از Merchant Products API استفاده کنید.
برای اطلاعات بیشتر، به تنظیم تنظیمات حمل و نقل مراجعه کنید.
نمای کلی تنظیمات حمل و نقل
منبع accounts.shippingSettings
به شما امکان می دهد تنظیمات حمل و نقل حساب پیشرفته خود و همه حساب های فرعی مرتبط را بازیابی و به روز کنید.
حسابهای پیشرفته معمولاً توسط یکپارچهسازها، تجمیعکنندهها و شرکای کانال که فروشگاههای آنلاین و خدمات API را برای چندین کسبوکار مدیریت میکنند، استفاده میشوند. کسبوکارهایی که چندین فروشگاه آنلاین یا مارکهایی دارند که در وبسایتهای جداگانه فروخته میشوند نیز میتوانند حسابهای فرعی را در یک حساب پیشرفته انتخاب کنند.
Google میتواند زمان تخمینی تحویل را برای برخی محصولات بهطور خودکار بهروزرسانی کند.
تنظیمات حمل و نقل را اضافه کنید
برای افزودن یا بهروزرسانی تنظیمات ارسال برای حساب خود، از روش accounts.shippingSettings.insert
استفاده کنید.
درخواست نمونه زیر قیمت حمل و نقل، برنامه های وفاداری که این سرویس حمل و نقل محدود به آن است و کد ارز را تنظیم می کند.
HTTP
POST https://merchantapi.googleapis.com/accounts/v1beta/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/v1beta/accounts/ACCOUNT_ID/shippingSettings:insert' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"name":"SHIPPING_SETTING_NAME","services":[{"serviceName":"SERVICE_NAME","currencyCode":"CURRENCY_CODE","rateGroups":[{"applicableShippingLabels":["SHIPPING_LABEL"],"carrierRates":[{"name":"new","carrier":"CARRIER_NAME","carrierService":"CARRIER_SERVICE","originPostalCode":"ZIPCODE"}],"singleValue":{"flatRate":{"amountMicros":10000000,"currencyCode":"USD"}}}],"deliveryCountries":["COUNTRY_CODE"],"deliveryTime":{"maxHandlingDays":2,"minHandlingDays":1},"minimumOrderValue":{"amountMicros":50000000,"currencyCode":"USD"},"active":false}]}' \
--compressed
موارد زیر را جایگزین کنید:
- ACCOUNT_ID : شناسه منحصر به فرد حساب Merchant Center شما.
- COUNTRY_CODE : کد CLDR (مخزن داده محلی مشترک) کشوری که این سرویس در آن اعمال می شود. باید با قیمت ها در گروه های نرخ مطابقت داشته باشد.
- SERVICE_NAME : نام سرویس.
- CARRIER_NAME : نام شرکت مخابراتی. به عنوان مثال، UPS و Fedex.
- CARRIER_SERVICE : سرویس پشتیبانی شده برای شرکت مخابراتی. برای لیست کامل خدمات شرکت مخابراتی، به نرخ شرکت مخابراتی (فقط AU، DE، UK و ایالات متحده) مراجعه کنید.
- PROGRAM_LABEL : برچسب برنامه وفاداری در تنظیمات برنامه وفاداری شما در Merchant Center تنظیم شده است.
- SHIPPING_LABEL : فهرستی از برچسب های حمل و نقل که محصولاتی را که این گروه نرخ برای آنها اعمال می شود، مشخص می کند.
- PRICE : قیمت به صورت یک عدد در میکرو نمایش داده می شود. به عنوان مثال، 1 USD = 1000000 میکرون.
- CURRENCY_CODE : واحد پول قیمت با استفاده از مخفف های سه حرفی.
برای اطلاعات بیشتر در مورد فیلدهای مشخص شده، به مستندات مرجع مراجعه کنید.
بدنه درخواست باید حاوی متن کامل منبع accounts.shippingSettings
باشد، حتی اگر فقط یک ویژگی واحد را بهروزرسانی میکنید، زیرا هر مقدار 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"
}
در اینجا نمونه ای وجود دارد که می توانید از آن برای به روز رسانی تنظیمات حمل و نقل برای یک حساب خاص با استفاده از کتابخانه های مشتری استفاده کنید:
جاوا
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1beta.DeliveryTime;
import com.google.shopping.merchant.accounts.v1beta.InsertShippingSettingsRequest;
import com.google.shopping.merchant.accounts.v1beta.RateGroup;
import com.google.shopping.merchant.accounts.v1beta.Service;
import com.google.shopping.merchant.accounts.v1beta.Service.ShipmentType;
import com.google.shopping.merchant.accounts.v1beta.ShippingSettings;
import com.google.shopping.merchant.accounts.v1beta.ShippingSettingsServiceClient;
import com.google.shopping.merchant.accounts.v1beta.ShippingSettingsServiceSettings;
import com.google.shopping.merchant.accounts.v1beta.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\V1beta\Client\ShippingSettingsServiceClient;
use Google\Shopping\Merchant\Accounts\V1beta\DeliveryTime;
use Google\Shopping\Merchant\Accounts\V1beta\InsertShippingSettingsRequest;
use Google\Shopping\Merchant\Accounts\V1beta\RateGroup;
use Google\Shopping\Merchant\Accounts\V1beta\Service;
use Google\Shopping\Merchant\Accounts\V1beta\Service\ShipmentType;
use Google\Shopping\Merchant\Accounts\V1beta\ShippingSettings;
use Google\Shopping\Merchant\Accounts\V1beta\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();
پایتون
from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1beta import DeliveryTime
from google.shopping.merchant_accounts_v1beta import InsertShippingSettingsRequest
from google.shopping.merchant_accounts_v1beta import RateGroup
from google.shopping.merchant_accounts_v1beta import Service
from google.shopping.merchant_accounts_v1beta import ShippingSettings
from google.shopping.merchant_accounts_v1beta import ShippingSettingsServiceClient
from google.shopping.merchant_accounts_v1beta 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/v1beta/accounts/{ACCOUNT_ID}/shippingSettings
CURL
curl \
'https://merchantapi.googleapis.com/accounts/v1beta/accounts/{ACCOUNT_ID}/shippingSettings' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
در اینجا نمونه ای است که می توانید برای بازیابی اطلاعات تنظیمات حمل و نقل برای یک حساب معین با استفاده از کتابخانه های مشتری استفاده کنید:
جاوا
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1beta.GetShippingSettingsRequest;
import com.google.shopping.merchant.accounts.v1beta.ShippingSettings;
import com.google.shopping.merchant.accounts.v1beta.ShippingSettingsName;
import com.google.shopping.merchant.accounts.v1beta.ShippingSettingsServiceClient;
import com.google.shopping.merchant.accounts.v1beta.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\V1beta\Client\ShippingSettingsServiceClient;
use Google\Shopping\Merchant\Accounts\V1beta\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();
پایتون
from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1beta import GetShippingSettingsRequest
from google.shopping.merchant_accounts_v1beta import ShippingSettingsServiceClient
_ACCOUNT = configuration.Configuration().read_merchant_info()
_PARENT = f"accounts/{_ACCOUNT}"
def get_shipping_settings():
"""Gets the ShippingSettings for a given Merchant Center account."""
# Gets OAuth Credentials.
credentials = generate_user_credentials.main()
# Creates a client.
client = ShippingSettingsServiceClient(credentials=credentials)
# Creates the Shipping Settings name
name = _PARENT + "/shippingSettings"
# Creates the request.
request = GetShippingSettingsRequest(name=name)
# Makes the request and prints the retrieved ShippingSettings.
try:
response = client.get_shipping_settings(request=request)
print("Retrieved ShippingSettings below")
print(response)
except RuntimeError as e:
print(e)
if __name__ == "__main__":
get_shipping_settings()
تنظیمات انبار را اضافه کنید
برای افزودن یا بهروزرسانی تنظیمات انبار که موجودی حساب شما را ذخیره و مدیریت میکند، از روش accounts.shippingSettings.insert
استفاده کنید.
در اینجا نحوه استفاده از Merchant API برای مدیریت انبارهای خود آورده شده است:
برای بازیابی همه
shippingsettings
وwarehouses
موجود خود، با استفاده از روشaccounts.shippingSettings.getShippingSettings
درخواستGET
کنید.با استفاده از روش
account.shippingSettings.insert
یک درخواست ایجاد کنید. منبعshippingsettings
از پاسخ درخواستGET
به درخواست درج کپی کنید.برای افزودن اطلاعات در مورد انبارها با استفاده از درج فراخوان، جزئیات مربوط به آن را در منبع
warehouses
در بدنه درخواست پر کنید.درخواست درج را اجرا کنید.
نمونه درخواست زیر نحوه استفاده از روش accounts.shippingSettings.insert
را برای به روز رسانی تنظیمات انبار برای حساب خود نشان می دهد. درخواست زمان پذیرش سفارش و شروع پردازش، روزهای رسیدگی و آدرس ارسال را تعیین میکند.
POST https://merchantapi.googleapis.com/accounts/v1beta/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 . به عنوان مثال، "ایالات متحده".
در اینجا یک نمونه پاسخ از یک تماس موفق است:
{
"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"
}
گروه های کد پستی را تنظیم کنید
از API فرعی حسابها برای مدیریت مناطقی که postalCodeGroups نامیده میشوند، برای حساب Merchant Center استفاده کنید.
منبع postalCodeGroups فهرستی از گروهبندی است، که در آن هر گروهبندی فهرستی از چندین کد پستی است که تنظیمات حمل و نقل یکسانی را به اشتراک میگذارند.
از Merchant API برای مدیریت postalCodeGroups خود به شرح زیر استفاده کنید:
برای بازیابی همه تنظیمات حمل و نقل و postalCodeGroups خود تماس بگیرید.
تنظیمات حمل و نقل را از تماس دریافت به تماس بهروزرسانی کپی کنید.
اگر از برچسب های زمان حمل و نقل در خدمات حمل و نقل خود استفاده نمی کنید، ورودی زیر را از بدنه درخواست حذف کنید.
"transitTimeLabels": [ "all other labels" ],
مناطقی را که میخواهید در بخش postalCodeGroups برای تماس بهروزرسانی استفاده کنید، پر کنید.
با تنظیمات حمل و نقل و منابع postalCodeGroups تماس بهروزرسانی برقرار کنید.
تحویل همان روز را اضافه کنید
اگر موجودی محلی دارید، میتوانید از Merchant API برای پیکربندی خدمات حمل و نقل تحویل همان روز استفاده کنید. به افزودن اطلاعات در فروشگاه به محصولات محلی ( adlocalinventory ) مراجعه کنید.
خدمات حمل و نقل تحویل همان روز، local_delivery را به عنوان نوع ارسال دارند.
اخطارهای زیر اعمال می شود:
- تمام خدمات حمل و نقل local_delivery تحویل همان روز در نظر گرفته می شود.
- شما نمی توانید اطلاعات تحویل زمان تحویل محلی را تغییر دهید.
برای تنظیم تحویل همان روز برای محصولات موجودی محلی خود، از روش accounts.shippingSettings.insert
استفاده کنید.
در اینجا یک نمونه درخواست وجود دارد که نوع ارسال، storeConfig
(لیستی از فروشگاههایی که محصولات شما از آنها تحویل میشوند) و گروههای نرخ را تعیین میکند.
POST https://merchantapi.googleapis.com/accounts/v1beta/accounts/{ACCOUNT_ID}/shippingSettings:insert
{
"etag": "",
"name": "accounts/ACCOUNT_ID/shippingSetting",
"services": [
{
"deliveryCountries": [
"COUNTRY_CODE"
],
"serviceName": "SERVICE_NAME",
"active": false,
"currencyCode": "CURRENCY_CODE",
"shipmentType": "SHIPMENT_TYPE",
"storeConfig": {
"cutoffConfig": {
"localCutoffTime": {
"hour": 7,
"minute": 40
}
},
"serviceRadius": {
"unit": "KILOMETERS",
"value": 40
},
"storeCodes": [],
"storeServiceType": "ALL_STORES"
},
"rateGroups": [
{
"applicableShippingLabels": [
"SHIPPING_LABEL"
],
"singleValue": {
"flatRate": {
"amountMicros": PRICE,
"currencyCode": "CURRENCY_CODE"
}
}
}
]
}
]
}
موارد زیر را جایگزین کنید:
- SHIPMENT_TYPE : نوع مکان هایی که این سرویس سفارشات را به آنها ارسال می کند که شامل موارد زیر است:
-
SHIPMENT_TYPE_UNSPECIFIED
-
DELIVERY
-
LOCAL_DELIVERY
-
COLLECTION_POINT
-
- SHIPPING_LABEL : فهرستی از برچسب های حمل و نقل که محصولاتی را که این گروه نرخ برای آنها اعمال می شود، مشخص می کند.
در اینجا یک نمونه پاسخ از یک تماس موفق است:
{
"name": "accounts/ACCOUNT_ID/shippingSettings",
"services": [
{
"serviceName": "SERVICE_NAME",
"active": false,
"deliveryCountries": [
"COUNTRY_CODE"
],
"currencyCode": "CURRENCY_CODE",
"rateGroups": [
{
"applicableShippingLabels": [
"SHIPPING_LABEL"
],
"singleValue": {
"flatRate": {
"amountMicros": "PRICE",
"currencyCode": "CURRENCY_CODE"
}
}
}
],
"shipmentType": "SHIPMENT_TYPE",
"storeConfig": {
"storeServiceType": "ALL_STORES",
"cutoffConfig": {
"localCutoffTime": {
"hour": "7",
"minute": "40"
},
"noDeliveryPostCutoff": false
},
"serviceRadius": {
"value": "40",
"unit": "KILOMETERS"
}
}
}
],
"etag": "OAJCTQgBEAAaRwoEdGVzdBIEIgJVUxoDVVNEIggiBggHECgoACoeCAESDwoNCAESCU9WRVJTSVpFRBoJIgcIAhCAwtcvWAWSAQCaAQQIAhAo"
}
تحویل روز بعد را اضافه کنید
سفارشهایی که بعد از زمان قطع تحویل همان روز شما ثبت میشوند، بهطور پیشفرض برای تحویل در روز بعد برنامهریزی شدهاند.
برای خاموش کردن تحویل روز بعد، no_delivery_post_cutoff را روی true تنظیم کنید.
اگر تحویل روز بعد را خاموش کنید، خدمات حمل و نقل شما فقط قبل از زمان قطع هر روز قابل مشاهده است.
تحویل روز بعد فقط زمانی در دسترس است که نوع حمل و نقل محلی_تحویل باشد.
یک سیاست بازگشت اضافه کنید
اگر محصولات را از طریق تبلیغات خرید یا فهرستهای ارگانیک فهرست میکنید، میتوانید از returnpolicyonline برای ایجاد، مشاهده، ویرایش یا حذف خطمشیهای بازگشت آنلاین با ویژگیهای زیر استفاده کنید:
- کشورهای هدف را ببینید، به تنظیم سیاستهای بازگشت خود برای تبلیغات خرید و فهرستهای رایگان مراجعه کنید .
- هزینه های ذخیره مجدد
- روش های بازگشت
- شرایط بازگشت کالا
- دسته دلیل برگرداندن
- نشانیهای اینترنتی خطمشی برگرداندن، به تنظیم خطمشیهای بازگشت خود برای آگهیهای خرید و فهرستهای رایگان مراجعه کنید.
محصولاتی که از طریق تبلیغات خرید یا فهرستهای ارگانیک فروخته میشوند نیازی به آدرس برگشت ندارند.
برای جزئیات بیشتر، به تنظیم سیاستهای بازگشت خود برای تبلیغات خرید و فهرستهای ارگانیک مراجعه کنید.
می توانید از returnpolicyonline.create برای افزودن یک سیاست بازگشت استفاده کنید. پاسخ شامل خط مشی به روز شده است.
POST https://merchantapi.googleapis.com/v1beta/{ACCOUNT_ID}/returnpolicyonline