از زیر-API حسابها برای مدیریت تنظیمات ارسال برای همه محصولات تحت حساب کاربری خود و همه زیر-حسابهای مرتبط استفاده کنید.
تغییراتی که در تنظیمات ارسال ایجاد میکنید، برای همه محصولات اعمال خواهد شد. برای بهروزرسانی ارسال برای محصولات تکی، از API محصولات فروشگاه استفاده کنید.
برای اطلاعات بیشتر، به تنظیم تنظیمات حمل و نقل مراجعه کنید.
نمای کلی تنظیمات ارسال
منبع accounts.shippingSettings به شما امکان میدهد تنظیمات ارسال حساب پیشرفته و تمام حسابهای فرعی مرتبط با آن را بازیابی و بهروزرسانی کنید.
حسابهای پیشرفته معمولاً توسط یکپارچهسازان، تجمیعکنندگان و شرکای کانال که فروشگاههای آنلاین و خدمات API را برای چندین کسبوکار مدیریت میکنند، استفاده میشوند. کسبوکارهایی که چندین فروشگاه آنلاین یا برندهایی دارند که در وبسایتهای جداگانه فروخته میشوند، میتوانند حسابهای فرعی را نیز تحت یک حساب پیشرفته واحد داشته باشند.
گوگل میتواند زمان تحویل تخمینی برخی از محصولات را بهطور خودکار بهروزرسانی کند.
اضافه کردن تنظیمات ارسال
برای افزودن یا بهروزرسانی تنظیمات حمل و نقل برای حساب کاربری خود، از متد accounts.shippingSettings.insert استفاده کنید.
درخواست نمونه زیر، قیمت ارسال، برنامههای وفاداری که این سرویس ارسال به آنها محدود است و کد ارز را تعیین میکند.
اچتیپی
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 --request POST \
'https://merchantapi.googleapis.com/accounts/v1/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 : شناسه منحصر به فرد حساب مرکز فروش شما.
- COUNTRY_CODE : کد CLDR (مخزن دادههای محلی مشترک) کشوری که این سرویس در آن اعمال میشود. باید با کد قیمتها در گروههای نرخ مطابقت داشته باشد.
- SERVICE_NAME : نام سرویس.
- CARRIER_NAME : نام شرکت حمل و نقل. به عنوان مثال، UPS و Fedex.
- CARRIER_SERVICE : سرویس پشتیبانیشده برای اپراتور. برای مشاهدهی لیست کامل سرویسهای اپراتور، به نرخ اپراتور (فقط استرالیا، آلمان، بریتانیا و ایالات متحده) مراجعه کنید.
- PROGRAM_LABEL : برچسب برنامه وفاداری که در تنظیمات برنامه وفاداری شما در مرکز فروشندگان تنظیم شده است.
- SHIPPING_LABEL : فهرستی از برچسبهای حمل و نقل که محصولاتی را که این گروه نرخ برای آنها اعمال میشود، تعریف میکند.
- PRICE : قیمتی که به صورت عددی بر حسب میکرو نمایش داده میشود. برای مثال، ۱ دلار آمریکا = ۱۰۰۰۰۰۰ میکرو.
- 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.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);
}
}
پی اچ پی
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();
پایتون
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()
تنظیمات ارسال را بازیابی کنید
درخواستهای زیر نشان میدهند که چگونه میتوانید تنظیمات ارسال یک حساب مرکز فروشندگان را بازیابی کنید:
اچتیپی
GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/shippingSettings
حلقه
curl \
'https://merchantapi.googleapis.com/accounts/v1/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.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);
}
}
پی اچ پی
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();
پایتون
from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1 import GetShippingSettingsRequest
from google.shopping.merchant_accounts_v1 import ShippingSettingsServiceClient
_ACCOUNT = configuration.Configuration().read_merchant_info()
_PARENT = f"accounts/{_ACCOUNT}"
def get_shipping_settings():
"""Gets the ShippingSettings for a given Merchant Center account."""
# Gets OAuth Credentials.
credentials = generate_user_credentials.main()
# Creates a client.
client = ShippingSettingsServiceClient(credentials=credentials)
# Creates the Shipping Settings name
name = _PARENT + "/shippingSettings"
# Creates the request.
request = GetShippingSettingsRequest(name=name)
# Makes the request and prints the retrieved ShippingSettings.
try:
response = client.get_shipping_settings(request=request)
print("Retrieved ShippingSettings below")
print(response)
except RuntimeError as e:
print(e)
if __name__ == "__main__":
get_shipping_settings()
تنظیمات انبار را اضافه کنید
برای افزودن یا بهروزرسانی تنظیمات انبار که موجودی حساب شما را ذخیره و مدیریت میکنند، از متد accounts.shippingSettings.insert استفاده کنید.
در اینجا نحوه استفاده از Merchant API برای مدیریت انبارهای شما آورده شده است:
برای بازیابی تمام
shippingsettingsوwarehousesموجود، با استفاده از متدaccounts.shippingSettings.getShippingSettingsیک درخواستGETارسال کنید.با استفاده از متد
account.shippingSettings.insertیک درخواست ایجاد کنید. منبعshippingsettingsرا از پاسخ درخواستGETبه درخواست insert کپی کنید.برای افزودن اطلاعات مربوط به انبارها با استفاده از فراخوانی insert، جزئیات مربوط به آن را در منبع
warehousesدر بدنه درخواست وارد کنید.درخواست درج را اجرا کنید.
نمونه درخواست زیر نحوه استفاده از متد accounts.shippingSettings.insert را برای بهروزرسانی تنظیمات انبار برای حساب شما نشان میدهد. این درخواست، زمان روزی که سفارش میتواند پذیرفته شود و پردازش آن آغاز شود، روزهای رسیدگی و آدرس ارسال را تعیین میکند.
POST https://merchantapi.googleapis.com/accounts/v1/accounts/ACCOUNT_ID/shippingSettings:insert
{
"etag": "",
"name": "accounts/ACCOUNT_ID/shippingSetting",
"warehouses": [
{
"cutoffTime": {
"hour": 7,
"minute": 50
},
"handlingDays": 7,
"name": "WAREHOUSE_NAME",
"shippingAddress": {
"streetAddress": "ADDRESS",
"administrativeArea": "CA",
"city": "CITY_NAME",
"postalCode": "POSTAL_CODE",
"regionCode": "REGION_CODE"
}
}
]
}
موارد زیر را جایگزین کنید:
- ACCOUNT_ID : شناسه منحصر به فرد حساب مرکز فروش شما.
- WAREHOUSE_NAME : نام انبار.
- ADDRESS : آدرس حمل و نقل انبار.
- CITY_NAME : شهر، شهرستان یا بخش. همچنین میتواند شامل محلات یا زیرمحلات وابسته باشد. برای مثال، محلهها یا حومه شهرها.
- POSTAL_CODE : کد پستی یا ZIP. برای مثال، ۹۴۰۴۳.
- REGION_CODE : کد کشور CLDR . برای مثال، "US".
در اینجا نمونهای از پاسخ یک تماس موفق را مشاهده میکنید:
{
"name": "accounts/ACCOUNT_ID/shippingSettings",
"warehouses": [
{
"name": "WAREHOUSE_NAME",
"shippingAddress": {
"streetAddress": "ADDRESS",
"city": "CITY_NAME",
"administrativeArea": "CA",
"postalCode": "POSTAL_CODE",
"regionCode": "REGION_CODE"
},
"cutoffTime": {
"hour": 7,
"minute": 50
},
"handlingDays": "7",
"businessDayConfig": {
"businessDays": [
"MONDAY",
"TUESDAY",
"WEDNESDAY",
"THURSDAY",
"FRIDAY"
]
}
}
],
"etag": "OAJiUAjB0au+FBABGgR0ZXN0Ii4KAlVTGgJDQSoKQ2FsaWZvcm5pYWIFOTQwNDNyETExMXcgMzFzdCBTdHJlZXQuKgQIBxAyMAc4ATgCOAM4BDgF"
}
تنظیم گروههای کد پستی
از زیر-API حسابها برای مدیریت مناطق، به نام postalCodeGroups ، برای یک حساب مرکز فروش استفاده کنید.
منبع postalCodeGroups فهرستی از گروهبندیها است که هر گروهبندی فهرستی از چندین کد پستی است که تنظیمات حمل و نقل یکسانی را به اشتراک میگذارند.
از Merchant API برای مدیریت postalCodeGroups خود به شرح زیر استفاده کنید:
برای دریافت تمام تنظیمات ارسال و گروههای کد پستی خود، یک تماس تلفنی برقرار کنید.
تنظیمات ارسال (shippingsettings) را از فراخوانی get به فراخوانی update کپی کنید.
اگر در سرویس حمل و نقل خود از برچسبهای زمان حمل و نقل استفاده نمیکنید، ورودی زیر را از بدنه درخواست حذف کنید.
"transitTimeLabels": [ "all other labels" ],مناطقی را که میخواهید برای فراخوانی بهروزرسانی استفاده کنید، در بخش postalCodeGroups وارد کنید.
با استفاده از منابع shippingsettings و postalCodeGroups یک فراخوانی بهروزرسانی انجام دهید.
اضافه شدن تحویل در همان روز
اگر موجودی محلی دارید، میتوانید از رابط برنامهنویسی کاربردی فروشنده (Merchant API) برای پیکربندی خدمات ارسال تحویل در همان روز استفاده کنید. به بخش افزودن اطلاعات درون فروشگاه به محصولات محلی ( addlocalinventory ) مراجعه کنید.
سرویسهای ارسال با تحویل در همان روز، local_delivery را به عنوان shipmentType خود دارند.
موارد احتیاط زیر اعمال میشود:
- تمام خدمات ارسال local_delivery، تحویل در همان روز محسوب میشوند.
- شما نمیتوانید اطلاعات زمان تحویل را برای تحویلهای محلی تغییر دهید.
برای تنظیم تحویل در همان روز برای محصولات موجودی محلی خود، از متد accounts.shippingSettings.insert استفاده کنید.
در اینجا یک درخواست نمونه وجود دارد که نوع ارسال، storeConfig (لیستی از فروشگاههایی که محصولات شما از آنجا تحویل داده میشوند) و گروههای نرخ را تنظیم میکند.
POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/shippingSettings:insert
{
"etag": "",
"name": "accounts/ACCOUNT_ID/shippingSetting",
"services": [
{
"deliveryCountries": [
"COUNTRY_CODE"
],
"serviceName": "SERVICE_NAME",
"active": false,
"currencyCode": "CURRENCY_CODE",
"shipmentType": "SHIPMENT_TYPE",
"storeConfig": {
"cutoffConfig": {
"localCutoffTime": {
"hour": 7,
"minute": 40
}
},
"serviceRadius": {
"unit": "KILOMETERS",
"value": 40
},
"storeCodes": [],
"storeServiceType": "ALL_STORES"
},
"rateGroups": [
{
"applicableShippingLabels": [
"SHIPPING_LABEL"
],
"singleValue": {
"flatRate": {
"amountMicros": PRICE,
"currencyCode": "CURRENCY_CODE"
}
}
}
]
}
]
}
موارد زیر را جایگزین کنید:
- SHIPMENT_TYPE : نوع مکانهایی که این سرویس به آنها سفارش ارسال میکند که شامل موارد زیر است:
-
SHIPMENT_TYPE_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 تنظیم کنید.
اگر تحویل روز بعد را خاموش کنید، خدمات ارسال شما فقط قبل از زمان پایان هر روز قابل مشاهده است.
تحویل روز بعد فقط زمانی امکانپذیر است که نوع ارسال (shippingType) برابر با local_delivery باشد.
اضافه کردن سیاست بازگشت کالا
اگر محصولات را از طریق تبلیغات خرید یا فهرستهای ارگانیک فهرست میکنید، میتوانید از returnpolicyonline برای ایجاد، مشاهده، ویرایش یا حذف سیاستهای بازگشت آنلاین با ویژگیهای زیر استفاده کنید:
- کشورهای هدف، به بخش «تنظیم سیاستهای بازگشت کالا برای تبلیغات خرید و فهرستهای رایگان» مراجعه کنید.
- هزینههای انبارداری مجدد
- روشهای بازگشت
- شرایط بازگشت کالا
- دسته بندی دلایل بازگشت
- برای مشاهدهی آدرسهای اینترنتی مربوط به سیاستهای بازگشت کالا، به بخش «تنظیم سیاستهای بازگشت کالا» برای «تبلیغات خرید» و «لیستهای رایگان» مراجعه کنید.
محصولاتی که از طریق تبلیغات خرید یا فهرستهای ارگانیک فروخته میشوند، نیازی به آدرس برگشت ندارند.
برای جزئیات بیشتر، به «تنظیم سیاستهای بازگشت کالا برای تبلیغات خرید و فهرستهای ارگانیک» مراجعه کنید.
شما میتوانید از returnpolicyonline.create برای اضافه کردن یک سیاست بازگشت استفاده کنید. پاسخ شامل سیاست بهروزرسانیشده است.
POST https://merchantapi.googleapis.com/v1/{ACCOUNT_ID}/returnpolicyonline