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

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

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

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

שירותי ה-Content API ו'מס החשבון' ו'הגדרות המשלוח' משקפים את הפונקציונליות של ממשק המשתמש של 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"
    }
    // ...
  ]
}

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

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

כדי להגדיר מבצע על משלוחים בתוך 28 ש"ח, 12 ש"ח או 20 ש"ח להזמנות במשקל של יותר מ-40 ק"ג בהתאם למחיר ההזמנה ומשלוח חינם מתחת למשקל הזה, צריך להשתמש בנוסח הבא:

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 יכול לטפל ב-1,2,000 תוויות משלוח לכל היותר במדינה אחת: 30 תוויות משלוח לכל קבוצת תעריפים, 20 קבוצות תעריפים לכל שירות משלוחים ו-20 שירותי משלוחים לכל מדינה.

מידע נוסף זמין במסמכי התיעוד בנושא מס חשבון והגדרות משלוח.