מס ומשלוח ברמת החשבון

ה-Content API מאפשר לציין מס ומשלוח שיחולו על כל המוצרים בחשבון באמצעות השירותים shippingsettings ו-accounttax. אם אתם רוצים להיות מדויקים יותר, אתם יכולים לציין מיסים ומשלוחים ברמת הפריט באמצעות שירות המוצרים.

מידע על המדיניות של Google ועל כל האפשרויות לציון מיסים ומשלוחים זמין במאמרי מרכז העזרה הבאים:

שימו לב שהמאפיין tax, ולכן השימוש בשירות accounttax, רלוונטי רק למוצרים שמיועדים לארה"ב.

שירותי Content API‏ accounttax ו-shippingsettings משקפים את הפונקציונליות של ממשק המשתמש של 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 בשאר ארה"ב, ולהחיל מס שונה על כל אחת ממדינות ארה"ב, משתמשים בבקשות לשירותים accounttax ו-shippingsettings של 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"
    }
    // ...
  ]
}

הערה: תעריפים של חברת התובלה זמינים רק בארה"ב, בגרמניה ובאוסטרליה. קבוצות מיקומים נתמכות כרגע בארה"ב ובאוסטרליה.

כללי משלוח מורכבים: טבלאות דו-ממדיות וטבלאות משנה

כדי להגדיר מבצע משלוח של 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 תוויות משלוח מפולחות לפי תעריפים ייחודיים בשני שירותים שונים. בדוגמה הזו, שאר הפרטים של משאב המשלוח, כמו התעריפים בפועל, מוסתרים מאחורי שלוש נקודות.

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.