Gratuity

消費者結帳時,端對端訂購功能會顯示小費選項。讓消費者選擇要為訂單加上多少小費。

端對端訂購會將所選金額以 SubmitOrderRequestMessage 傳送,並以 GRATUITY 類型在 ProposedOrder.otherItem 內傳送 LineItem

如何隱藏小費選取器

你可以在商品目錄資料動態饋給中使用 ServingConfig.disableTipWidget,隱藏餐廳服務的小費選取器。

如何設定預設小費金額

你可以在結帳時為餐廳設定預設小費金額,或拒絕接受小費。CheckoutResponseMessage 可支援下列用途:

  • 餐廳要求固定小費金額

    CheckoutResponseMessage 中的 ProposedOrder.otherItems 中,新增 GRATUITY 類型的委刊項,並在其中加入固定金額。

    JSON
    {
      "name": "Required Tip",
      "type": "GRATUITY",
      "price": {
        "type": "ESTIMATE",
        "amount": {
          "currencyCode": "USD",
          "units": "3",
          "nanos": 100000000
        }
      },
      "gratuityExtension": {
        "gratuityType": "MANDATORY"
      }
    }
  • 餐廳建議小費金額,並讓顧客選擇是否修改金額

    CheckoutResponseMessage 中的 ProposedOrder.otherItems 中,新增 GRATUITY 類型的委刊項,並設定固定金額。請務必一併新增 gratuityExtension,並將 gratuityType 值設為 USER_MODIFIABLE

    JSON
    {
      "name": "Suggested Tip",
      "type": "GRATUITY",
      "price": {
        "type": "ESTIMATE",
        "amount": {
          "currencyCode": "USD",
          "units": "3",
          "nanos": 100000000
        }
      },
      "gratuityExtension": {
        "gratuityType": "USER_MODIFIABLE"
      }
    }
  • 餐廳不接受任何小費

    CheckoutResponseMessage 中的 ProposedOrder.otherItems 中,新增 GRATUITY 類型的委刊項,並在其中加入空白金額。

    JSON
    {
      "name": "Tip",
      "type": "GRATUITY",
      "price": {
          "type":"ESTIMATE",
          "amount": {
            "currencyCode":"USD"
        }
      }
    }