訪客結帳

無論使用者是否已登入 Google 帳戶,都能透過訪客結帳功能,向合作夥伴下單。

如要判斷使用者是透過訪客身分提交訂單,還是已登入 Google 帳戶,請檢查 SubmitOrderRequestMessage 中的 finalOrder.cart.extension.contact 內的 emailVerified 欄位。已登入 Google 帳戶的使用者下單時,emailVerified 會設為 true,而訪客使用者下單時則不會有 emailVerified

非會員訂單

{
  "finalOrder": {
    ...
    "cart": {
      ...
      "extension": {
        "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension",
        "contact": {
          "displayName": "Lovefood Ordering",
          "email": "ilovefood@example.com",
          "phoneNumber": "+16501234567",
          "firstName": "Lovefood",
          "lastName": "Ordering"
        }
      }
    }
  }
}

已登入的訂單

{
  "finalOrder": {
    ...
    "cart": {
      ...
      "extension": {
        "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension",
        "contact": {
          "displayName": "Lovefood Ordering",
          "email": "ilovefood@example.com",
          "phoneNumber": "+16501234567",
          "firstName": "Lovefood",
          "lastName": "Ordering",
          "emailVerified": true
        }
      }
    }
  }
}