Transaction API 将于 2023 年 5 月 3 日弃用,在此之前,会话操作将于 2023 年 6 月 13 日停用。如需了解详情,请参阅
对话型 Action 停用。
Method: orders.createWithCustomToken
使用 Google 铸造的自定义令牌创建并返回新的 Order。使用此方法的开发者应设置 Google 在请求中传递的 userToken。如果开发者/商家代表订单(而不是交易和 AMP 流程)直接将订单保存到 Google,则可以使用此方法。
HTTP 请求
POST https://actions.googleapis.com/v3/orders:createWithCustomToken
网址采用 gRPC 转码语法。
请求正文
请求正文中包含结构如下的数据:
字段 |
header |
object (OrderRequestHeader )
必需:创建订单请求的标头。
|
order |
object (Order )
必需:要创建的订单。 注意:1.创建有效订单时,始终需要包含以下字段:order.create_time、order.merchant_order_id、order.contents.line_items、order.contents.line_items.id 2. 订单中必须至少包含 1 个订单项,并且订单项必须已定义行业/附加信息。3. 所有附加信息(包括订单级和订单项级)都必须映射到 1 种行业类型,即如果一个订单代表多个行业,就不是有效的订单。
|
userToken |
string
必需:Google 通过异步渠道向合作伙伴提供的加密令牌。
|
响应正文
如果成功,则响应正文包含一个 Order
实例。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-09-12。
[null,null,["最后更新时间 (UTC):2024-09-12。"],[[["This document explains the `orders:createWithCustomToken` method, which creates new Google Orders using a custom, Google-minted token."],["Developers should include the `userToken` provided by Google in the request."],["This process is typically used when developers or merchants directly save orders to Google on behalf of the order, rather than using Transactions or AMP flows."],["The request body must include a header, order details (with at least one line item and a specified vertical), and the `userToken`."],["A successful response will return the created `Order` object."]]],["This document outlines how to create a new order using a custom Google-minted token. It involves sending a `POST` request to `https://actions.googleapis.com/v3/orders:createWithCustomToken`. The request body requires a JSON structure with `header` (OrderRequestHeader object), `order` (Order object, including required fields like `create_time`, `merchant_order_id`, and line items), and a `userToken` (an encrypted token from Google). Successful requests return an `Order` object in the response body. The order must contain at least one line item, and all extensions should map to a single vertical type.\n"]]