Transactions API در 3 مه 2023 منسوخ خواهد شد، قبل از غروب کنشهای مکالمه در 13 ژوئن 2023. برای اطلاعات بیشتر،
غروب کنشهای مکالمه را ببینید.
Method: orders.createWithCustomToken
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
با استفاده از یک توکن سفارشی که توسط گوگل ساخته شده است، سفارش جدید را ایجاد و برمی گرداند. توسعه دهندگانی که از این روش استفاده می کنند باید userToken ارسال شده توسط گوگل را در درخواست تنظیم کنند. این روش در مواردی استفاده میشود که توسعهدهندگان/تجار مستقیماً سفارشها را از طرف سفارش در Google ذخیره میکنند (بهجای تراکنشها و جریان AMP).
درخواست HTTP
POST https://actions.googleapis.com/v3/orders:createWithCustomToken
URL از دستور GRPC Transcoding استفاده می کند.
درخواست بدن
بدنه درخواست حاوی داده هایی با ساختار زیر است:
فیلدها |
---|
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 نوع عمودی نگاشت شوند. یک سفارش اگر بیش از 1 عمودی را نشان دهد، یک سفارش معتبر نیست. |
userToken | string مورد نیاز: رمز رمزگذاری شده توسط Google از طریق کانال ناهمزمان به شریک ارائه شده است. |
بدن پاسخگو
در صورت موفقیت آمیز بودن، بدنه پاسخ حاوی نمونه ای از Order
است.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eCreates new Orders using a custom token provided by Google, enabling developers to save orders directly on behalf of the user.\u003c/p\u003e\n"],["\u003cp\u003eRequires a \u003ccode\u003ePOST\u003c/code\u003e request to \u003ccode\u003ehttps://actions.googleapis.com/v3/orders:createWithCustomToken\u003c/code\u003e with specific data in the request body.\u003c/p\u003e\n"],["\u003cp\u003eThe request body must contain \u003ccode\u003eheader\u003c/code\u003e, \u003ccode\u003eorder\u003c/code\u003e, and \u003ccode\u003euserToken\u003c/code\u003e fields with specified data structures and requirements.\u003c/p\u003e\n"],["\u003cp\u003eA successful response returns the created \u003ccode\u003eOrder\u003c/code\u003e object with details of the order.\u003c/p\u003e\n"]]],["This describes the process of creating a new order using a custom Google-minted token. A `POST` request is sent to `https://actions.googleapis.com/v3/orders:createWithCustomToken`. The request body requires a JSON payload with `header`, `order` (including `create_time`, `merchant_order_id`, and at least one valid `line_item` with an ID and vertical extension), and `userToken` (an encrypted token from Google). A successful request returns an `Order` instance in the response body.\n"],null,["# Method: orders.createWithCustomToken\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n\nCreates and returns the new Order using a custom token minted by google. Developers using this method should set the userToken passed by google in the request. This method is used in cases where developers/merchant directly saves orders to Google on behalf of order (instead of Transactions and AMP flow).\n\n### HTTP request\n\n`POST https://actions.googleapis.com/v3/orders:createWithCustomToken`\n\nThe URL uses [gRPC Transcoding](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto) syntax.\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ``` { \"header\": { object (/assistant/df-asdk/transactions/reference/physical/rest/v3/OrderRequestHeader) }, \"order\": { object (/assistant/df-asdk/transactions/reference/physical/rest/v3/Order) }, \"userToken\": string } ``` |\n\n| Fields ||\n|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `header` | `object (`[OrderRequestHeader](/assistant/df-asdk/transactions/reference/physical/rest/v3/OrderRequestHeader)`)` Required: Header for the create order request. |\n| `order` | `object (`[Order](/assistant/df-asdk/transactions/reference/physical/rest/v3/Order)`)` Required: Order to be created. Note: 1. Following fields are always required to create a valid order: order.create_time, order.merchant_order_id, order.contents.line_items, order.contents.line_items.id 2. Order must have at-least 1 line item and line item must have defined vertical/extension. 3. All extensions (both at order level and line_item level) must map to 1 vertical type ie. an order is not a valid order if it represents more than 1 vertical. \u003cbr /\u003e |\n| `userToken` | `string` Required: Encrypted token provided to partner by Google via asynchronous channel. |\n\n### Response body\n\nIf successful, the response body contains an instance of [Order](/assistant/df-asdk/transactions/reference/physical/rest/v3/Order)."]]