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

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 ประเทศต่อประเทศ

ดูข้อมูลเพิ่มเติมได้ในเอกสารประกอบอ้างอิงสําหรับ accounttax และ shippingsettings