انواع پایه
سبد خرید
شامل جزئیات سفارش، و همچنین اینکه آیا درخواست برای تحویل یا تحویل است. یک سبد همچنین حاوی جزئیات تحویل، انعام و آدرس تحویل است. شیءCart
در یک Checkout AppRequest
تعریف شده است. f شما یک کپی از سبد خرید را در Checkout AppResponse
خود قرار می دهید. جدول زیر ویژگی های نوع Cart
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
@type | Const | نوع این شی اگر شیء اصلی Cart بخشی از ProposedOrder است، این فیلد را حذف کنید. مقدار: | |
id | رشته | شناسه اختیاری سبد خرید | |
merchant | Merchant | تاجر وابسته به این سبد خرید. | |
lineItems | فهرست < LineItem > | ضروری. فهرست کالا(ها) یا خدماتی که کاربر سفارش می دهد. نباید کمتر از 1 مورد داشته باشد. | |
promotions | فهرست< Promotion > | تبلیغاتی که در این سبد خرید اعمال می شود. در حال حاضر فقط یک تبلیغ پشتیبانی می شود. | |
notes | رشته | نکاتی در مورد سفارش یا دستورالعمل های تحویل. | |
extension | FoodCartExtension | جزئیات مربوط به کاربر، مانند تنظیمات برگزیده تکمیل را تعریف می کند. |
مثال زیر یک عنصر Cart
را نشان می دهد:
مثال 1
{ "@type": "type.googleapis.com/google.actions.v2.orders.Cart", "merchant": { "id": "https://www.exampleprovider.com/merchant/id1", "name": "Cucina Venti" }, "lineItems": [ { "name": "Sizzling Prawns Dinner", "type": "REGULAR", "id": "sample_item_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/offer/id1", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "16", "nanos": 750000000 } }, "subLines": [ { "note": "Notes for this item." } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension", "options": [ { "id": "sample_addon_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id1", "name": "Honey Mustard", "price": { "currencyCode": "USD" }, "quantity": 1 }, { "id": "sample_addon_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id2", "name": "BBQ Sauce", "price": { "currencyCode": "USD", "nanos": 500000000 }, "quantity": 1 } ] } } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodCartExtension", "fulfillmentPreference": { "fulfillmentInfo": { "delivery": { "deliveryTimeIso8601": "P0M" } } }, "location": { "coordinates": { "latitude": 37.788783, "longitude": -122.41384 }, "formattedAddress": "1350 CHARLESTON ROAD, MOUNTAIN VIEW, CA, United States", "zipCode": "94043", "city": "Mountain View", "postalAddress": { "regionCode": "US", "postalCode": "94043", "administrativeArea": "CA", "locality": "Mountain View", "addressLines": [ "1350 Charleston Road" ] }, "notes": "Gate code is #111" } } }
مثال 2
{ "merchant": { "id": "https://www.exampleprovider.com/merchant/id1", "name": "Falafel Bite" }, "lineItems": [ { "name": "Pita Chips", "type": "REGULAR", "id": "sample_item_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/offer/id1", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "2", "nanos": 750000000 } }, "subLines": [ { "note": "Notes for this item." } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension", "options": [ { "id": "sample_addon_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id1", "name": "Honey Mustard", "price": { "currencyCode": "USD" }, "quantity": 1 }, { "id": "sample_addon_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id2", "name": "BBQ Sauce", "price": { "currencyCode": "USD", "nanos": 500000000 }, "quantity": 1 } ] } }, { "name": "Chicken Shwarma Wrap", "type": "REGULAR", "id": "sample_item_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/offer/id2", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "8" } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" } }, { "name": "Greek Salad", "type": "REGULAR", "id": "sample_item_offer_id_3", "offerId": "https://www.exampleprovider.com/menu/item/offer/id3", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "9", "nanos": 990000000 } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" } }, { "name": "Prawns Biryani", "type": "REGULAR", "id": "sample_item_offer_id_4", "offerId": "https://www.exampleprovider.com/menu/item/offer/id4", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "15", "nanos": 990000000 } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" } } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodCartExtension", "fulfillmentPreference": { "fulfillmentInfo": { "delivery": { "deliveryTimeIso8601": "P90M" } } }, "location": { "coordinates": { "latitude": 37.788783, "longitude": -122.41384 }, "formattedAddress": "1350 CHARLESTON ROAD, MOUNTAIN VIEW, CA, United States", "zipCode": "94043", "city": "Mountain View", "postalAddress": { "regionCode": "US", "postalCode": "94043", "administrativeArea": "CA", "locality": "Mountain View", "addressLines": [ "1350 Charleston Road" ] }, "notes": "Gate code is #111" } } }
مخاطب
جزئیات مربوط به شخص دریافت کننده سفارش را مشخص می کند. فقط درAppResponse
موجود است. جدول زیر ویژگی های نوع Contact
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
displayName | رشته | نام شخص دریافت کننده سفارش، همانطور که می خواهید نمایش داده شود. اگر firstName و lastName مشخص نشده اند از این فیلد استفاده کنید. مثال: | |
email | رشته | آدرس ایمیل شخصی که سفارش را دریافت می کند. مثال: | |
firstName | رشته | نام شخصی که سفارش را دریافت می کند. مثال: | |
lastName | رشته | نام خانوادگی شخصی که سفارش را دریافت می کند. مثال: | |
phoneNumber | رشته | شماره تلفن شخص دریافت کننده سفارش به همراه کد کشور. مثال: | |
emailVerified | بولی | نشان می دهد که آیا شخصی که سفارش را دریافت می کند با حساب Google خود وارد شده است یا خیر. |
مثال زیر یک عنصر Contact
را نشان می دهد:
مثال
{ "displayName": "Lovefood Ordering", "email": "ilovefood@example.com", "phoneNumber": "+16501234567" }
CustomPushMessage
حاویOrderUpdate
برای درخواست است. جدول زیر ویژگی های نوع CustomPushMessage
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
orderUpdate | OrderUpdate | ضروری. اطلاعات به روز شده برای سفارش |
مثال زیر یک عنصر CustomPushMessage
را نشان می دهد:
مثال
{ "orderUpdate": { "actionOrderId": "sample_action_order_id", "orderState": { "state": "IN_TRANSIT", "label": "Order is on the way" }, "inTransitInfo": { "updatedTime": "2017-07-17T12:00:00Z" }, "updateTime": "2017-07-17T12:00:00Z", "orderManagementActions": [ { "type": "CUSTOMER_SERVICE", "button": { "title": "Contact customer service", "openUrlAction": { "url": "mailto:support@example.com" } } }, { "type": "EMAIL", "button": { "title": "Email restaurant", "openUrlAction": { "url": "mailto:person@example.com" } } }, { "type": "CALL_RESTAURANT", "button": { "title": "Call restaurant", "openUrlAction": { "url": "tel:+16505554679" } } } ], "receipt": { "userVisibleOrderId": "userVisibleId1234" }, "infoExtension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "estimatedFulfillmentTimeIso8601": "2017-07-17T13:00:00Z/2017-07-17T13:30:00Z" } } }
اطلاعات تحویل
جدول زیر ویژگی های نوع DeliveryInfo
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
deliveryTimeIso8601 | رشته | زمان تخمینی تحویل، در قالب مهر زمانی ISO 8601: "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" یا قالب مدت زمان: "P( n)Y(n)M(n)DT(n)H(n)M(n)S". به عنوان مثال، PT90M مدت زمان 90 دقیقه را نشان می دهد. مقدار پیش فرض "PT0M" نشان می دهد که زمان تحویل ترجیحی در اسرع وقت است. مرجع: https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations. از این برای بهروزرسانی زمان تخمینی تحویل در حین پاسخ پرداخت استفاده کنید. مثال: |
مثال زیر یک عنصر DeliveryInfo
را نشان می دهد:
مثال
{ "deliveryTimeIso8601": "PT90M" }
سلب مسئولیت
جدول زیر ویژگی های نوع Disclaimer
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
predefinedMessage | PredefinedMessage | ضروری. برای نمایش پیام های سلب مسئولیت از پیش تعریف شده در حین پرداخت. | |
feeAmount | Money | شریک برای این سفارش مبلغ N کارمزد از تاجر دریافت می کند. | |
feeAmountRange | FeeAmountRange | شریک به ازای هر سفارش مبلغ N تا M را از رستوران دریافت می کند. | |
feePercent | عدد | شریک برای این سفارش، N% کارمزد از تاجر دریافت خواهد کرد. | |
feePercentRange | FeePercentRange | شریک به ازای هر سفارش، از تاجر N% تا M% کارمزد دریافت خواهد کرد. |
مثال زیر یک عنصر Disclaimer
را نشان می دهد:
مثال 1
{ "predefinedMessage": "NEW_YORK_DELIVERY_FEE_TIP_DISCLAIMER" }
مثال 2
{ "predefinedMessage": "FEE_CHARGED_TO_RESTAURANT_DISCLOSURE" }
مثال 3
{ "predefinedMessage": "FEE_CHARGED_TO_RESTAURANT_DISCLOSURE", "feePercent": 25 }
مثال 4
{ "predefinedMessage": "FEE_CHARGED_TO_RESTAURANT_DISCLOSURE", "feePercentRange": { "minFeePercent": 20, "maxFeePercent": 30 } }
مثال 5
{ "predefinedMessage": "FEE_CHARGED_TO_RESTAURANT_DISCLOSURE", "feeAmount": { "currencyCode": "AUD", "units": 2, "nanos": 500000000 } }
مثال 6
{ "predefinedMessage": "FEE_CHARGED_TO_RESTAURANT_DISCLOSURE", "feeAmountRange": { "minFeeAmount": { "currencyCode": "AUD", "units": 2, "nanos": 500000000 }, "maxFeeAmount": { "currencyCode": "AUD", "units": 10, "nanos": 0 } } }
خطا
نوع Error
دارای مقادیر احتمالی زیر است:
-
CLOSED
: رستوران در زمان سفارش بسته است. -
NO_CAPACITY
: ظرفیت سرویس در دسترس نیست (به عنوان مثال، قطعی موقت به دلیل زمان اوج مصرف). -
NO_COURIER_AVAILABLE
: به دلیل محدود بودن پرسنل تحویل، امکان پردازش سفارش وجود ندارد. -
REQUIREMENTS_NOT_MET
: محدودیتهای پذیرش سفارش رعایت نشده است (به عنوان مثال، حداقل اندازه سبد). -
UNAVAILABLE_SLOT
: سفارش را نمی توان در زمان قبلی سفارشی که توسط DeliveryInfo یا PickupInfo تعیین شده است، انجام داد. -
OUT_OF_SERVICE_AREA
: سفارش را نمی توان به آدرس کاربر تحویل داد. -
PROMO_EXPIRED
: چون تبلیغات منقضی شده است، امکان اعمال وجود ندارد. -
PROMO_NOT_APPLICABLE
: کد خطای عمومی برای دریافت همه موارد عدم استفاده از کد تبلیغاتی، در صورتی که هیچ یک از خطاهای کد تبلیغاتی دیگر مناسب نباشد. -
PROMO_NOT_RECOGNIZED
: کد کوپن شناسایی نشد. -
PROMO_ORDER_INELIGIBLE
: سفارش فعلی برای این کوپن واجد شرایط نیست. -
PROMO_USER_INELIGIBLE
: کاربر فعلی واجد شرایط این کوپن نیست. -
AVAILABILITY_CHANGED
: مورد دیگر در دسترس نیست، یا موارد کافی برای انجام درخواست وجود ندارد. -
INCORRECT_PRICE
: خطاهای قیمت در هزینه یا کل. -
INVALID
: یک LineItem، FulfillmentOption یا Promotion حاوی داده های نامعتبر است. -
NOT_FOUND
: LineItem، FulfillmentOption یا Promotion یافت نمی شود. -
PRICE_CHANGED
: قیمت یک مورد تغییر کرده است.
FeeAmountRange
جدول زیر ویژگی های نوع FeeAmountRange
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
minFeeAmount | Money | کران پایین تر از مقدار کارمزد دریافت شده.. | |
maxFeeAmount | Money | کران بالای مبلغ کارمزد دریافت شده.. |
FeePercentRange
جدول زیر ویژگی های نوع FeePercentRange
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
minFeePercent | عدد | کران پایین تر از درصد هزینه شارژ شده است. | |
maxFeePercent | عدد | کران بالای کارمزد درصد شارژ شده است. |
FoodCart Extension
حاوی جزئیات مربوط به کاربر، مانند تنظیمات برگزیده انجام.
جدول زیر ویژگی های نوع FoodCartExtension
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
@type | Const | نوع این پسوند این فیلد همیشه روی "type.googleapis.com/google.actions.v2.orders.FoodCartExtension" تنظیم می شود. مقدار: | |
contact | Contact | اطلاعات تماس با شخص دریافت کننده سفارش جزئیات شامل نام، شماره تلفن و آدرس ایمیل شخص است. | |
fulfillmentPreference | FulfillmentOption | ضروری. اولویت تحقق کاربر. | |
location | Location | در CheckoutRequestMessage، این فیلد آدرس تحویل را مشخص می کند که اگر سفارش برای تحویل باشد، لازم است. برای سفارشاتی که برای تحویل گرفتن یا تحویل گرفتن هستند، این قسمت در پیام گنجانده نشده است. |
مثال زیر یک عنصر FoodCartExtension
را نشان می دهد:
مثال 1
{ "@type": "type.googleapis.com/google.actions.v2.orders.FoodCartExtension", "fulfillmentPreference": { "fulfillmentInfo": { "delivery": { "deliveryTimeIso8601": "P0M" } } }, "location": { "coordinates": { "latitude": 37.788783, "longitude": -122.41384 }, "formattedAddress": "1350 CHARLESTON ROAD, MOUNTAIN VIEW, CA, United States", "zipCode": "94043", "city": "Mountain View", "postalAddress": { "regionCode": "US", "postalCode": "94043", "administrativeArea": "CA", "locality": "Mountain View", "addressLines": [ "1350 Charleston Road" ] }, "notes": "Gate code is #111" } }
مثال 2
{ "@type": "type.googleapis.com/google.actions.v2.orders.FoodCartExtension", "fulfillmentPreference": { "fulfillmentInfo": { "pickup": { "pickupTimeIso8601": "P0M" } } }, "contact": { "displayName": "Lovefood Ordering", "email": "ilovefood@example.com", "phoneNumber": "+16501234567" } }
FoodError Extension
یک یا چند خطا را شناسایی می کند که در هنگام پردازش یک درخواست رخ داده است. جدول زیر فیلدهای نوعFoodErrorExtension
را توضیح می دهد. خطاها را می توان در یک CheckoutResponse
ارسال کرد. جدول زیر ویژگی های نوع FoodErrorExtension
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
@type | Const | ضروری. نوع این پسوند مقدار: | |
foodOrderErrors | فهرست < FoodOrderError > | ضروری. آرایه ای از اشیاء FoodOrderError که خطاهای رخ داده را توصیف می کند. یک خطا در هر سبد خرید یا هر مورد توصیه می شود. نباید کمتر از 1 مورد داشته باشد. | |
correctedProposedOrder | ProposedOrder | یک سفارش پیشنهادی جدید با اصلاحات. اگر خطاهای قابل بازیابی در ProposedOrder اصلی وجود دارد، این شی را برگردانید. به عنوان مثال، تغییر در قیمت یک یا چند کالای خط در سبد خرید یک خطای قابل بازیابی است. خطاهای قابل بازیابی با یک سفارش پیشنهادی معتبر به جای اینکه کاربر را ملزم به بازبینی سبد خرید خود کند، به مرحله تأیید میرود. | |
paymentOptions | PaymentOptions | گزینه های پرداخت پیش فرض برای کاربر انتخاب شده است. | |
additionalPaymentOptions | فهرست < PaymentOptions > | گزینه های پرداخت جایگزین در دسترس کاربر است. |
مثال زیر یک عنصر FoodErrorExtension
را نشان می دهد:
مثال
{ "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension", "foodOrderErrors": [ { "error": "PRICE_CHANGED", "id": "sample_item_offer_id_1", "description": "The price has changed.", "updatedPrice": { "currencyCode": "USD", "units": "2", "nanos": 750000000 } }, { "error": "PRICE_CHANGED", "id": "sample_item_offer_id_2", "description": "The price has changed.", "updatedPrice": { "currencyCode": "USD", "units": "8" } } ], "correctedProposedOrder": { "id": "sample_corrected_proposed_order_id_1", "otherItems": [ { "name": "New customer discount", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "-5", "nanos": -500000000 } }, "type": "DISCOUNT" }, { "name": "Delivery fee", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "3", "nanos": 500000000 } }, "type": "DELIVERY" }, { "name": "Tax", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "1", "nanos": 500000000 } }, "type": "TAX" } ], "cart": { "merchant": { "id": "https://www.exampleprovider.com/merchant/id1", "name": "Falafel Bite" }, "lineItems": [ { "name": "Pita Chips", "type": "REGULAR", "id": "sample_item_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/offer/id1", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "2", "nanos": 750000000 } }, "subLines": [ { "note": "Notes for this item." } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension", "options": [ { "id": "sample_addon_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id1", "name": "Honey Mustard", "price": { "currencyCode": "USD" }, "quantity": 1 }, { "id": "sample_addon_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id2", "name": "BBQ Sauce", "price": { "currencyCode": "USD", "nanos": 500000000 }, "quantity": 1 } ] } }, { "name": "Chicken Shwarma Wrap", "type": "REGULAR", "id": "sample_item_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/offer/id2", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "8" } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" } }, { "name": "Greek Salad", "type": "REGULAR", "id": "sample_item_offer_id_3", "offerId": "https://www.exampleprovider.com/menu/item/offer/id3", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "9", "nanos": 990000000 } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" } }, { "name": "Prawns Biryani", "type": "REGULAR", "id": "sample_item_offer_id_4", "offerId": "https://www.exampleprovider.com/menu/item/offer/id4", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "15", "nanos": 990000000 } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" } } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodCartExtension", "fulfillmentPreference": { "fulfillmentInfo": { "delivery": { "deliveryTimeIso8601": "P90M" } } }, "location": { "coordinates": { "latitude": 37.788783, "longitude": -122.41384 }, "formattedAddress": "1350 CHARLESTON ROAD, MOUNTAIN VIEW, CA, United States", "zipCode": "94043", "city": "Mountain View", "postalAddress": { "regionCode": "US", "postalCode": "94043", "administrativeArea": "CA", "locality": "Mountain View", "addressLines": [ "1350 Charleston Road" ] }, "notes": "Gate code is #111" } } }, "totalPrice": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "36", "nanos": 730000000 } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderExtension", "availableFulfillmentOptions": [ { "fulfillmentInfo": { "delivery": { "deliveryTimeIso8601": "P90M" } }, "expiresAt": "2017-07-17T12:30:00Z" } ] } }, "paymentOptions": { "googleProvidedOptions": { "tokenizationParameters": { "tokenizationType": "PAYMENT_GATEWAY", "parameters": { "gateway": "stripe", "stripe:publishableKey": "pk_live_stripe_client_key", "stripe:version": "2017-04-06" } }, "supportedCardNetworks": [ "AMEX", "DISCOVER", "MASTERCARD", "JCB", "VISA" ], "prepaidCardDisallowed": true } } }
FoodItem Extension
افزودنی هایی را برای مواد غذایی تعریف می کند.
جدول زیر ویژگی های نوع FoodItemExtension
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
@type | Const | ضروری. نوع این پسوند این فیلد همیشه روی "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" تنظیم می شود. مقدار: | |
options | فهرست < FoodItemOption > | یک گزینه می تواند یک مورد افزودنی یا گروه افزودنی حاوی مجموعه ای از افزونه ها باشد. |
مثال زیر یک عنصر FoodItemExtension
را نشان می دهد:
مثال
{ "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension", "options": [ { "id": "sample_addon_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id1", "name": "Honey Mustard", "price": { "currencyCode": "USD" }, "quantity": 1 }, { "id": "sample_addon_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id2", "name": "BBQ Sauce", "price": { "currencyCode": "USD", "nanos": 500000000 }, "quantity": 1, "subOptions": [ { "id": "10239138", "offerId": "912391723", "name": "Fries", "price": { "currencyCode": "USD", "units": "2", "nanos": 230000000 }, "quantity": 1 } ] } ] }
FoodItemOption
جدول زیر ویژگی های نوع FoodItemOption
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
id | رشته | شناسه منحصر به فرد اختصاص داده شده توسط Google. هنگامی که یک FoodOrderError یا AsyncOrderUpdateRequest ارسال می کنید، از این فیلد برای تمایز در مواردی استفاده کنید که یک سبد دارای بیش از یک کالا با همان offerId است. مثال: | |
offerId | رشته | شناسه پیشنهاد برای مورد. مثال: | |
name | رشته | نام گزینه مثال: | |
price | Money | ||
note | رشته | یادداشت مربوط به گزینه | |
quantity | عدد | برای گزینه هایی که آیتم ها هستند، تعداد آیتم ها. مثال: | |
subOptions | فهرست< FoodItemOption > | گزینه های فرعی برای گزینه، در صورت وجود. |
مثال زیر یک عنصر FoodItemOption
را نشان می دهد:
مثال 1
{ "id": "10293231", "offerId": "1918491", "name": "Honey Mustard", "price": { "currencyCode": "USD", "units": "1", "nanos": 250000000 }, "quantity": 5 }
مثال 2
{ "id": "123166552", "offerId": "912849184", "name": "Make It A Meal", "price": { "currencyCode": "USD", "units": "3", "nanos": 730000000 }, "quantity": 1, "subOptions": [ { "id": "10239138", "offerId": "912391723", "name": "Fries", "price": { "currencyCode": "USD", "units": "2", "nanos": 230000000 }, "quantity": 1 }, { "id": "57159183", "offerId": "81837123", "name": "Drink", "price": { "currencyCode": "USD", "units": "3", "nanos": 130000000 }, "quantity": 1 } ] }
خطای سفارش غذا
حاوی جزئیات مربوط به خطاهای موجود درCheckoutResponse
است. جدول زیر ویژگی های نوع FoodOrderError
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
error | Error | ضروری. | |
id | رشته | زمانی این فیلد برای خطاهای سطح مورد ضروری است. این LineItem.id اختصاص داده شده توسط Google برای آیتم های منو یا FoodItemOption.id برای افزونه ها است. | |
description | رشته | شرح خطا. این توضیحات برای ثبت داخلی است و برای کاربران قابل مشاهده نیست. | |
updatedPrice | Money | هنگامی که قیمت جدید کالایی که باعث خطا شده است. این فقط زمانی لازم است که خطا "PRICE_CHANGED" باشد. | |
availableQuantity | عدد صحیح | زمانی که مقدار جدید موجود از موردی که باعث خطا شده است. این فقط زمانی مورد نیاز است که خطا "INVALID" یا "NOT_FOUND" باشد. مقدار باید برای "INVALID" و "NOT_FOUND" صفر باشد. |
مثال زیر یک عنصر FoodOrderError
را نشان می دهد:
مثال 1
{ "error": "CLOSED", "description": "This store is currently reachable. Please try again later." }
مثال 2
{ "error": "PRICE_CHANGED", "id": "french_fries", "description": "The price has changed.", "updatedPrice": { "currencyCode": "USD", "units": "2", "nanos": 750000000 } }
FoodOrder Extension
حاوی اطلاعات تکمیلی در مورد سفارش است.
جدول زیر ویژگی های نوع FoodOrderExtension
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
@type | Const | نوع این پسوند این فیلد همیشه روی "type.googleapis.com/google.actions.v2.orders.FoodOrderExtension" تنظیم می شود. مقدار: | |
availableFulfillmentOptions | فهرست< FulfillmentOption > | گزینه های انجام موجود برای سفارش را نشان می دهد. | |
optinForRemarketing | بولی | درخواست کاربر برای شرکت در کانال های بازاریابی شما. به طور پیش فرض، نمی توانید محتوای بازاریابی را بدون رضایت کاربر ارسال کنید. اگر optinForRemarketing درست باشد، می توانید کاربر را مشترک کنید. اگر optinForRemarketing نادرست است یا وجود ندارد، باید وضعیت اشتراک را در سیستم خود همانطور که هست نگه دارید. کاربران نمی توانند از طریق Google انصراف دهند، فقط از طریق یک تابع لغو اشتراک ارائه شده در کانال های بازاریابی شما. این پرچم فقط در SubmitOrderRequestMessage وجود دارد. |
مثال زیر یک عنصر FoodOrderExtension
را نشان می دهد:
مثال 1
{ "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderExtension", "availableFulfillmentOptions": [ { "fulfillmentInfo": { "delivery": { "deliveryTimeIso8601": "P0M" } }, "expiresAt": "2017-07-17T12:30:00Z" } ] }
مثال 2
{ "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderExtension", "availableFulfillmentOptions": [ { "fulfillmentInfo": { "pickup": { "pickupTimeIso8601": "P0M" } }, "expiresAt": "2020-08-20T11:41:00Z" } ], "optinForRemarketing": true }
FulfillmentOption
می توانید از یک شیFulfillmentOption
به روش های زیر استفاده کنید:- در
Checkout AppRequest
وSubmit AppRequest
،Cart.extension.fulfillmentPreference
: ترجیحات کاربر (تحویل یا تحویل) را ذخیره می کند. هنگام ارسال درخواست تسویه حساب، قیمت همیشه 0 است. - در
Checkout AppResponse
،ProposedOrder.extension.availableFulfillmentOptions
: یک یا چند گزینه تحویل را تعریف می کند (در حال حاضر، فقط یک گزینه پشتیبانی می شود). شما گزینه پیش فرض را به عنوانLineItem
درProposedOrder.otherItems
مشخص می کنید.offerId
IDFulfillmentOption
باید با شناسهLineItem
مشخص شده درProposedOrder.otherItems
مطابقت داشته باشد.
جدول زیر ویژگی های نوع FulfillmentOption
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
offerId | رشته | شناسه منحصر به فرد برای این گزینه تکمیل، در صورت وجود. | |
fulfillmentInfo | FulfillmentOptionInfo | ضروری. | |
expiresAt | مهر زمانی ISO | زمانی که در آن این گزینه تکمیل منقضی می شود. | |
price | Money | هزینه این گزینه |
مثال زیر یک عنصر FulfillmentOption
را نشان می دهد:
مثال
{ "offerId": "offer5", "fulfillmentInfo": { "pickup": { "pickupTimeIso8601": "P0M" } }, "expiresAt": "2019-05-02T00:00:00-07:00", "price": { "currencyCode": "USD", "units": "5", "nanos": 230000000 } }
FulfillmentOptionInfo
اطلاعات مربوط بهFulfillmentInfo
را تعریف می کند. جدول زیر ویژگی های نوع FulfillmentOptionInfo
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
دقیقاً یکی از گروه های زیر از خواص مورد نیاز است. | |||
delivery | گروه 1 | DeliveryInfo | در صورت وجود، نشان دهنده سفارش تحویل است. |
pickup | گروه 2 | PickupInfo | در صورت وجود، نشان دهنده یک سفارش تحویل است. |
تصویر
جدول زیر ویژگی های نوع Image
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
sourceUrl | رشته | ضروری. URL برای تصویر. حداقل، تصویر باید 72x72 پیکسل باشد. برای بهترین نتیجه، از تصویری استفاده کنید که حداقل 216x216 پیکسل باشد. تصویر باید کمتر از 6 مگابایت و 64 مگاپیکسل باشد. |
آیتم خط
محتویات یک سبد خرید (Cart.lineItems
) یا هزینه های اضافی برای یک سفارش ( ProposedOrder.otherItems
) را تعیین می کند. جدول زیر ویژگی های نوع LineItem
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
id | رشته | زمانی که برای یک LineItem در سبد خرید (ProposedOrder.cart.lineItems[0].id)، این شناسه منحصربهفردی است که Google هنگام ایجاد سفارش ایجاد میکند. برای LineItem در ProposedOrder (ProposedOrder.otherItems[0].id)، که برای افزودن مواردی مانند هزینههای تحویل و مالیات استفاده میشود، ارزش شناسه توسط ارائهدهنده تعریف میشود. به عنوان مثال، در یک سبد خرید دو مورد مشابه با دستورالعمل های مختلف آماده سازی وجود دارد (مانند دو پیتزا متوسط با مجموعه های مختلف تاپینگ). در این حالت، هر دو آیتم دارای یک پایه پیشنهادی هستند. وقتی درخواست بهروزرسانی سفارش را ارسال میکنید تا نشان دهید که یک مورد رد شده است، از این شناسه بهعنوان ابهامکننده استفاده کنید. به عبارت دیگر، اگر یکی از پیتزاها به دلیل نداشتن رویه خاصی رد شود، شناسه به Google کمک میکند تا تعیین کند که کدام مورد به ترتیبی که به آن اشاره میکنید. این فیلد به جز در موارد دیگر الزامی است. | |
name | رشته | ضروری. نام مورد خط. این یک رشته قابل مشاهده برای کاربر است و در صورت امکان باید به صورت جمله باشد (مانند «هزینه تحویل»، «هزینه خدمات»، «مالیات»). این فیلد با 100 کاراکتر برای کاربران کوتاه شده است. | |
type | LineItemType | ضروری. | |
quantity | عدد صحیح | زمانی که تعداد موارد گنجانده شده برای ProposedOrder.otherItems قابل اجرا نیست. | |
description | رشته | توضیحات مورد. | |
price | Price | ضروری. قیمت کالا یا اقلام. این مقدار منعکس کننده قیمت کل همه کالاها یا خدمات برای این خط است (به عبارت دیگر، هزینه هر افزودنی را اضافه کنید و در مقدار ضرب کنید). به عنوان مثال: اگر یک کالای 10 دلاری دارای 3 عدد باشد، قیمت آن 30 دلار خواهد بود. برای یک پیتزا با قیمت پایه 5 دلار و یک دلار اضافی، قیمت 6 دلار خواهد بود. برای دو پیتزا (تعداد = 2) با قیمت پایه 5 دلار و هر کدام با یک دلار اضافی، قیمت 12 دلار خواهد بود. هر LineItem باید یک قیمت داشته باشد، حتی اگر قیمت آن "0" باشد. وقتی نوع DISCOUNT است، مقدار را به صورت منفی مشخص کنید (به عنوان مثال، "-2"). | |
subLines | فهرست < SublineNote > | اختیاری است و فقط در صورتی معتبر است که نوع "قانونی" باشد. ممکن است در این قسمت در درخواست تسویهحساب و درخواست ارسال سفارش، یک یادداشت خاص از کاربر ارسال شود. اطمینان حاصل کنید که تاجر یادداشت را هنگام ارائه آن دریافت می کند. در درخواست به صورت subLines[0].note خواهد بود، که تنها مقدار ارائه شده در این فیلد زمانی است که در یک درخواست وجود دارد. نباید بیش از 1 مورد داشته باشد. | |
offerId | رشته | زمانی که شناسه پیشنهاد MenuItem برای مورد. برای ProposedOrder.otherItems قابل اجرا نیست. | |
extension | FoodItemExtension | افزودنی هایی را برای مواد غذایی تعریف می کند. |
مثال زیر یک عنصر LineItem
را نشان می دهد:
مثال 1
{ "name": "New customer discount", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "-5", "nanos": -500000000 } }, "type": "DISCOUNT" }
مثال 2
{ "name": "Pita Chips", "type": "REGULAR", "id": "sample_item_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/offer/id1", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "2", "nanos": 750000000 } }, "subLines": [ { "note": "Notes for this item." } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension", "options": [ { "id": "sample_addon_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id1", "name": "Honey Mustard", "price": { "currencyCode": "USD" }, "quantity": 1 }, { "id": "sample_addon_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id2", "name": "BBQ Sauce", "price": { "currencyCode": "USD", "nanos": 500000000 }, "quantity": 1 } ] } }
LineItemType
نوع LineItemType
دارای مقادیر ممکن زیر است:
-
REGULAR
: کالای خط کالا. قابل استفاده برای Cart.lineItems. -
TAX
: آیتم ردیف مالیاتی. قابل اجرا برای ProposedOrder.otherItems. -
DISCOUNT
: مورد خط تخفیف. توجه داشته باشید که قیمت باید منفی باشد. قابل اجرا برای ProposedOrder.otherItems. -
GRATUITY
: مورد خط Gratuity. به طور کلی برای SubmitOrderRequestMessage برای یک نکته انتخاب شده توسط کاربر محفوظ است. قابل اجرا برای ProposedOrder.otherItems. -
DELIVERY
: کالای خط تحویل. قابل اجرا برای ProposedOrder.otherItems. -
SUBTOTAL
: مورد خط فرعی. قابل اجرا برای ProposedOrder.otherItems. -
FEE
: مورد خط اضافی که توسط انواع دیگر پوشش داده نمی شود. قابل اجرا برای ProposedOrder.otherItems.
محل
آدرسی را برای سفارش غذا مشخص می کند. نوعLocation
در Cart
فقط برای نشان دادن مقصد سفارش تحویل استفاده می شود. اگر کاربر سفارش را انجام دهد، مکان نهایی شده نیز در TransactionDecisionValue
وجود دارد. برای سفارش هایی که پیکاپ را مشخص می کنند، مکان به هیچ وجه درج نمی شود (حتی یک مکان خالی). جدول زیر ویژگی های نوع Location
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
coordinates | Coordinates | ||
formattedAddress | رشته | نمایش آدرس محل مثال: | |
postalAddress | PostalAddress | ||
zipCode | رشته | مثال: | |
city | رشته | نام شهر. مثال: | |
notes | رشته | نکاتی درباره مکان، مانند کدهای دروازه. باید 500 کاراکتر یا کمتر باشد. مثال: |
مثال زیر یک عنصر Location
را نشان می دهد:
مثال
{ "coordinates": { "latitude": 37.788783, "longitude": -122.41384 }, "formattedAddress": "1350 CHARLESTON ROAD, MOUNTAIN VIEW, CA, United States", "zipCode": "94043", "city": "Mountain View", "postalAddress": { "regionCode": "US", "postalCode": "94043", "administrativeArea": "CA", "locality": "Mountain View", "addressLines": [ "1350 Charleston Road" ] }, "notes": "Gate code is #111" }
بازرگان
جدول زیر ویژگی های نوع Merchant
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
id | رشته | شناسه تاجر اگر مشخص شده باشد، با ID Restaurant.@ در فید رستوران مطابقت دارد. مثال: | |
name | رشته | ضروری. نام تجاری قابل مشاهده توسط کاربر. مثال: |
مثال زیر یک عنصر Merchant
را نشان می دهد:
مثال
{ "id": "https://www.exampleprovider.com/merchant/id1", "name": "Falafel Bite" }
پول
جدول زیر ویژگی های نوع Money
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
currencyCode | رشته | ضروری. یک کد ارز 3 حرفی در قالب ISO 4217. مثال: | |
units | رشته | کل واحدهای مقدار. به عنوان مثال، اگر کد ارز "USD" باشد، واحد "1" یک دلار آمریکا است. مثال: | |
nanos | عدد صحیح | تعداد نانو (10^-9) واحد مقدار. مقدار باید بین -999,999,999 و +999,999,999 باشد. از قوانین زیر استفاده کنید: اگر واحدها مثبت باشد، نانو باید مثبت یا صفر باشد. اگر واحدها صفر باشد، نانو می تواند مثبت، صفر یا منفی باشد. اگر واحدها منفی باشد، نانو باید منفی یا صفر باشد. به عنوان مثال -1.75 دلار به صورت واحد = -1 و نانو = -750,000,000 نشان داده می شود. مثال: |
مثال زیر یک عنصر Money
را نشان می دهد:
مثال 1
{ "currencyCode": "USD", "units": "36", "nanos": 730000000 }
مثال 2
{ "currencyCode": "EUR", "units": "10" }
سفارش
شامل سفارش نهایی، از جمله مالیات، کارمزد، و هزینه های تحویل، و همچنین اطلاعات پرداخت است. این شی با عمل شما در یکSubmit AppRequest
دریافت می شود. جدول زیر ویژگی های نوع Order
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
finalOrder | ProposedOrder | ضروری. دستور پیشنهادی که باعث دستور شد. | |
googleOrderId | رشته | ضروری. شناسه سفارش اختصاص داده شده توسط Google. این شناسه باید برای کل چرخه عمر یک سفارش پایدار باشد. این شناسه برای کاربر نهایی قابل مشاهده نیست. | |
orderDate | مهر زمانی ISO | ضروری. تاریخ و زمان ایجاد سفارش | |
paymentInfo | PaymentInfo | ضروری. اطلاعات پرداخت مربوط به پرداخت این سفارش. |
مثال زیر یک عنصر Order
را نشان می دهد:
مثال
{ "finalOrder": { "cart": { "notes": "Guest prefers their food to be hot when it is delivered.", "merchant": { "id": "https://www.exampleprovider.com/merchant/id1", "name": "Cucina Venti" }, "lineItems": [ { "name": "Sizzling Prawns Dinner", "type": "REGULAR", "id": "sample_item_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/offer/id1", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "16", "nanos": 750000000 } }, "subLines": [ { "note": "Notes for this item." } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension", "options": [ { "id": "sample_addon_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id1", "name": "Honey Mustard", "price": { "currencyCode": "USD" }, "quantity": 1 }, { "id": "sample_addon_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id2", "name": "BBQ Sauce", "price": { "currencyCode": "USD", "nanos": 500000000 }, "quantity": 1 } ] } } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodCartExtension", "fulfillmentPreference": { "fulfillmentInfo": { "pickup": { "pickupTimeIso8601": "P0M" } } }, "contact": { "displayName": "Lovefood Ordering", "email": "ilovefood@example.com", "phoneNumber": "+16501234567" } } }, "otherItems": [ { "name": "Service fee", "type": "FEE", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "3", "nanos": 500000000 } } }, { "name": "Tax", "type": "TAX", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "1", "nanos": 370000000 } } }, { "name": "Tip", "type": "GRATUITY", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "2", "nanos": 590000000 } } } ], "totalPrice": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "23", "nanos": 710000000 } }, "id": "sample_final_order_id", "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderExtension", "availableFulfillmentOptions": [ { "fulfillmentInfo": { "pickup": { "pickupTimeIso8601": "P0M" } }, "expiresAt": "2017-07-17T12:30:00Z" } ], "optinForRemarketing": true } }, "googleOrderId": "sample_google_order_id", "orderDate": "2017-07-17T12:00:00Z", "paymentInfo": { "displayName": "Visa\u2006****\u20061111", "googleProvidedPaymentInstrument": { "instrumentToken": "abcd" }, "paymentType": "PAYMENT_CARD" } }
سفارش به روز رسانی
جدول زیر فیلدهایی از نوع OrderUpdate را که درAppResponse
گنجانده شده است، توضیح می دهد. جدول زیر ویژگی های نوع OrderUpdate
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
actionOrderId | رشته | ضروری. شناسه منحصربهفرد سفارش در سیستم یکپارچهساز که برای شناسایی سفارش ارسال بهروزرسانی استفاده میشود. اگر receipt.user_visible_order_id حداقل یک بار در OrderUpdate برای سفارش "ایجاد شده" ارائه نشده باشد، این شناسه شناسه قابل مشاهده کاربر ورودی خواهد بود که در کارت سفارش Google نمایش داده می شود. | |
orderState | OrderState | ضروری. وضعیت جدید دستور. | |
lineItemUpdates | Map<String, LineItemUpdate > | ||
updateTime | مهر زمانی ISO | ضروری. زمانی که سفارش به روز شد. | |
orderManagementActions | فهرست < OrderManagementAction > | اقدامات پس از سفارش مانند تماس با پشتیبانی و مشاهده جزئیات سفارش. نباید کمتر از 1 مورد و بیش از 6 مورد داشته باشد. | |
rejectionInfo | RejectionInfo | زمانی که | |
cancellationInfo | CancellationInfo | زمانی که | |
inTransitInfo | InTransitInfo | این فیلد منسوخ شده است. | |
fulfillmentInfo | FulfillmentInfo | این فیلد منسوخ شده است. | |
receipt | Receipt | زمانی که شناسه سفارش قابل مشاهده توسط کاربر را در رسید ارائه دهید. | |
totalPrice | Price | قیمت کل سفارش | |
infoExtension | FoodOrderUpdateExtension | جزئیات بیشتری از بهروزرسانی سفارش، مانند فاصله زمانی تخمینی تحویل یا تحویل را تعریف میکند. |
مثال زیر یک عنصر OrderUpdate
را نشان می دهد:
مثال
{ "actionOrderId": "sample_action_order_id", "orderState": { "state": "CONFIRMED", "label": "Provider confirmed" }, "totalPrice": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "41", "nanos": 600000000 } }, "lineItemUpdates": { "sample_item_id_1": { "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "3", "nanos": 500000000 } }, "reason": "This item has an updated price." } }, "receipt": { "userVisibleOrderId": "userVisibleId1234" }, "updateTime": "2017-07-17T12:00:00Z", "orderManagementActions": [ { "type": "CUSTOMER_SERVICE", "button": { "title": "Contact customer service", "openUrlAction": { "url": "mailto:support@example.com" } } }, { "type": "EMAIL", "button": { "title": "Email restaurant", "openUrlAction": { "url": "mailto:person@example.com" } } }, { "type": "CALL_RESTAURANT", "button": { "title": "Call restaurant", "openUrlAction": { "url": "tel:+16505554679" } } } ], "infoExtension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "estimatedFulfillmentTimeIso8601": "2017-07-17T13:00:00Z/2017-07-17T13:30:00Z" } }
اطلاعات پیکاپ
جدول زیر ویژگی های نوع PickupInfo
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
pickupTimeIso8601 | رشته | زمان تخمینی تحویل، در قالب مهر زمانی ISO 8601: "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" یا قالب مدت زمان: "P( n)Y(n)M(n)DT(n)H(n)M(n)S". به عنوان مثال، PT90M مدت زمان 90 دقیقه را نشان می دهد. مقدار پیشفرض "PT0M" نشان میدهد که زمان ترجیحی تحویل در اسرع وقت است. مرجع: https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations. از این برای بهروزرسانی زمان تخمینی تحویل در حین پاسخ پرداخت استفاده کنید. مثال: |
مثال زیر یک عنصر PickupInfo
را نشان می دهد:
مثال
{ "pickupTimeIso8601": "PT90M" }
آدرس پستی
جدول زیر ویژگی های نوع PostalAddress
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
regionCode | رشته | ضروری. کد کشور دو حرفی مثال: | |
postalCode | رشته | کد پستی. مثال: | |
administrativeArea | رشته | بالاترین بخش اداری که برای آدرس های پستی یک کشور یا منطقه استفاده می شود. این می تواند یک ایالت، یک استان، یک استان یا یک استان باشد. مثال: | |
locality | رشته | شهر یا شهر برای این مکان. در مناطقی از جهان که محلی ها به خوبی تعریف نشده اند یا با این ساختار مطابقت ندارند، محلی را مشخص نکنید و به جای آن از فیلد addressLines استفاده کنید. مثال: | |
addressLines | فهرست <رشته> | یک یا چند خط که می توانید برای مشخص کردن آدرس خیابان استفاده کنید. این فیلد نباید اصلاح شود زیرا میتواند حاوی مکانهای نامشخص باشد. مثال: | |
recipients | فهرست <رشته> | لیست دریافت کنندگان سفارش این فیلد فقط در billingAddress موجود است. |
مثال زیر یک عنصر PostalAddress
را نشان می دهد:
مثال
{ "regionCode": "US", "postalCode": "94043", "administrativeArea": "CA", "locality": "Mountain View", "addressLines": [ "1350 Charleston Road" ] }
قیمت
جدول زیر ویژگی های نوع Price
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
type | Enum [ "ESTIMATE", "ACTUAL" ] | ضروری. کد کوپن تبلیغاتی | |
amount | Money | ضروری. |
ترویج
جدول زیر ویژگی های نوع Promotion
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
coupon | رشته | ضروری. کد کوپن تبلیغاتی |
سفارش پیشنهادی
جدول زیر ویژگی های نوع ProposedOrder
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
id | رشته | شناسه اختیاری برای سفارش پیشنهادی. | |
cart | Cart | ضروری. آیتم های کاربر | |
otherItems | فهرست < LineItem > | موارد اضافه شده توسط ارائه دهنده، مانند هزینه های تحویل، سایر هزینه ها، و مالیات. موارد دیگر نیز ممکن است شامل انعام و/یا تخفیف اضافه شده توسط کاربر باشد. نباید بیش از 10 مورد داشته باشد. | |
image | Image | تصویر مرتبط با سفارش پیشنهادی | |
totalPrice | Price | ضروری. قیمت کل سفارش پیشنهادی | |
extension | FoodOrderExtension | ضروری. اطلاعات تکمیلی را برای سفارشات غذا تعریف می کند. | |
disclaimers | فهرست< Disclaimer > | مربوط به پیام های سلب مسئولیت است که قبل از ثبت سفارش در UI نشان داده می شود. |
مثال زیر یک عنصر ProposedOrder
را نشان می دهد:
مثال
{ "id": "sample_proposed_order_id_1", "otherItems": [ { "name": "New customer discount", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "-5", "nanos": -500000000 } }, "type": "DISCOUNT" }, { "name": "Delivery fee", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "3", "nanos": 500000000 } }, "type": "DELIVERY" }, { "name": "Tax", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "1", "nanos": 500000000 } }, "type": "TAX" } ], "cart": { "merchant": { "id": "https://www.exampleprovider.com/merchant/id1", "name": "Falafel Bite" }, "lineItems": [ { "name": "Pita Chips", "type": "REGULAR", "id": "sample_item_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/offer/id1", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "2", "nanos": 750000000 } }, "subLines": [ { "note": "Notes for this item." } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension", "options": [ { "id": "sample_addon_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id1", "name": "Honey Mustard", "price": { "currencyCode": "USD" }, "quantity": 1 }, { "id": "sample_addon_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id2", "name": "BBQ Sauce", "price": { "currencyCode": "USD", "nanos": 500000000 }, "quantity": 1 } ] } }, { "name": "Chicken Shwarma Wrap", "type": "REGULAR", "id": "sample_item_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/offer/id2", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "8" } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" } }, { "name": "Greek Salad", "type": "REGULAR", "id": "sample_item_offer_id_3", "offerId": "https://www.exampleprovider.com/menu/item/offer/id3", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "9", "nanos": 990000000 } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" } }, { "name": "Prawns Biryani", "type": "REGULAR", "id": "sample_item_offer_id_4", "offerId": "https://www.exampleprovider.com/menu/item/offer/id4", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "15", "nanos": 990000000 } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" } } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodCartExtension", "fulfillmentPreference": { "fulfillmentInfo": { "delivery": { "deliveryTimeIso8601": "P90M" } } }, "location": { "coordinates": { "latitude": 37.788783, "longitude": -122.41384 }, "formattedAddress": "1350 CHARLESTON ROAD, MOUNTAIN VIEW, CA, United States", "zipCode": "94043", "city": "Mountain View", "postalAddress": { "regionCode": "US", "postalCode": "94043", "administrativeArea": "CA", "locality": "Mountain View", "addressLines": [ "1350 Charleston Road" ] }, "notes": "Gate code is #111" } } }, "totalPrice": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "36", "nanos": 730000000 } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderExtension", "availableFulfillmentOptions": [ { "fulfillmentInfo": { "delivery": { "deliveryTimeIso8601": "P0M" } }, "expiresAt": "2017-07-17T12:30:00Z" } ] } }
Subline Note
جدول زیر ویژگی های نوع SublineNote
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
note | رشته | ضروری. |
مهر زمان
تاریخ و"{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
TransactionDecisionValue
شاملOrder
است. جدول زیر ویژگی های نوع TransactionDecisionValue
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
order | Order | ضروری. سفارش با جزئیات پرداخت قرار داده شود. |
مثال زیر یک عنصر TransactionDecisionValue
را نشان می دهد:
مثال
{ "order": { "finalOrder": { "cart": { "notes": "Guest prefers their food to be hot when it is delivered.", "merchant": { "id": "https://www.exampleprovider.com/merchant/id1", "name": "Cucina Venti" }, "lineItems": [ { "name": "Sizzling Prawns Dinner", "type": "REGULAR", "id": "sample_item_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/offer/id1", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "16", "nanos": 750000000 } }, "subLines": [ { "note": "Notes for this item." } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension", "options": [ { "id": "sample_addon_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id1", "name": "Honey Mustard", "price": { "currencyCode": "USD" }, "quantity": 1 }, { "id": "sample_addon_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id2", "name": "BBQ Sauce", "price": { "currencyCode": "USD", "nanos": 500000000 }, "quantity": 1 } ] } } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodCartExtension", "fulfillmentPreference": { "fulfillmentInfo": { "pickup": { "pickupTimeIso8601": "P0M" } } }, "contact": { "displayName": "Lovefood Ordering", "email": "ilovefood@example.com", "phoneNumber": "+16501234567" } } }, "otherItems": [ { "name": "Service fee", "type": "FEE", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "3", "nanos": 500000000 } } }, { "name": "Tax", "type": "TAX", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "1", "nanos": 370000000 } } }, { "name": "Tip", "type": "GRATUITY", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "2", "nanos": 590000000 } } } ], "totalPrice": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "23", "nanos": 710000000 } }, "id": "sample_final_order_id", "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderExtension", "availableFulfillmentOptions": [ { "fulfillmentInfo": { "pickup": { "pickupTimeIso8601": "P0M" } }, "expiresAt": "2017-07-17T12:30:00Z" } ], "optinForRemarketing": true } }, "googleOrderId": "sample_google_order_id", "orderDate": "2017-07-17T12:00:00Z", "paymentInfo": { "displayName": "Visa\u2006****\u20061111", "googleProvidedPaymentInstrument": { "instrumentToken": "abcd" }, "paymentType": "PAYMENT_CARD" } } }
درخواست برآورده شدن
AppRequest
جدول زیر ویژگی های نوع AppRequest
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
isInSandbox | بولی | نشان می دهد که آیا تراکنش های بعدی در محیط sandbox انجام می شود یا خیر. | |
conversation | Conversation | ||
inputs | فهرست < Input > | ضروری. حاوی آرگومان های مورد انتظار برای بررسی یک سبد خرید است. باید دقیقا 1 مورد داشته باشد. |
مثال زیر یک عنصر AppRequest
را نشان می دهد:
مثال 1
{ "isInSandbox": true, "inputs": [ { "intent": "actions.foodordering.intent.CHECKOUT", "arguments": [ { "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.Cart", "merchant": { "id": "https://www.exampleprovider.com/merchant/id1", "name": "Cucina Venti" }, "lineItems": [ { "name": "Sizzling Prawns Dinner", "type": "REGULAR", "id": "sample_item_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/offer/id1", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "16", "nanos": 750000000 } }, "subLines": [ { "note": "Notes for this item." } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension", "options": [ { "id": "sample_addon_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id1", "name": "Honey Mustard", "price": { "currencyCode": "USD" }, "quantity": 1 }, { "id": "sample_addon_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id2", "name": "BBQ Sauce", "price": { "currencyCode": "USD", "nanos": 500000000 }, "quantity": 1 } ] } } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodCartExtension", "fulfillmentPreference": { "fulfillmentInfo": { "delivery": { "deliveryTimeIso8601": "P0M" } } }, "location": { "coordinates": { "latitude": 37.788783, "longitude": -122.41384 }, "formattedAddress": "1350 CHARLESTON ROAD, MOUNTAIN VIEW, CA, United States", "zipCode": "94043", "city": "Mountain View", "postalAddress": { "regionCode": "US", "postalCode": "94043", "administrativeArea": "CA", "locality": "Mountain View", "addressLines": [ "1350 Charleston Road" ] }, "notes": "Gate code is #111" } } } } ] } ] }
مثال 2
{ "isInSandbox": true, "inputs": [ { "intent": "actions.intent.TRANSACTION_DECISION", "arguments": [ { "transactionDecisionValue": { "order": { "finalOrder": { "cart": { "notes": "Guest prefers their food to be hot when it is delivered.", "merchant": { "id": "https://www.exampleprovider.com/merchant/id1", "name": "Cucina Venti" }, "lineItems": [ { "name": "Sizzling Prawns Dinner", "type": "REGULAR", "id": "sample_item_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/offer/id1", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "16", "nanos": 750000000 } }, "subLines": [ { "note": "Notes for this item." } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension", "options": [ { "id": "sample_addon_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id1", "name": "Honey Mustard", "price": { "currencyCode": "USD" }, "quantity": 1 }, { "id": "sample_addon_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id2", "name": "BBQ Sauce", "price": { "currencyCode": "USD", "nanos": 500000000 }, "quantity": 1 } ] } } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodCartExtension", "fulfillmentPreference": { "fulfillmentInfo": { "pickup": { "pickupTimeIso8601": "P0M" } } }, "contact": { "displayName": "Lovefood Ordering", "email": "ilovefood@example.com", "phoneNumber": "+16501234567" } } }, "otherItems": [ { "name": "Service fee", "type": "FEE", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "3", "nanos": 500000000 } } }, { "name": "Tax", "type": "TAX", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "1", "nanos": 370000000 } } }, { "name": "Tip", "type": "GRATUITY", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "2", "nanos": 590000000 } } } ], "totalPrice": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "23", "nanos": 710000000 } }, "id": "sample_final_order_id", "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderExtension", "availableFulfillmentOptions": [ { "fulfillmentInfo": { "pickup": { "pickupTimeIso8601": "P0M" } }, "expiresAt": "2017-07-17T12:30:00Z" } ], "optinForRemarketing": true } }, "googleOrderId": "sample_google_order_id", "orderDate": "2017-07-17T12:00:00Z", "paymentInfo": { "displayName": "Visa\u2006****\u20061111", "googleProvidedPaymentInstrument": { "instrumentToken": "abcd" }, "paymentType": "PAYMENT_CARD" } } } } ] } ] }
CheckoutRequestMessage
یکCheckoutRequestMessage
یک AppRequest
با هدف actions.foodordering.intent.CHECKOUT
است.ارسال سفارش سفارش پیام
یکSubmitOrderRequestMessage
یک AppRequest
با هدف actions.foodordering.intent.TRANSACTION_DECISION
است.گفتگو
یکConversation
فقط برای یک جلسه منحصر به فرد است. در صورت نیاز میتوانید از آن برای پیوند دادن چندین Checkout
و SubmitOrder
Actions به یکدیگر استفاده کنید. جدول زیر ویژگی های نوع Conversation
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
conversationId | رشته | ضروری. شناسه منحصر به فرد برای مکالمه |
مثال زیر یک عنصر Conversation
را نشان می دهد:
مثال
{ "conversationId": "CQnJ7Z4i7UmvEZ9ph3AxyZRJ" }
ورودی
استدلال های مورد انتظار برای بررسی یک سبد خرید.
جدول زیر ویژگی های نوع Input
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
intent | Enum [ "actions.foodordering.intent.CHECKOUT", "actions.intent.TRANSACTION_DECISION" ] | ضروری. برای پیام درخواست تسویه حساب روی «actions.foodordering.intent.CHECKOUT» یا برای ارسال پیام درخواست سفارش «actions.intent.TRANSACTION_DECISION» تنظیم کنید. | |
arguments | فهرست < Argument > | ضروری. شامل سبد خریدی است که باید بررسی شود یا سفارشی که قرار است انجام شود باید دقیقا 1 مورد داشته باشد. |
بحث و جدل
حاوی جزئیاتی در مورد مواد غذایی است که کاربر می خواهد بررسی کند. برای پرداخت، فقط پسوند قابل اجرا است. برای ارسال سفارش، فقط tradeDecisionValue قابل اعمال است
جدول زیر ویژگی های نوع Argument
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
دقیقاً یکی از گروه های زیر از خواص مورد نیاز است. | |||
extension | گروه 1 | Cart | جزئیات مواد غذایی که کاربر میخواهد بررسی کند. |
transactionDecisionValue | گروه 2 | TransactionDecisionValue | شامل سفارشی که قرار است انجام شود به همراه جزئیات پرداخت. |
پاسخ تحقق
AppResponse
جدول زیر ویژگی های نوع AppResponse
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
expectUserResponse | Const | روی نادرست تنظیم کنید. مقدار: | |
finalResponse | FinalResponse | ضروری. حاوی پاسخ شما به پرداخت سبد خرید است. |
مثال زیر یک عنصر AppResponse
را نشان می دهد:
مثال 1
{ "expectUserResponse": false, "finalResponse": { "richResponse": { "items": [ { "structuredResponse": { "checkoutResponse": { "proposedOrder": { "id": "sample_proposed_order_id_1", "otherItems": [ { "name": "New customer discount", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "-5", "nanos": -500000000 } }, "type": "DISCOUNT" }, { "name": "Delivery fee", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "3", "nanos": 500000000 } }, "type": "DELIVERY" }, { "name": "Tax", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "1", "nanos": 500000000 } }, "type": "TAX" } ], "cart": { "merchant": { "id": "https://www.exampleprovider.com/merchant/id1", "name": "Falafel Bite" }, "lineItems": [ { "name": "Pita Chips", "type": "REGULAR", "id": "sample_item_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/offer/id1", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "2", "nanos": 750000000 } }, "subLines": [ { "note": "Notes for this item." } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension", "options": [ { "id": "sample_addon_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id1", "name": "Honey Mustard", "price": { "currencyCode": "USD" }, "quantity": 1 }, { "id": "sample_addon_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id2", "name": "BBQ Sauce", "price": { "currencyCode": "USD", "nanos": 500000000 }, "quantity": 1 } ] } }, { "name": "Chicken Shwarma Wrap", "type": "REGULAR", "id": "sample_item_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/offer/id2", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "8" } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" } }, { "name": "Greek Salad", "type": "REGULAR", "id": "sample_item_offer_id_3", "offerId": "https://www.exampleprovider.com/menu/item/offer/id3", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "9", "nanos": 990000000 } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" } }, { "name": "Prawns Biryani", "type": "REGULAR", "id": "sample_item_offer_id_4", "offerId": "https://www.exampleprovider.com/menu/item/offer/id4", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "15", "nanos": 990000000 } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" } } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodCartExtension", "fulfillmentPreference": { "fulfillmentInfo": { "delivery": { "deliveryTimeIso8601": "P90M" } } }, "location": { "coordinates": { "latitude": 37.788783, "longitude": -122.41384 }, "formattedAddress": "1350 CHARLESTON ROAD, MOUNTAIN VIEW, CA, United States", "zipCode": "94043", "city": "Mountain View", "postalAddress": { "regionCode": "US", "postalCode": "94043", "administrativeArea": "CA", "locality": "Mountain View", "addressLines": [ "1350 Charleston Road" ] }, "notes": "Gate code is #111" } } }, "totalPrice": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "36", "nanos": 730000000 } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderExtension", "availableFulfillmentOptions": [ { "fulfillmentInfo": { "delivery": { "deliveryTimeIso8601": "P0M" } }, "expiresAt": "2017-07-17T12:30:00Z" } ] } }, "paymentOptions": { "googleProvidedOptions": { "facilitationSpecification": "{\"apiVersion\": 2,\"apiVersionMinor\": 0,\"merchantInfo\": { \"merchantId\": \"Merchant ID\", \"merchantName\": \"Merchant Name\"},\"allowedPaymentMethods\": [ { \"type\": \"CARD\", \"parameters\": { \"allowedAuthMethods\": [ \"PAN_ONLY\" ], \"allowedCardNetworks\": [ \"VISA\", \"AMEX\", \"MASTERCARD\" ], \"billingAddressRequired\": false }, \"tokenizationSpecification\": { \"type\": \"PAYMENT_GATEWAY\", \"parameters\": { \"stripe:publishableKey\": \"pk_test_OoPcJNnxI1rDXhBq8BiXO2wz00s1Xc92dA\", \"gateway\": \"stripe\", \"stripe:version\": \"2019-05-16\" } } }],\"transactionInfo\": { \"currencyCode\": \"AUD\", \"totalPriceStatus\": \"ESTIMATED\", \"totalPrice\": \"1.0\"}}" } }, "additionalPaymentOptions": [ { "actionProvidedOptions": { "paymentType": "ON_FULFILLMENT", "displayName": "Cash on delivery." } } ] } } } ] } } }
مثال 2
{ "expectUserResponse": false, "finalResponse": { "richResponse": { "items": [ { "structuredResponse": { "orderUpdate": { "actionOrderId": "sample_action_order_id", "orderState": { "state": "CONFIRMED", "label": "Provider confirmed" }, "receipt": { "userVisibleOrderId": "userVisibleId1234" }, "updateTime": "2017-07-17T12:00:00Z", "orderManagementActions": [ { "type": "CUSTOMER_SERVICE", "button": { "title": "Contact customer service", "openUrlAction": { "url": "mailto:support@example.com" } } }, { "type": "CUSTOMER_SERVICE", "button": { "title": "Call customer service", "openUrlAction": { "url": "tel:+18005554679" } } }, { "type": "EMAIL", "button": { "title": "Email restaurant", "openUrlAction": { "url": "mailto:person@example.com" } } }, { "type": "CALL_RESTAURANT", "button": { "title": "Call restaurant", "openUrlAction": { "url": "tel:+16505554679" } } } ], "infoExtension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "estimatedFulfillmentTimeIso8601": "2017-07-17T13:00:00Z/2017-07-17T13:30:00Z" } } } } ] } } }
مثال 3
{ "expectUserResponse": false, "finalResponse": { "richResponse": { "items": [ { "structuredResponse": { "error": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension", "foodOrderErrors": [ { "error": "CLOSED", "description": "The restaurant is closed." } ] } } } ] } } }
مثال 4
{ "expectUserResponse": false, "finalResponse": { "richResponse": { "items": [ { "structuredResponse": { "checkoutResponse": { "proposedOrder": { "otherItems": [ { "name": "Delivery Fees", "subLines": [], "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "3", "nanos": 500000000 } }, "type": "DELIVERY" }, { "name": "Tax", "subLines": [], "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "1", "nanos": 370000000 } }, "type": "TAX" }, { "name": "Promotion", "subLines": [], "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "-5", "nanos": 0 } }, "id": "OWG_ACTIVE_CODE", "type": "DISCOUNT" } ], "cart": { "merchant": { "id": "https://www.exampleprovider.com/merchant/id1", "name": "Falafel Bite" }, "lineItems": [ { "name": "Pita Chips", "type": "REGULAR", "id": "sample_item_offer_id_1", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "2", "nanos": 750000000 } }, "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id1", "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" } } ], "promotions": [ { "coupon": "OWG_ACTIVE_CODE" } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodCartExtension", "fulfillmentPreference": { "fulfillmentInfo": { "pickup": { "pickupTimeIso8601": "P0M" } } } } }, "totalPrice": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "14", "nanos": 860000000 } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderExtension", "availableFulfillmentOptions": [ { "fulfillmentInfo": { "pickup": { "pickupTimeIso8601": "P0M" } }, "expiresAt": "2018-04-10T01:20:08.471Z" } ] } }, "paymentOptions": { "googleProvidedOptions": { "tokenizationParameters": { "tokenizationType": "PAYMENT_GATEWAY", "parameters": { "gateway": "stripe", "stripe:publishableKey": "pk_live_stripe_client_key", "stripe:version": "2017-04-06" } }, "supportedCardNetworks": [ "AMEX", "DISCOVER", "MASTERCARD", "VISA", "JCB" ], "prepaidCardDisallowed": true, "billingAddressRequired": true } } } } } ] } } }
CheckoutResponseMessage
CheckoutResponseMessage
یک AppResponse
با checkoutResponse
یا error
در StructuredResponse
است.SubmitOrderResponse Message
SubmitOrderResponseMessage
یک AppResponse
با orderUpdate
در StructuredResponse
است.پاسخ نهایی
پاسخ شما به پرداخت سبد خرید یا ارسال سفارش درخواست پیام.
جدول زیر ویژگی های نوع FinalResponse
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
richResponse | RichResponse | ضروری. شامل پاسخ شما به CheckoutRequestMessage یا SubmitOrderRequestMessage است. |
CheckoutResponse
جدول زیر ویژگی های نوع CheckoutResponse
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
proposedOrder | ProposedOrder | ضروری. سفارش پیشنهادی برای استفاده برای معامله. | |
paymentOptions | PaymentOptions | ضروری. گزینه پرداخت پیش فرض برای کاربر انتخاب شده است. | |
additionalPaymentOptions | فهرست < PaymentOptions > | گزینه های پرداخت جایگزین در دسترس کاربر است. |
مثال زیر یک عنصر CheckoutResponse
را نشان می دهد:
مثال
{ "proposedOrder": { "id": "sample_proposed_order_id_1", "otherItems": [ { "name": "New customer discount", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "-5", "nanos": -500000000 } }, "type": "DISCOUNT" }, { "name": "Delivery fee", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "3", "nanos": 500000000 } }, "type": "DELIVERY" }, { "name": "Tax", "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "1", "nanos": 500000000 } }, "type": "TAX" } ], "cart": { "merchant": { "id": "https://www.exampleprovider.com/merchant/id1", "name": "Falafel Bite" }, "lineItems": [ { "name": "Pita Chips", "type": "REGULAR", "id": "sample_item_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/offer/id1", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "2", "nanos": 750000000 } }, "subLines": [ { "note": "Notes for this item." } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension", "options": [ { "id": "sample_addon_offer_id_1", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id1", "name": "Honey Mustard", "price": { "currencyCode": "USD" }, "quantity": 1 }, { "id": "sample_addon_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/addon/offer/id2", "name": "BBQ Sauce", "price": { "currencyCode": "USD", "nanos": 500000000 }, "quantity": 1 } ] } }, { "name": "Chicken Shwarma Wrap", "type": "REGULAR", "id": "sample_item_offer_id_2", "offerId": "https://www.exampleprovider.com/menu/item/offer/id2", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "8" } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" } }, { "name": "Greek Salad", "type": "REGULAR", "id": "sample_item_offer_id_3", "offerId": "https://www.exampleprovider.com/menu/item/offer/id3", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "9", "nanos": 990000000 } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" } }, { "name": "Prawns Biryani", "type": "REGULAR", "id": "sample_item_offer_id_4", "offerId": "https://www.exampleprovider.com/menu/item/offer/id4", "quantity": 1, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "15", "nanos": 990000000 } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodItemExtension" } } ], "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodCartExtension", "fulfillmentPreference": { "fulfillmentInfo": { "delivery": { "deliveryTimeIso8601": "P90M" } } }, "location": { "coordinates": { "latitude": 37.788783, "longitude": -122.41384 }, "formattedAddress": "1350 CHARLESTON ROAD, MOUNTAIN VIEW, CA, United States", "zipCode": "94043", "city": "Mountain View", "postalAddress": { "regionCode": "US", "postalCode": "94043", "administrativeArea": "CA", "locality": "Mountain View", "addressLines": [ "1350 Charleston Road" ] }, "notes": "Gate code is #111" } } }, "totalPrice": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "36", "nanos": 730000000 } }, "extension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderExtension", "availableFulfillmentOptions": [ { "fulfillmentInfo": { "delivery": { "deliveryTimeIso8601": "P0M" } }, "expiresAt": "2017-07-17T12:30:00Z" } ] } }, "paymentOptions": { "googleProvidedOptions": { "facilitationSpecification": "{\"apiVersion\": 2,\"apiVersionMinor\": 0,\"merchantInfo\": { \"merchantId\": \"Merchant ID\", \"merchantName\": \"Merchant Name\"},\"allowedPaymentMethods\": [ { \"type\": \"CARD\", \"parameters\": { \"allowedAuthMethods\": [ \"PAN_ONLY\" ], \"allowedCardNetworks\": [ \"VISA\", \"AMEX\", \"MASTERCARD\" ], \"billingAddressRequired\": false }, \"tokenizationSpecification\": { \"type\": \"PAYMENT_GATEWAY\", \"parameters\": { \"stripe:publishableKey\": \"pk_test_OoPcJNnxI1rDXhBq8BiXO2wz00s1Xc92dA\", \"gateway\": \"stripe\", \"stripe:version\": \"2019-05-16\" } } }],\"transactionInfo\": { \"currencyCode\": \"AUD\", \"totalPriceStatus\": \"ESTIMATED\", \"totalPrice\": \"1.0\"}}" } }, "additionalPaymentOptions": [ { "actionProvidedOptions": { "paymentType": "ON_FULFILLMENT", "displayName": "Cash on delivery." } } ] }
مورد
شامل پاسخ شما به پرداخت سبد خرید یا ارسال سفارش درخواست پیام است.
جدول زیر ویژگی های نوع Item
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
structuredResponse | StructuredResponse | ضروری. |
RichResponse
حاوی پاسخ شما به پرداخت سبد خرید است.
جدول زیر ویژگی های نوع RichResponse
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
items | فهرست< Item > | ضروری. باید دقیقا 1 مورد داشته باشد. |
Structured Response
برای CheckoutResponseMessage، این می تواند یکی از موارد زیر باشد: CheckoutResponse نشان دهنده پرداخت موفقیت آمیز است. OR FoodErrorExtension: نشان دهنده خرابی در حین پرداخت است. پاسخ می تواند شامل یک سفارش پیشنهادی و گزینه های پرداخت تصحیح شده یا یک پیام خطا بدون گزینه های پرداخت باشد. برای SubmitOrderResponseMessage، فقط orderUpdate قابل اعمال است.
جدول زیر ویژگی های نوع StructuredResponse
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
دقیقاً یکی از گروه های زیر از خواص مورد نیاز است. | |||
checkoutResponse | گروه 1 | CheckoutResponse | بررسی اقلام به اضافه مالیات و تخفیف. |
error | گروه 2 | FoodErrorExtension | خطاهای مشاهده شده در اقلام سبد خرید بسته به ماهیت خطا، این ویژگی میتواند شامل یک پیشنهاد سفارش و گزینههای پرداخت تصحیح شده یا فقط یک پیام خطا بدون گزینههای پرداخت باشد. |
orderUpdate | گروه 3 | OrderUpdate |
به روز رسانی سفارش ناهمزمان
این بخش انواع سطح بالایی را که درخواستها و پاسخهای یک تعامل داخلی سفارش غذای معمولی را تشکیل میدهند، توصیف میکند.AsyncOrderUpdateRequestMessage
پس از ارسال و تایید سفارش، تغییرات را به کاربر اطلاع می دهد. به عنوان مثال، می توانید به کاربر اطلاع دهید که سفارش در حال انتقال است یا اگر قیمت تغییر کرده است. برای اطلاعات بیشتر ببین جدول زیر ویژگی های نوع AsyncOrderUpdateRequestMessage
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
isInSandbox | بولی | نشان میدهد که سفارشی که این بهروزرسانی برای آن ارسال شده است، پرداخت سندباکس است. | |
customPushMessage | CustomPushMessage | ضروری. حاوی OrderUpdate برای درخواست است. |
مثال زیر یک عنصر AsyncOrderUpdateRequestMessage
را نشان می دهد:
مثال
{ "isInSandbox": true, "customPushMessage": { "orderUpdate": { "actionOrderId": "sample_action_order_id", "orderState": { "state": "IN_TRANSIT", "label": "Order is on the way" }, "inTransitInfo": { "updatedTime": "2017-07-17T12:00:00Z" }, "updateTime": "2017-07-17T12:00:00Z", "receipt": { "userVisibleOrderId": "userVisibleId1234" }, "orderManagementActions": [ { "type": "CUSTOMER_SERVICE", "button": { "title": "Contact customer service", "openUrlAction": { "url": "mailto:support@example.com" } } }, { "type": "EMAIL", "button": { "title": "Email restaurant", "openUrlAction": { "url": "mailto:person@example.com" } } }, { "type": "CALL_RESTAURANT", "button": { "title": "Call restaurant", "openUrlAction": { "url": "tel:+16505554679" } } } ], "infoExtension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "estimatedFulfillmentTimeIso8601": "2017-07-17T13:00:00Z/2017-07-17T13:30:00Z" } } } }
AsyncOrderUpdateResponseMessage
پس از ارسال موفقیت آمیزAsyncOrderUpdateRequestMessage
، Google با وضعیت HTTP 200 و بدنه خالی پاسخ می دهد. اگر بهروزرسانی ناموفق بود، Google با جزئیات درباره علت شکست سفارش بهروزرسانی پاسخ میدهد.سفارش انواع به روز رسانی
دکمه
یک عنصر رابط کاربری را تعریف می کند که می توانید برای ارائه تعامل کاربر اضافه کنید.
جدول زیر ویژگی های نوع Button
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
title | رشته | ضروری. برچسب نمایشگر از حروف جمله با 30 کاراکتر یا کمتر برای اطمینان از رندر مناسب استفاده کنید. مثال: | |
openUrlAction | OpenUrlAction | ضروری. |
مثال زیر یک عنصر Button
را نشان می دهد:
مثال
{ "title": "Send us feedback", "openUrlAction": { "url": "mailto:person@example.com" } }
اطلاعات لغو
جدول زیر ویژگی های نوع CancellationInfo
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
reason | رشته | ضروری. دلیل متن قابل نمایش برای رد زمانی که OrderState.state "لغو" است. مثال: |
مثال زیر یک عنصر CancellationInfo
را نشان می دهد:
مثال
{ "reason": "Insufficient inventory" }
FoodOrderUpdateExtension
این نوع یک فاصله زمانی تخمینی برای تحویل سفارش یا آماده شدن برای تحویل به کاربر ارائه می دهد. هر زمان که اطلاعات موجود است یا از آخرین ارسال تغییر کرده است، این برنامه افزودنی را در OrderUpdate
ارسال کنید.
یک تخمین محافظه کارانه برای فاصله تحقق ارائه دهید تا انتظارات کاربر به طور مداوم برآورده شود. برای مثال، اگر تخمین زده میشود که سفارش امروز ساعت 13:00 تحویل داده شود، باید فاصله زمانی تخمینی را ارسال کنید که با تغییرات ناشی از شرایط ترافیکی مطابقت دارد، مانند امروز در ساعت 12:45 تا 13:15.
مدت زمان یا مهر زمانی ISO 8601 به معنای فاصله زمانی از updateTime
OrderUpdate
(در اصل "اکنون") تا updateTime
به اضافه duration
تفسیر می شود. از این قالب استفاده نکنید مگر اینکه "اکنون" در واقع یک انتظار معقول باشد.
یک بازه ISO 8601 به معنای فاصله زمانی شروع تا پایان بازه تفسیر می شود.
جدول زیر ویژگی های نوع FoodOrderUpdateExtension
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
@type | Const | نوع این پسوند این فیلد همیشه روی "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension" تنظیم می شود. مقدار: | |
estimatedFulfillmentTimeIso8601 | رشته | زمان تخمینی زمانی که سفارش تحویل داده می شود یا آماده تحویل است. رشته باید در قالب ISO 8601 باشد و باید با یک بازه به جای یک زمان ثابت منطبق باشد. قراردادهای قابل قبول عبارتند از: فواصل زمانی، مدت زمان، و تاریخ/زمان. این فیلد را می توان در SubmitOrderResponseMessage یا AsyncOrderUpdateRequestMessage ارسال کرد که اطلاعات در دسترس قرار گرفت یا تغییری رخ داد، مانند ورود زودهنگام یا تأخیر. مثال: | |
foodOrderErrors | فهرست < FoodOrderError > | خطاهای رخ داده پس از سفارش را شرح می دهد. یک خطا در هر سبد خرید یا هر مورد توصیه می شود. از FoodOrderUpdateExtension.FoodOrderErrors برای هر خطایی که توسط RejectionInfo پوشش داده نشده است استفاده کنید. نباید کمتر از 1 مورد داشته باشد. |
مثال زیر یک عنصر FoodOrderUpdateExtension
را نشان می دهد:
مثال 1
{ "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "estimatedFulfillmentTimeIso8601": "2017-07-17T13:00:00Z/2017-07-17T13:30:00Z" }
مثال 2
{ "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "foodOrderErrors": [ { "error": "NO_CAPACITY", "description": "Sorry, the restaurant cannot take your order right now." } ] }
اطلاعات تکمیلی
جدول زیر ویژگی های نوع FulfillmentInfo
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
دقیقاً یکی از گروه های زیر از خواص مورد نیاز است. | |||
deliveryTime | گروه 1 | مهر زمانی ISO | از تخمین زدهشدهFulfillmentTimeIso8601 در پیام FoodOrderingUpdateExtension استفاده کنید |
pickupTime | گروه 2 | مهر زمانی ISO | از تخمین زدهشدهFulfillmentTimeIso8601 در پیام FoodOrderingUpdateExtension استفاده کنید |
مثال زیر یک عنصر FulfillmentInfo
را نشان می دهد:
مثال 1
{ "deliveryTime": "2017-05-10T02:36:38.803Z" }
مثال 2
{ "pickupTime": "2019-12-26T07:24:27.803Z" }
InTransitInfo
جدول زیر ویژگی های نوع InTransitInfo
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
updatedTime | مهر زمانی ISO | از تخمین زدهشدهFulfillmentTimeIso8601 در پیام FoodOrderingUpdateExtension استفاده کنید |
مثال زیر یک عنصر InTransitInfo
را نشان می دهد:
مثال
{ "updatedTime": "2017-05-10T02:36:38.803Z" }
LineItemUpdate
جدول زیر ویژگی های نوع LineItemUpdate
را فهرست می کند:
ویژگی | تایپ کنید | شرح | |
---|---|---|---|
orderState | OrderState | ||
price | Price | ||
reason | رشته | دلیل تغییر. برای تغییرات قیمت مورد نیاز است. |
مثال زیر یک عنصر LineItemUpdate
را نشان می دهد:
مثال
{ "orderState": { "state": "CONFIRMED", "label": "Provider confirmed" }, "price": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "5", "nanos": 500000000 } }, "reason": "Menu updated prices." }
OpenUrlAction
The following table lists the properties for the OpenUrlAction
type:
Property | Type | شرح | |
---|---|---|---|
url | String | Required. The action triggered by clicking or touching the button. The list of applicable prefixes depends on orderManagementActionType. "EMAIL": The prefix must be "mailto". "CALL": The prefix must be "tel". "CUSTOMER_SERVICE": The prefix must be "mailto", "tel", "http", or "https". Example: |
OrderManagementAction
Order management enables users to get post-order support and should be sent in each OrderUpdate
within the submit order AppResponse
and each subsequent AsyncOrderUpdateRequestMessage
Order management actions sent for a particular order can vary based on the state.
For example, in the "CREATED" state, CUSTOMER_SERVICE
might reference your customer support telephone. Then, in the "CONFIRMED" state, CUSTOMER_SERVICE
can change to the restaurant's telephone if that becomes the best point of contact for the customer. Similarly, once the order is in the "FULFILLED" state, CUSTOMER_SERVICE
can reference your support email addresss.
The following table lists the properties for the OrderManagementAction
type:
Property | Type | شرح | |
---|---|---|---|
type | OrderManagementActionType | Required. | |
button | Button | Required. |
The following example shows a OrderManagementAction
element:
Example 1
{ "type": "CUSTOMER_SERVICE", "button": { "title": "Contact customer service", "openUrlAction": { "url": "mailto:support@example.com" } } }
Example 2
{ "type": "EMAIL", "button": { "title": "Email restaurant", "openUrlAction": { "url": "mailto:person@example.com" } } }
OrderManagementActionType
Defines types related toOrderManagementAction
. The OrderManagementActionType
type has the following possible values:
-
CUSTOMER_SERVICE
: Email and/or contact number of customer service to be shown on order confirmation page. This is required. openUrlAction.url prefix must be "mailto", "tel", "http", or "https". -
EMAIL
: Email action on order details page only. openUrlAction.url prefix must be "mailto". -
CALL_DRIVER
: Call action on order details page only. openUrlAction.url prefix must be "tel". -
CALL_RESTAURANT
: Call action on order details page only. openUrlAction.url prefix must be "tel".
OrderState
The current state of the order. Each state
value of OrderState
also corresponds to a purchase status on myaccount.google.com .
The following table lists the properties for the OrderState
type:
Property | Type | شرح | |
---|---|---|---|
state | OrderStateEnum | Required. | |
label | String | Required. The user-visible display string for the state. Use sentence case. Example: |
The following example shows a OrderState
element:
مثال
{ "state": "CONFIRMED", "label": "Provider confirmed" }
OrderStateEnum
Defines types related toOrderState
. The OrderStateEnum
type has the following possible values:
-
CREATED
: Order created by integrator and waiting for confirmation by provider. Corresponds to the "Ordered" purchase status. -
CONFIRMED
: Order confirmed by provider and is active. Corresponds to the "Accepted" purchase status. -
REJECTED
: Order rejected by integrator or provider. Corresponds to the "Declined" purchase status. -
CANCELLED
: User cancelled the order. Corresponds to the "Cancelled" purchase status. -
IN_PREPARATION
: Food is being prepared. Corresponds to the "Status unknown" purchase status. -
READY_FOR_PICKUP
: Food is ready for pickup. Corresponds to the "Ready for pickup" purchase status. -
IN_TRANSIT
: Order is being delivered. Corresponds to the "In progress" purchase status. -
FULFILLED
: User received what was ordered. Corresponds to the "Picked up" purchase status.
Receipt
Send this type in a submit orderAppResponse
, where OrderState
is "CONFIRMED", "FULFILLED", or "IN_TRANSIT". Send receipt at the time when the userVisibleOrderId
becomes available. You don't need to keep sending the receipt in subsequent updates. The following table lists the properties for the Receipt
type:
Property | Type | شرح | |
---|---|---|---|
userVisibleOrderId | String | Required. Required if the order is "CONFIRMED", "IN_TRANSIT", or "FULFILLED". This field is the single user-facing ID for this order (usually the restaurant's order ID), displayed in both the integrator's receipt and the Google order card. The user must be able to use this ID to reference their order for customer service with the provider and integrator. You only need to provide this ID one time in any given OrderUpdate. Until it is provided, the actionOrderId is the userVisibleOrderId. For example, you may not have a userVisibleOrderId until the order is confirmed by the restaurant. Once confirmed, you must then send an AsyncOrderUpdateRequestMessage with an OrderUpdate and a Receipt. |
The following example shows a Receipt
element:
مثال
{ "userVisibleOrderId": "userVisibleId1234" }
RejectionInfo
The following table lists the properties for the RejectionInfo
type:
Property | Type | شرح | |
---|---|---|---|
type | RejectionType | Required. | |
reason | String | Reason for the rejection used for internal logging. This field is not visible to users. |
The following example shows a RejectionInfo
element:
مثال
{ "type": "PAYMENT_DECLINED", "reason": "There is an issue with payment processing." }
RejectionType
The RejectionType
type has the following possible values:
-
INELIGIBLE
: User is not eligible due to policy or risk-related concerns. -
PAYMENT_DECLINED
: There is an issue with payment processing. -
UNAVAILABLE_SLOT
: The order cannot be fulfilled at the order ahead time specified by DeliveryInfo or PickupInfo. -
PROMO_NOT_APPLICABLE
: There is an issue with the promotion. -
UNKNOWN
: Any other reason.
Payment-related types
This section describes the payment-related types used for food ordering fulfillment.ActionProvidedPaymentOptions
Requirements for an action-provided payment method.
The following table lists the properties for the ActionProvidedPaymentOptions
type:
Property | Type | شرح | |
---|---|---|---|
paymentType | PaymentType | Required. | |
displayName | String | Required. Name of the payment instrument displayed on the receipt. Example: | |
onFulfillmentPaymentData | OnFulfillmentPaymentData | Additional data for the paymentType "ON_FULFILLMENT". For example, you can use this field to specify if cash or card are supported on fulfillment. |
The following example shows a ActionProvidedPaymentOptions
element:
مثال
{ "paymentType": "ON_FULFILLMENT", "displayName": "Pay when you get your food.", "onFulfillmentPaymentData": { "supportedPaymentOptions": [ "Cash", "Card" ] } }
AllowedAuthMethods
The AllowedAuthMethods
type has the following possible values:
-
PAN_ONLY
: Authentication method associated with payment cards stored on file with the user's Google Account. Returned payment data includes personal account number (PAN) with the expiration month and the expiration year.
AllowedCardNetworks
The AllowedCardNetworks
type has the following possible values:
-
AMEX
-
DISCOVER
-
INTERAC
-
JCB
-
MASTERCARD
-
VISA
BillingAddressParameters
This object allows you to set additional fields to be returned for a requested billing address.
The following table lists the properties for the BillingAddressParameters
type:
Property | Type | شرح | |
---|---|---|---|
format | String | Billing address format required to complete the transaction. MIN: Name, country code, and postal code. FULL: Name, street address, locality, region, country code, and postal code. |
The following example shows a BillingAddressParameters
element:
Example 1
{ "format": "MIN" }
Example 2
{ "format": "FULL" }
CardParameters
Use this object to configure your site's support for the Google Pay API.
The following table lists the properties for the CardParameters
type:
Property | Type | شرح | |
---|---|---|---|
allowedAuthMethods | List<Const> | Required. Fields supported to authenticate a card transaction. Must have no fewer than 1 item . | |
allowedCardNetworks | List< AllowedCardNetworks > | Required. One or more card networks that you support that are also supported by the Google Pay API. Must have no fewer than 1 item . | |
billingAddressRequired | Boolean | Set to true if you require a billing address. Only request a billing address if it's required to process the transaction. Additional data requests can increase friction in the checkout process and lead to lower conversion rates. | |
billingAddressParameters | BillingAddressParameters | The expected fields returned if billingAddressRequired is set to true. | |
cvcRequired | Boolean | Set to true if using TimesofMoney, false for all other payment processors. |
The following example shows a CardParameters
element:
Example 1
{ "allowedAuthMethods": [ "PAN_ONLY" ], "allowedCardNetworks": [ "AMEX", "DISCOVER" ], "billingAddressRequired": false, "cvcRequired": false }
Example 2
{ "allowedAuthMethods": [ "PAN_ONLY" ], "allowedCardNetworks": [ "AMEX", "DISCOVER" ], "billingAddressRequired": true, "billingAddressParameters": { "format": "MIN" }, "cvcRequired": false }
GoogleProvidedPaymentInstrument
The following table lists the properties for the GoogleProvidedPaymentInstrument
type:
Property | Type | شرح | |
---|---|---|---|
instrumentToken | String | Required. Base 64-encoded string containing the payment token for charging the user with a participating Google Pay processor, per the previously specified GoogleProvidedPaymentOptions. | |
billingAddress | PostalAddress | Billing address for the payment. |
The following example shows a GoogleProvidedPaymentInstrument
element:
مثال
{ "instrumentToken": "abcd", "billingAddress": { "regionCode": "US", "postalCode": "94043", "administrativeArea": "CA", "locality": "Mountain View", "addressLines": [ "1350 Charleston Road" ] } }
GoogleProvidedPaymentOptions
Requirements for Google-provided payment method.
The following table lists the properties for the GoogleProvidedPaymentOptions
type:
Property | Type | شرح | |
---|---|---|---|
facilitationSpecification | String | A PaymentDataRequest JSON as a string. Use this object to configure your site's support for the Google Pay API. | |
supportedCardNetworks | List< SupportedCardNetworks > | Use facilitationSpecification instead. Type of card networks supported by the agent. This field is deprecated. | |
prepaidCardDisallowed | Boolean | Use facilitationSpecification instead. Whether or not a prepaid card is allowed as a payment type. This field is deprecated. | |
billingAddressRequired | Boolean | Use facilitationSpecification instead. Whether or not a billing address is required. This field is deprecated. | |
tokenizationParameters | TokenizationParameters | This field is deprecated. |
The following example shows a GoogleProvidedPaymentOptions
element:
Example 1
{ "facilitationSpecification": "{\"apiVersion\": 2,\"apiVersionMinor\": 0,\"merchantInfo\": { \"merchantId\": \"Merchant ID\", \"merchantName\": \"Merchant Name\"},\"allowedPaymentMethods\": [ { \"type\": \"CARD\", \"parameters\": { \"allowedAuthMethods\": [ \"PAN_ONLY\" ], \"allowedCardNetworks\": [ \"VISA\", \"AMEX\", \"MASTERCARD\" ], \"billingAddressRequired\": false }, \"tokenizationSpecification\": { \"type\": \"PAYMENT_GATEWAY\", \"parameters\": { \"stripe:publishableKey\": \"pk_test_OoPcJNnxI1rDXhBq8BiXO2wz00s1Xc92dA\", \"gateway\": \"stripe\", \"stripe:version\": \"2019-05-16\" } } }],\"transactionInfo\": { \"currencyCode\": \"AUD\", \"totalPriceStatus\": \"ESTIMATED\", \"totalPrice\": \"1.0\"}}" }
Example 2
{ "tokenizationParameters": { "tokenizationType": "PAYMENT_GATEWAY", "parameters": { "gateway": "braintree", "braintree:apiVersion": "v1", "braintree:sdkVersion": "1.4.0", "braintree:merchantId": "a1b2c3d4e5", "braintree:clientKey": "production_braintree_client_key", "braintree:authorizationFingerprint": "same_as_client_key" } }, "supportedCardNetworks": [ "AMEX", "DISCOVER", "MASTERCARD", "JCB", "VISA" ], "prepaidCardDisallowed": true }
Example 3
{ "tokenizationParameters": { "tokenizationType": "PAYMENT_GATEWAY", "parameters": { "gateway": "stripe", "stripe:publishableKey": "pk_live_stripe_client_key", "stripe:version": "2017-04-06" } }, "supportedCardNetworks": [ "AMEX", "DISCOVER", "MASTERCARD", "VISA", "JCB" ], "prepaidCardDisallowed": true, "billingAddressRequired": true }
MerchantInfo
Use this object to configure your site's support for the Google Pay API.
The following table lists the properties for the MerchantInfo
type:
Property | Type | شرح | |
---|---|---|---|
merchantId | String | Google merchant identifier issued to you by Google Pay. | |
merchantName | String | Required. Merchant name encoded as UTF-8. Merchant name is rendered in the payment sheet. |
OnFulfillmentPaymentData
Use this object to send additional data for the PaymentType "ON_FULFILLMENT".
The following table lists the properties for the OnFulfillmentPaymentData
type:
Property | Type | شرح | |
---|---|---|---|
supportedPaymentOptions | List< PaymentOptionsEnums > | List of payment options available to the user at the time of order fulfillment. |
The following example shows a OnFulfillmentPaymentData
element:
مثال
{ "supportedPaymentOptions": [ "Cash", "Card" ] }
Parameters
Defines types related to TokenizationParameters
.
The following table lists the properties for the Parameters
type:
Property | Type | شرح | |
---|---|---|---|
gateway | String | Required. Example: | |
gatewayMerchantId | String | ||
[additionalKey: string] | String | Additional key-value pairs |
The following example shows a Parameters
element:
Example 1
{ "gatewayMerchantId": "90412491", "gateway": "olo" }
Example 2
{ "gateway": "braintree", "braintree:apiVersion": "v1", "braintree:sdkVersion": "1.4.0", "braintree:merchantId": "YOUR_MERCHANT_ID", "braintree:clientKey": "YOUR_BRAINTREE_SANDVOX_OR_PRODUCTION_KEY" }
PaymentDataRequest
Use this object to configure your site's support for the Google Pay API.
The following table lists the properties for the PaymentDataRequest
type:
Property | Type | شرح | |
---|---|---|---|
apiVersion | Const | Required. Major API version. Value: | |
apiVersionMinor | Const | Required. Minor API version. Value: | |
merchantInfo | MerchantInfo | Required. (Google Pay merchant ID) Information about the merchant that requests payment data. | |
allowedPaymentMethods | List< PaymentMethod > | Required. Specifies support for one or more payment methods supported by the Google Pay API. | |
transactionInfo | TransactionInfo | Required. Details about the authorization of the transaction based upon whether the user agrees to the transaction or not. This field includes total price and price status. |
The following example shows a PaymentDataRequest
element:
مثال
{ "apiVersion": 2, "apiVersionMinor": 0, "merchantInfo": { "merchantId": "10391231", "merchantName": "Burrito Town" }, "allowedPaymentMethods": [ { "type": "CARD", "parameters": { "allowedAuthMethods": [ "PAN_ONLY" ], "allowedCardNetworks": [ "VISA", "AMEX", "MASTERCARD" ], "billingAddressRequired": true, "billingAddressParameters": { "format": "FULL" }, "cvcRequired": false }, "tokenizationSpecification": { "type": "PAYMENT_GATEWAY", "parameters": { "gateway": "stripe", "stripe:version": "2019-05-16", "stripe:publishableKey": "pk_test_OoPcJNnxI1rDXhBq8BiXO2wz00s1Xc92dA" } } } ], "transactionInfo": { "currencyCode": "INR", "totalPriceStatus": "ESTIMATED", "totalPrice": "185.00" } }
PaymentInfo
Payment-related information for an order.
The following table lists the properties for the PaymentInfo
type:
Property | Type | شرح | |
---|---|---|---|
displayName | String | Required. User-visible name of the payment instrument to display on the receipt. | |
paymentType | PaymentType | Required. | |
googleProvidedPaymentInstrument | GoogleProvidedPaymentInstrument | Token that can be used by the action. Only specify this if you specified GoogleProvidedPaymentOptions as a payment option in the CheckoutResponseMessage. |
The following example shows a PaymentInfo
element:
Example 1
{ "displayName": "Visa\u2006****\u20061111", "googleProvidedPaymentInstrument": { "instrumentToken": "abcd" }, "paymentType": "PAYMENT_CARD" }
Example 2
{ "displayName": "Visa\u2006****\u20061111", "googleProvidedPaymentInstrument": { "instrumentToken": "abcd", "billingAddress": { "regionCode": "US", "postalCode": "94043", "administrativeArea": "CA", "locality": "Mountain View", "addressLines": [ "123 Random Street", "Unit ABC" ], "recipients": [ "sample_receipient" ] } }, "paymentType": "PAYMENT_CARD" }
PaymentMethod
Use this object to configure your site's support for the Google Pay API.
The following table lists the properties for the PaymentMethod
type:
Property | Type | شرح | |
---|---|---|---|
type | Const | Required. Short identifier for the supported payment method. Only CARD is currently supported. Value: | |
parameters | CardParameters | Required. Parameters required to configure the provided payment method type. | |
tokenizationSpecification | TokenizationSpecification | Required. Configure an account or decryption provider to receive payment information. This property is required for the CARD payment method. |
The following example shows a PaymentMethod
element:
مثال
{ "type": "CARD", "parameters": { "allowedAuthMethods": [ "PAN_ONLY" ], "allowedCardNetworks": [ "VISA", "AMEX", "MASTERCARD" ], "billingAddressRequired": false }, "tokenizationSpecification": { "type": "PAYMENT_GATEWAY", "parameters": { "gatewayMerchantId": "90412491", "gateway": "olo" } } }
PaymentOptions
The following table lists the properties for the PaymentOptions
type:
Property | Type | شرح | |
---|---|---|---|
Exactly one of the following groups of properties is required. | |||
googleProvidedOptions | Group 1 | GoogleProvidedPaymentOptions | Mutually exclusive with actionProvidedOptions. Use this for online payment using gPay. |
actionProvidedOptions | Group 2 | ActionProvidedPaymentOptions | Mutually exclusive with googleProvidedOptions. Use this for "cash on delivery" or "pay on fulfillment". |
The following example shows a PaymentOptions
element:
Example 1
{ "googleProvidedOptions": { "facilitationSpecification": "{\"apiVersion\": 2,\"apiVersionMinor\": 0,\"merchantInfo\": { \"merchantId\": \"Merchant ID\", \"merchantName\": \"Merchant Name\"},\"allowedPaymentMethods\": [ { \"type\": \"CARD\", \"parameters\": { \"allowedAuthMethods\": [ \"PAN_ONLY\" ], \"allowedCardNetworks\": [ \"VISA\", \"AMEX\", \"MASTERCARD\" ], \"billingAddressRequired\": false }, \"tokenizationSpecification\": { \"type\": \"PAYMENT_GATEWAY\", \"parameters\": { \"stripe:publishableKey\": \"pk_test_OoPcJNnxI1rDXhBq8BiXO2wz00s1Xc92dA\", \"gateway\": \"stripe\", \"stripe:version\": \"2019-05-16\" } } }],\"transactionInfo\": { \"currencyCode\": \"AUD\", \"totalPriceStatus\": \"ESTIMATED\", \"totalPrice\": \"1.0\"}}" } }
Example 2
{ "googleProvidedOptions": { "facilitationSpecification": "{\"apiVersion\": 2,\"apiVersionMinor\": 0,\"merchantInfo\": { \"merchantId\": \"Merchant ID\", \"merchantName\": \"Merchant Name\"},\"allowedPaymentMethods\": [ { \"type\": \"CARD\", \"parameters\": { \"allowedAuthMethods\": [ \"PAN_ONLY\" ], \"allowedCardNetworks\": [ \"VISA\", \"AMEX\", \"MASTERCARD\" ], \"billingAddressRequired\":true, \"billingAddressParameters\": { \"format\":\"MIN\" } }, \"tokenizationSpecification\": { \"type\": \"PAYMENT_GATEWAY\", \"parameters\": { \"stripe:publishableKey\": \"pk_test_OoPcJNnxI1rDXhBq8BiXO2wz00s1Xc92dA\", \"gateway\": \"stripe\", \"stripe:version\": \"2019-05-16\" } } }],\"transactionInfo\": { \"currencyCode\": \"AUD\", \"totalPriceStatus\": \"ESTIMATED\", \"totalPrice\": \"1.0\"}}" } }
Example 3
{ "actionProvidedOptions": { "paymentType": "ON_FULFILLMENT", "displayName": "Pay when you get your food.", "onFulfillmentPaymentData": { "supportedPaymentOptions": [ "Cash", "Card" ] } } }
PaymentOptionsEnums
The PaymentOptionsEnums
type has the following possible values:
-
Cash
-
Card
-
UPI
-
Paytm
PaymentType
The PaymentType
type has the following possible values:
-
PAYMENT_CARD
: For GoogleProvidedPaymentOptions. -
ON_FULFILLMENT
: For ActionProvidedPaymentOptions.
SupportedCardNetworks
Defines types related toGoogleProvidedPaymentOptions
. The SupportedCardNetworks
type has the following possible values:
-
UNSPECIFIED_CARD_NETWORK
-
AMEX
-
DISCOVER
-
JCB
-
MASTERCARD
-
VISA
TokenizationParameters
Defines types related toGoogleProvidedPaymentOptions
. The following table lists the properties for the TokenizationParameters
type:
Property | Type | شرح | |
---|---|---|---|
tokenizationType | Enum [ "UNSPECIFIED_TOKENIZATION_TYPE", "PAYMENT_GATEWAY" ] | Required. Use facilitationSpecification instead. Type of tokens acceptable. | |
parameters | Parameters | Use facilitationSpecification instead. |
TokenizationSpecification
This object allows you to configure an account to receive chargeable payment information.
The following table lists the properties for the TokenizationSpecification
type:
Property | Type | شرح | |
---|---|---|---|
type | Const | Required. | |
parameters | Parameters | Required. |
The following example shows a TokenizationSpecification
element:
Example 1
{ "type": "PAYMENT_GATEWAY", "parameters": { "gatewayMerchantId": "1247192", "gateway": "cybersource" } }
Example 2
{ "type": "PAYMENT_GATEWAY", "parameters": { "gateway": "stripe", "stripe:version": "2018-10-31", "stripe:publishableKey": "12378127" } }
TransactionInfo
This object describes a transaction that determines a payer's ability to pay. It's used to present a payment authorization dialog.
The following table lists the properties for the TransactionInfo
type:
Property | Type | شرح | |
---|---|---|---|
currencyCode | String | Required. ISO 4217 alphabetic currency code. | |
transactionId | String | Unique ID that identifies a transaction attempt. Merchants may use an existing ID or generate a specific one for Google Pay transaction attempts. This field is required when you send callbacks to the Google Transaction Events API. | |
totalPriceStatus | Const | Required. Use "ESTIMATED" as the default. Total price may adjust based on the details of the response, such as sales tax collected based on a billing address. Value: | |
totalPrice | String | Required. Total monetary value of the transaction with an optional decimal precision of two decimal places. This field should have the same value as cart.totalPrice. |
The following example shows a TransactionInfo
element:
مثال
{ "totalPriceStatus": "ESTIMATED", "totalPrice": "12.34", "currencyCode": "USD" }