Content API ช่วยให้คุณระบุภาษีและการจัดส่งที่จะมีผลกับผลิตภัณฑ์ทั้งหมดภายในบัญชีผ่านบริการการตั้งค่าการจัดส่งและบริการภาษีในบัญชี หากต้องการให้แม่นยำยิ่งขึ้น ให้ระบุภาษีและการจัดส่งในระดับสินค้าผ่านบริการผลิตภัณฑ์
สำหรับข้อมูลเกี่ยวกับนโยบายของ Google และตัวเลือกทั้งหมดสำหรับการระบุภาษีและการจัดส่ง โปรดดูบทความต่อไปนี้ในศูนย์ช่วยเหลือ
โปรดทราบว่าแอตทริบิวต์ tax
และการใช้บริการภาษีบัญชีจะใช้ได้กับผลิตภัณฑ์ที่กำหนดเป้าหมายเป็นสหรัฐอเมริกาเท่านั้น
ภาษีบัญชีและการตั้งค่าการจัดส่ง Content API จะมิเรอร์ฟังก์ชันการทำงานของ UI ของ Merchant Center
ตัวอย่างง่ายๆ
สำหรับค่าธรรมเนียมการจัดส่ง 8 ยูโรในฝรั่งเศส และอิงตามอัตราของผู้ให้บริการขนส่งในสหรัฐอเมริกา ซึ่งบริการจัดส่งแต่ละรายการจะใช้เวลานำส่ง 3-7 วัน
PUT /content/v2.1/<merchant_id>/shippingsettings/<account_id>
{
"accountId": <account_id>,
"services": [
{
"name": "Livraison Prioritaire",
"deliveryCountry": "FR",
"currency": "EUR",
"rateGroups": [
{
"singleValue": {
"flatRate": { "currency": "EUR", "value": "8" }
}
}
],
"active": true,
"deliveryTime": { "minTransitTimeInDays": 3, "maxTransitTimeInDays": 7 }
},
{
"name": "UPS in US",
"deliveryCountry": "US",
"currency": "USD"
"rateGroups": [
{
"singleValue": { "carrierRateName": "ups" },
"carrierRates": [
{
"name": "ups",
"carrierName": "UPS",
"carrierService": "Ground",
"originPostalCode": "10011"
}
]
}
],
"active": true,
"deliveryTime": { "minTransitTimeInDays": 3, "maxTransitTimeInDays": 7 },
}
]
}
หากต้องการเรียกดูชื่อผู้ให้บริการและบริการที่ใช้ได้ ให้ใช้เมธอด getsupportedcarriers
ตัวอย่างที่ซับซ้อน
หากต้องการสร้างโปรโมชันจัดส่งฟรีในรัฐต่างๆ ทั่วทั้งนิวยอร์ก (โดยไม่เรียกเก็บค่าจัดส่ง) ให้ใช้ UPS สำหรับประเทศอื่นๆ ในสหรัฐอเมริกา และใช้คำขอภาษีที่แตกต่างกันสำหรับแต่ละรัฐของสหรัฐอเมริกาโดยใช้คำขอไปยังบริการภาษีบัญชีและการตั้งค่าการจัดส่งของ Content API ดังนี้ ก่อนอื่นให้กำหนดการตั้งค่าการจัดส่ง โดยทำดังนี้
PUT /content/v2.1/<merchant_id>/shippingsettings/<account_id>
{
"accountId": <account_id>,
"services": [
{
"name": "Eligible for free shipping",
"deliveryCountry": "US",
"rateGroups": [
{
"mainTable": {
"rowHeaders": {
"locations": [
{ "locationIds": ["21167"] }, // NY
{ "locationIds": ["21164", "21139"] } // NJ, CT
]
},
"rows": [
{
"cells": [
{
"flatRate": { "currency": "USD", "value": "0" }
}
]
},
{
"cells": [
{
"flatRate": { "currency": "USD", "value": "0" }
}
]
}
]
}
}
],
"active": true,
"deliveryTime": { "minTransitTimeInDays": 3, "maxTransitTimeInDays": 7 },
"currency": "USD"
},
{
"name": "UPS in US",
"deliveryCountry": "US",
"rateGroups": [
{
"singleValue": { "carrierRateName": "UPS mainland" },
"carrierRates": [
{
"name": "UPS mainland",
"carrierName": "UPS",
"carrierService": "Ground",
"originPostalCode": "10011", // currently only US, AU, and DE postal codes
"percentageAdjustment": "1.05",
"flatAdjustment": { "currency": "USD", "value": "0.75" }
}
]
}
],
"active": true,
"deliveryTime": { "minTransitTimeInDays": 3, "maxTransitTimeInDays": 7 },
"currency": "USD"
}
],
"postalCodeGroups": [
{
"name": "More cities", // An alternative using postal codes
"country": "US",
"postalCodeRanges": [
{ "postalCodeRangeBegin": "94041" },
{ "postalCodeRangeBegin": "94042" },
{ "postalCodeRangeBegin": "94043", "postalCodeRangeEnd": "94045" },
{ "postalCodeRangeBegin": "9405*" },
{ "postalCodeRangeBegin": "9406*", "postalCodeRangeEnd": "9408*" }
]
}
]
}
โปรดทราบว่ารหัสสถานที่สามารถใช้เพื่อแสดงเขตบริหารได้
กำหนดค่าภาษีถัดไป:
PUT /content/v2.1/<merchant_id>/accounttax/<account_id>
{
"accountId": <account_id>,
"rules": [
{
"country": "US", // currently only US is supported, may be omitted
"locationId": 21167,
"useGlobalRate": true,
"shippingTaxed": false
},
{
"locationId": 21137,
"useGlobalRate": false,
"shippingTaxed": true,
"ratePercent": "2.15"
}
// ...
]
}
หมายเหตุ: อัตราของผู้ให้บริการขนส่งใช้ได้เฉพาะในสหรัฐอเมริกา เยอรมนี และออสเตรเลีย ปัจจุบันระบบรองรับกลุ่มสถานที่ตั้งในสหรัฐอเมริกาและออสเตรเลีย
กฎการจัดส่งที่ซับซ้อน: ตาราง 2 มิติและตารางย่อย
ในการกำหนดโปรโมชันการจัดส่งเป็นมูลค่า $7 ในสหรัฐอเมริกา มูลค่า $3 หรือ $5 สำหรับคำสั่งซื้อที่มีน้ำหนักมากกว่า 10 ปอนด์ในนิวยอร์กซิตี้ ขึ้นอยู่กับราคาของคำสั่งซื้อและมีมูลค่าฟรีต่ำกว่าน้ำหนักดังกล่าว มีดังนี้
PUT /content/v2.1/<merchant_id>/shippingsettings/<account_id>
{
"accountId": <account_id>,
"services": [
{
"name": "Custom shipping rules",
"deliveryCountry": "US",
"rateGroups": [
{
"mainTable": {
"rowHeaders": {
"postalCodeGroupNames": [ "NYC", "all other locations" ]
},
"columnHeaders": {
"weights": [
{ "unit": "lb", "value": "10" },
{ "unit": "lb", "value": "infinity" }
]
},
"rows": [
{
"cells": [
{ "flatRate": { "value": "0", "currency": "USD" } },
{ "subtableName": "NYC large packages" }
]
},
{
"cells": [
{ "flatRate": { "value": "7", "currency": "USD" } },
{ "flatRate": { "value": "7", "currency": "USD" } }
]
}
]
},
"subtables": [
{
"name": "NYC large packages",
"rowHeaders": {
"prices": [
{"value": "100", "currency": "USD"},
{"value": "infinity", "currency": "USD"}]
},
"rows": [
{
"cells": [
{ "flatRate": { "value": "3", "currency": "USD" } }
]
},
{
"cells": [
{ "flatRate": { "value": "5", "currency": "USD" } }
]
}
]
}
]
}
],
"active": true,
"currency": "USD",
"deliveryTime": { "minTransitTimeInDays": 3, "maxTransitTimeInDays": 7 }
}
],
"postalCodeGroups": [
{
"name": "NYC", // Approximation of NYC using postal codes
"country": "US",
"postalCodeRanges": [
{ "postalCodeRangeBegin": "10000", postalCodeRangeEnd: "11999" }
]
}
]
}
กฎการจัดส่งที่ซับซ้อน: การแยกป้ายกำกับการจัดส่งในบริการต่างๆ
ในการตั้งค่าการจัดส่ง บริการจัดส่งแต่ละรายการจะมีค่าได้สูงสุด 20 รายการ กลุ่มอัตราค่าจัดส่ง เนื่องจากเราใช้กลุ่มอัตราค่าจัดส่งเพื่อแยกความแตกต่าง อัตราค่าจัดส่งผ่านป้ายกำกับการจัดส่ง ซึ่งอาจบ่งชี้ว่ามีเพียง 20 คุณบังคับใช้อัตราค่าจัดส่งที่ไม่ซ้ำกันผ่านป้ายกำกับการจัดส่งได้ อย่างไรก็ตาม คุณสามารถ มีบริการจัดส่งสูงสุด 20 รายการต่อประเทศ ด้วยการแยกอัตรา แยกตามป้ายกำกับการจัดส่งมากกว่าหลายบริการในประเทศเดียวกัน คุณระบุอัตราค่าจัดส่งที่ไม่ซ้ำกันผ่านป้ายกำกับการจัดส่งได้สูงสุด 400 รายการ
หมายเหตุ: หากคุณมีบริการหลายอย่าง แต่ละบริการ ผลิตภัณฑ์สำหรับประเทศหนึ่งๆ จะได้รับการตรวจสอบกับบริการจัดส่งทั้งหมดสำหรับประเทศนั้นๆ ประเทศเพื่อคำนวณอัตราค่าจัดส่งที่เป็นไปได้ หากมีหลายบริการส่งคืน อัตราที่แตกต่างกันสำหรับผลิตภัณฑ์เดียวกัน ระบบจะใช้อัตราที่ต่ำที่สุด
ตัวอย่างด้านล่างแยกป้ายกำกับการจัดส่ง 40 ป้ายโดยใช้อัตราค่าจัดส่งที่ไม่ซ้ำกันจาก 2 ป้าย บริการต่างๆ ตัวอย่างนี้ซ่อนรายละเอียดอื่นๆ ของการจัดส่ง เช่น อัตราจริง หลังจุดไข่ปลา
PUT /content/v2.1/<merchant_id>/shippingsettings/<account_id>
{
"accountId": <account_id>,
"services": [
{
"name": "labels_0_19",
"deliveryCountry": "US",
"active": true,
"currency": "USD",
"deliveryTime": { "minTransitTimeInDays": 3, "maxTransitTimeInDays": 7 }
"rateGroups": [
{ "applicableShippingLabels": ["shipping_label_0"], ... }
{ "applicableShippingLabels": ["shipping_label_1"], ... }
{ "applicableShippingLabels": ["shipping_label_2"], ... }
{ "applicableShippingLabels": ["shipping_label_3"], ... }
{ "applicableShippingLabels": ["shipping_label_4"], ... }
{ "applicableShippingLabels": ["shipping_label_5"], ... }
{ "applicableShippingLabels": ["shipping_label_6"], ... }
{ "applicableShippingLabels": ["shipping_label_7"], ... }
{ "applicableShippingLabels": ["shipping_label_8"], ... }
{ "applicableShippingLabels": ["shipping_label_9"], ... }
{ "applicableShippingLabels": ["shipping_label_10"], ... }
{ "applicableShippingLabels": ["shipping_label_11"], ... }
{ "applicableShippingLabels": ["shipping_label_12"], ... }
{ "applicableShippingLabels": ["shipping_label_13"], ... }
{ "applicableShippingLabels": ["shipping_label_14"], ... }
{ "applicableShippingLabels": ["shipping_label_15"], ... }
{ "applicableShippingLabels": ["shipping_label_16"], ... }
{ "applicableShippingLabels": ["shipping_label_17"], ... }
{ "applicableShippingLabels": ["shipping_label_18"], ... }
{ "applicableShippingLabels": ["shipping_label_19"], ... }
]
},
{
"name": "labels_20_39",
"deliveryCountry": "US",
"active": true,
"currency": "USD",
"deliveryTime": { "minTransitTimeInDays": 3, "maxTransitTimeInDays": 7 }
"rateGroups": [
{ "applicableShippingLabels": ["shipping_label_20"], ... }
{ "applicableShippingLabels": ["shipping_label_21"], ... }
{ "applicableShippingLabels": ["shipping_label_22"], ... }
{ "applicableShippingLabels": ["shipping_label_23"], ... }
{ "applicableShippingLabels": ["shipping_label_24"], ... }
{ "applicableShippingLabels": ["shipping_label_25"], ... }
{ "applicableShippingLabels": ["shipping_label_26"], ... }
{ "applicableShippingLabels": ["shipping_label_27"], ... }
{ "applicableShippingLabels": ["shipping_label_28"], ... }
{ "applicableShippingLabels": ["shipping_label_29"], ... }
{ "applicableShippingLabels": ["shipping_label_30"], ... }
{ "applicableShippingLabels": ["shipping_label_31"], ... }
{ "applicableShippingLabels": ["shipping_label_32"], ... }
{ "applicableShippingLabels": ["shipping_label_33"], ... }
{ "applicableShippingLabels": ["shipping_label_34"], ... }
{ "applicableShippingLabels": ["shipping_label_35"], ... }
{ "applicableShippingLabels": ["shipping_label_36"], ... }
{ "applicableShippingLabels": ["shipping_label_37"], ... }
{ "applicableShippingLabels": ["shipping_label_38"], ... }
{ "applicableShippingLabels": ["shipping_label_39"], ... }
]
}
],
"postalCodeGroups": [ ... ]
}
นอกจากนี้ยังอาจต้องแยกป้ายกำกับการจัดส่งในกลุ่มอัตราต่างๆ ด้วย
แม้ว่าป้ายกำกับการจัดส่งจะใช้อัตราค่าจัดส่งเดียวกัน เนื่องจากแต่ละอัตรา
กลุ่มสามารถมีป้ายกำกับการจัดส่งได้ไม่เกิน 30 ป้ายภายใน
applicableShippingLabels
ตัวอย่างเช่น
หากป้ายกำกับการจัดส่งทั้งหมดใช้โครงสร้างอัตราเดียวกัน
shippingsettings
รองรับได้สูงสุด
ป้ายกำกับการจัดส่ง 12,000 รายการสำหรับประเทศเดียว: 30 ป้ายกำกับการจัดส่งต่ออัตราค่าจัดส่ง
กลุ่ม 20 กลุ่มต่อบริการจัดส่ง และบริการจัดส่ง 20 บริการต่อ
ประเทศ
ดูข้อมูลเพิ่มเติมได้ในเอกสารอ้างอิงสำหรับภาษีบัญชีและการตั้งค่าการจัดส่ง