ภาษีและการจัดส่งระดับบัญชี

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 จัดการป้ายกำกับการจัดส่งได้สูงสุด 1,2,000 ป้ายสำหรับประเทศเดียว ได้แก่ ป้ายกำกับการจัดส่ง 30 ป้ายต่อกลุ่มอัตรา กลุ่มอัตรา 20 กลุ่มต่อบริการจัดส่ง และบริการจัดส่ง 20 รายการต่อประเทศ

ดูข้อมูลเพิ่มเติมได้ในเอกสารอ้างอิงสำหรับภาษีบัญชีและการตั้งค่าการจัดส่ง