以访客身份结账

借助访客结账功能,无论用户是否登录了 Google 账号,都可以通过 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
        }
      }
    }
  }
}