تنفيذ إجراءات التنفيذ المتقدّمة

ربط خلاصات القائمة وعناصر سلّة التسوّق

عندما يضيف العملاء أصنافًا من خلاصة القائمة إلى سلة التسوّق لإتمام الدفع، ترسل Google هذه السلع إلى نقطة نهاية توصيل الطلبات للتحقّق من سعرها ومدى توفّرها. بمجرد التحقق من صحة الأسعار والتوافر، يمكن للعميل تقديم الطلب. يوضِّح هذا القسم كيفية ربط عناصر خلاصة القائمة بعناصر سلّة التسوّق.

إنّ النماذج في هذا القسم هي إصدارات معدّلة من خلاصة القائمة ومخطط سلة التسوّق. ولا يتم عرض سوى الحقول ذات الصلة لتوضيح التعيين بين خلاصة "القائمة" وكائن سلة التسوق. وللتعرّف على المخططات الكاملة، يُرجى الاطّلاع على Menu وCart.

يتم إرسال السلع في خلاصة Menu التي تتم إضافتها إلى سلة التسوّق في العنصر Cart لكل من عملية الدفع وإرسال الطلب.

  • يتم تمثيل MenuItem البسيط على أنّه LineItem في المصفوفة lineItems وتكون offerId العنصر المحدّد في القائمة هو offer.id في خلاصة القائمة.
  • يتم تمثيل MenuItem مع MenuItemOption على أنّها LineItem في مصفوفة lineItems حيث يمثّل offerId خيار عنصر القائمة المحدّد من offer.id من خلاصة القائمة.
  • يتم تمثيل AddOnMenuItem من LineItem على أنّها FoodItemOption في مصفوفة options من FoodItemExtension. يحتوي كل خيار على سمة offerId تتوافق مع offer.id للعنصر المحدد في قائمة الإضافات من خلاصة القائمة. وتجدُر الإشارة إلى أنّ AddOnقائمةItem يمكن أن تحتوي أيضًا على عناصر مدمجة يتم تمثيلها على أنّها subOptions داخل كل خيار.

تربط الأمثلة التالية عناصر القائمة بين خلاصة القائمة وعربة توصيل الطلبات.

تنسيق JSON

يحتوي هذا المثال على قائمة بعناصر قائمة بسيطة.

عناصر القائمة في خلاصة القائمة:

{
  "@type": "Menu",
  "@id": "menu_id",
  "hasMenuItem": [
    {
      "@type": "MenuItem",
      "@id": "menuitem_id_1",
      "offers": [
        {
          "@type": "Offer",
          "@id": "menuitem_offer_id_1",
          "price": "p_1",
          "priceCurrency": "USD"
        }
      ]
    },
    {
      "@type": "MenuItem",
      "@id": "menuitem_id_2",
      "offers": [
        {
          "@type": "Offer",
          "@id": "menuitem_offer_id_2",
          "price": "p_2",
          "priceCurrency": "USD"
        }
      ]
    }
  ]
}

سلع القائمة التي تم ربطها بسلة تسوّق توصيل الطلبات:

{
  "@type": "Cart",
  "lineItems": [
    {
      "offerId": "menuitem_offer_id_1",
      "price": {
        "amount": {
          "currencyCode": "USD",
          "units": "dollar(q_1*p_1)",
          "nanos": "cent(q_1*p_1)"
        }
      },
      "quantity": "q_1"
    },
    {
      "offerId": "menuitem_offer_id_2",
      "price": {
        "amount": {
          "currencyCode": "USD",
          "units": "dollar(q_2*p_2)",
          "nanos": "cent(q_2*p_2)"
        }
      },
      "quantity": "q_2"
    }
  ]
}

تنسيق JSON

يحتوي هذا المثال على عنصر قائمة مع عنصر AddOnListItems واحد أو أكثر.

عناصر القائمة في خلاصة القائمة:

{
  "@type": "Menu",
  "@id": "menu_id",
  "hasMenuItem": [
    {
      "@type": "MenuItem",
      "@id": "menuitem_id_1",
      "offers": [
        {
          "@type": "Offer",
          "@id": "menuitem_offer_id_1",
          "price": "p_1",
          "priceCurrency": "USD"
        }
      ],
      "menuAddOn": [
        {
          "@type": "MenuAddOnSection",
          "@id": "menuaddon_section_id_1",
          "hasMenuItem": [
            {
              "@type": "AddOnMenuItem",
              "@id": "menuitem_addon_id_1",
              "offers": [
                {
                  "@type": "Offer",
                  "@id": "menuitem_addon_offer_id_1",
                  "price": "addon_p_1",
                  "priceCurrency": "USD"
                }
              ]
            },
            {
              "@type": "AddOnMenuItem",
              "@id": "menuitem_addon_id_2",
              "offers": [
                {
                  "@type": "Offer",
                  "@id": "menuitem_addon_offer_id_2",
                  "price": "addon_p_2",
                  "priceCurrency": "USD"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "@type": "MenuItem",
      "@id": "menuitem_id_2",
      "offers": [
        {
          "@type": "Offer",
          "@id": "menuitem_offer_id_2",
          "price": "p_2",
          "priceCurrency": "USD"
        }
      ]
    }
  ]
}

سلع القائمة التي تم ربطها بسلة تسوّق توصيل الطلبات:

{
  "@type": "Cart",
  "lineItems": [
    {
      "offerId": "menuitem_offer_id_1",
      "price": {
        "amount": {
          "currencyCode": "USD",
          "units": "dollar(q_1*(p_1 + addon_q_1*addon_p_1 + addon_q_2*addon_p_2))",
          "nanos": "cent(q_1*(p_1 + addon_q_1*addon_p_1 + addon_q_2*addon_p_2))"
        }
      },
      "quantity": "q_1",
      "extension": {
        "@type": "FoodItemExtension",
        "options": [
          {
            "offerId": "menuitem_addon_offer_id_1",
            "price": {
                "currencyCode": "USD",
                "units": "dollar(addon_q_1*addon_p_1)",
                "nanos": "cent(addon_q_1*addon_p_1)"
            },
            "quantity": "addon_q_1"
          },
          {
            "offerId": "menuitem_addon_offer_id_2",
            "price": {
                "currencyCode": "USD",
                "units": "dollar(addon_q_2*addon_p_2)",
                "nanos": "cent(addon_q_2*addon_p_2)"
            },
            "quantity": "addon_q_2"
          }
        ]
      }
    },
    {
      "offerId": "menuitem_offer_id_2",
      "price": {
        "amount": {
          "currencyCode": "USD",
          "units": "dollar(q_2*p_2)",
          "nanos": "cent(q_2*p_2)"
        }
      },
      "quantity": "q_2"
    }
  ]
}

تنسيق JSON

يحتوي هذا المثال على عنصر قائمة مع خيارات أصناف قائمة الطعام AddOn MenuItems وAddOnقائمةItems مدمجة

عناصر القائمة في خلاصة القائمة:

{
  "@type": "MenuItem",
  "@id": "menuitem_id_1",
  "hasMenuItemOptions": [
    {
      "@type": "MenuItemOption",
      "value": {
        "@type": "PropertyValue",
        "name": "OPTION",
        "value": "Large",
        "offers": [
          {
            "@type": "Offer",
            "@id": "menuitem_option_offer_id_1",
            "price": "p_1",
            "priceCurrency": "USD"
          }
        ],
        "menuAddOn": [
          {
            "@type": "AddOnMenuSection",
            "@id": "menuitem_option_addon_section_id_1",
            "hasMenuItem": [
              {
                "@type": "AddOnMenuItem",
                "@id": "menuitem_option_addon_id_1",
                "offers": [
                  {
                    "@type": "Offer",
                    "@id": "menuitem_option_addon_offer_id_1",
                    "price": "addon_p_1",
                    "priceCurrency": "USD"
                  }
                ]
              },
              {
                "@type": "AddOnMenuItem",
                "@id": "menuitem_option_addon_id_2",
                "offers": [
                  {
                    "@type": "Offer",
                    "@id": "menuitem_option_addon_offer_id_2",
                    "price": "addon_p_2",
                    "priceCurrency": "USD"
                  }
                ],
                "menuAddOn": [
                  {
                    "@type": "AddOnMenuSection",
                    "@id": "menuitem_option_subaddon_section_id_1",
                    "hasMenuItem": [
                      {
                        "@type": "AddOnMenuItem",
                        "@id": "menuitem_option_subaddon_id_1",
                        "offers": [
                          {
                            "@type": "Offer",
                            "@id": "menuitem_option_subaddon_offer_id_1",
                            "price": "subaddon_p_1",
                            "priceCurrency": "USD"
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    }
  ]
}

سلع القائمة التي تم ربطها بسلة تسوّق توصيل الطلبات:

{
  "@type": "Cart",
  "lineItems": [
    {
      "offerId": "menuitem_option_offer_id_1",
      "price": {
        "amount": {
          "currencyCode": "USD",
          "units": "dollar(q_1*(p_1 + addon_q_1*addon_p_1 + addon_q_2*(addon_p_2 + subaddon_q_1*subaddon_p_1)))",
          "nanos": "cent(q_1*(p_1 + addon_q_1*addon_p_1 + addon_q_2*(addon_p_2 + subaddon_q_1*subaddon_p_1)))"
        }
      },
      "quantity": "q_1",
      "extension": {
        "@type": "FoodItemExtension",
        "options": [
          {
            "offerId": "menuitem_option_addon_offer_id_1",
            "price": {
              "currencyCode": "USD",
              "units": "dollar(addon_q_1*addon_p_1)",
              "nanos": "cent(addon_q_1*addon_p_1)"
            },
            "quantity": "addon_q_1"
          },
          {
            "offerId": "menuitem_option_addon_offer_id_2",
            "price": {
              "currencyCode": "USD",
              "units": "dollar(addon_q_2*(addon_p_2 + subaddon_q_1*subaddon_p_1))",
              "nanos": "cent(addon_q_2*(addon_p_2 + subaddon_q_1*subaddon_p_1))"
            },
            "quantity": "addon_q_2",
            "subOptions": [
              {
                "offerId": "menuitem_option_subaddon_offer_id_1",
                "price": {
                  "currencyCode": "USD",
                  "units": "dollar(subaddon_q_1*subaddon_p_1)",
                  "nanos": "cent(subaddon_q_1*subaddon_p_1)"
                },
                "quantity": "subaddon_q_1"
              }
            ]
          }
        ]
      }
    }
  ]
}

معالجة الأخطاء

إذا كنت تواجه مشاكل أثناء معالجة CheckoutRequestMessage، يمكنك الرد باستخدام CheckoutResponseMessage تحتوي على FoodErrorExtension بدلاً من CheckoutResponse. يمكنك استخدام هذا الرد لتحديد خطأ واحد أو أكثر حدث أثناء المعالجة.

هناك طريقتان للتعامل مع الأخطاء:

  • أخطاء قابلة للاسترداد: لا يُطلب من المستخدم تعديل سلة التسوّق لإرسال الطلب. على سبيل المثال، إذا رأيت أنّ سعرًا معيَّنًا في Cart قد تغيّر، يمكنك الردّ باستخدام FoodOrderError من نوع الخطأ PRICE_CHANGED، بالإضافة إلى correctedProposedOrder وpaymentOptions. تُبلغ Google المستخدم بالتغيير ولكنها تسمح له بإرسال correctedProposedOrder. يمكن للمستخدم أيضًا الرجوع وتعديل سلة التسوق إذا رغب في ذلك. ستتلقّى إمّا CheckoutRequestMessage جديدة أو SubmitOrderRequestMessage.
  • الأخطاء التي لا يمكن استردادها: على المستخدم تعديل سلة التسوّق قبل إرسال الطلب. على سبيل المثال، إذا حددت أن المطعم مغلق، يمكنك الرد مع FoodOrderError من نوع الخطأ CLOSED. تبلغ Google المستخدم وتدير التفاعل للتحديث إلى مطعم جديد. ستحصل على CheckoutRequestMessage جديدة لسلة التسوّق الجديدة.

بشكل عام، يمكنك جعل الأخطاء على مستوى سلة التسوق غير قابلة للاسترداد والأخطاء على مستوى السلعة. للحصول على قائمة كاملة بأنواع الأخطاء ومعانيها، يمكنك الاطّلاع على القسم FoodOrderError.

التعامل مع التغييرات في الأسعار

تغيُّر الأسعار أثناء الدفع

إذا واجهت مشكلة في السعر أثناء معالجة طلب الدفع الذي يقدّمه العميل، يمكنك اتّباع الخطوات التالية:

  1. الردّ على CheckoutRequestMessage باستخدام السمة CheckoutResponseMessage التي تحتوي على العلامة FoodErrorExtension، كما هو موضّح في القسم أخطاء المعالجة.
  2. في استجابة الخطأ، استخدِم correctedProposedOrder.cart لتعديل السعر إلى القيمة الصحيحة. تتلقّى Google الطلب المصحَّح وقد تُصدِر CheckoutRequestMessage جديدًا.

بعد الدفع، تعرض Google صفحة تأكيد الطلب للمستخدم النهائي، بغض النظر عمّا إذا تم تغيير ProposedOrder أم لا.

إذا تم تصحيح ProposedOrder، قد تعرض Google تحذيرات إضافية لإبلاغ المستخدم بالتغييرات. إذا وافق المستخدم على تقديم الطلب، فلن يكون هناك المزيد من طلبات الدفع. يستمر التدفق في ترتيب الإرسال، مع تصحيح ProposedOrder.

ومع ذلك، يمكن للمستخدم دائمًا تغيير رأيه وتعديل سلة التسوق مرة أخرى. وعند تعديل سلة التسوّق بهذه الطريقة، ترسل Google سمة CheckoutRequestMessage جديدة.

تغيير السعر أثناء تقديم الطلب

إذا واجهت مشكلة في السعر أثناء معالجة إرسال الطلب (تم تشغيل النية actions.intent.TRANSACTION_DECISION)، لا ترسل رسالة خطأ ولا تعدّل السعر في الردّ. إذا كانت الأسعار أو الكميات أو التفاصيل الأخرى في SubmitOrderRequestMessage غير متوافقة مع بياناتك، يمكنك الردّ باستخدام orderState على REJECTED للإشارة إلى أنّه لا يمكن تقديم الطلب على النحو المطلوب.

بعد ذلك، إذا كانت تفاصيل الطلب والدفع صالحة، اضبط السمة orderState على CREATED أو CONFIRMED. يمكنك أيضًا تضمين actionOrderId لتمثيل معرّف الطلب في نظامك. ويجب استخدام هذا المعرّف عند إرسال تعديلات لاحقة.

إذا لم تتمكّن من معالجة الدفعة وكنت قد أرسلت SubmitOrderRequestMessage، يمكنك إرسال AsyncOrderUpdateRequestMessage مع ضبط قيمة orderState على REJECTED لإعلام المستخدم بتعذُّر معالجة الطلب.

تغيير السعر بعد إرسال الطلب

إذا تبيّن لك أنّ السعر قد تغيّر عن السعر المستخدَم عندما أرسل العميل طلبه، يمكنك إصدار AsyncOrderUpdateRequestMessage بالسعر الجديد كما هو موضّح في القسم تنفيذ تعديلات الطلب غير المتزامن.

لتعديل الأسعار باستخدام تعديلات الطلبات غير المتزامنة:

  1. تغيير السعر في lineItemUpdates[x].price وتعكس هذه القيمة إجمالي تكلفة السلعة، بما في ذلك الإضافات وضربها في الكمية. (لمزيد من المعلومات، راجِع وصف الحقل price في LineItem.)
  2. أدخِل شرحًا باللغة lineItemUpdates[x].reason.
  3. اضبط السمة lineItemUpdates[x].orderState على CONFIRMED.

يمكنك محاولة تحصيل الرسوم من وسيلة الدفع قبل أو بعد إرسال AsyncOrderUpdateRequestMessage، وذلك وفقًا لتقديرك. إذا تعذّر إكمال المعاملة (قد يكون ذلك بسبب قيمة دلتا للسعر العالي جدًا)، أرسِل رسالة AsyncOrderUpdateRequestMessage بالإعدادات التالية في OrderUpdate لإبلاغ Google بتعذُّر تنفيذ هذه العملية:

  • اضبط السمة orderState على REJECTED.
  • قدِّم وصفًا لسبب الخطأ في حقل label.

إثبات صحة معلومات الدفع

كما هو موضّح في الخطوة 4: تنفيذ عملية الدفع، يجب أن تُجري نقطة نهاية توصيل الطلبات التحقق على كل الطلبات الواردة CheckoutRequestMessage، والرد باستخدام CheckoutResponseMessage.

في ما يلي مثال على CheckoutResponseMessage للتحقق من صحة البيانات بنجاح:

حالة الاستخدام كيفية التنفيذ
حالة الاستخدام 1: تم التحقق بنجاح العودة في CheckoutResponse ويجب أن يتضمّن ProposedOrder وPaymentOptions. تتضمّن ProposedOrder الضريبة والرسوم والسعر الإجمالي لسلة التسوق.

تنسيق JSON

{
  "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": {
                    // Represents $36.73
                    "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
                }
              }
            }
          }
        }
      ]
    }
  }
}

إثبات صحة عنوان التسليم

يجب أن تتحقّق نقطة نهاية التنفيذ من عنوان التسليم المضمَّن في كل CheckoutRequestMessage.

إذا حدثت مشكلة في عنوان التسليم، مثلاً إذا كان خارج نطاق خدمة التسليم، يجب أن تحتوي سمة CheckoutResponseMessage التي عرضتها توصيل الطلب على FoodOrderError من النوع المناسب.

حالة الاستخدام كيفية التنفيذ
حالة الاستخدام 1: تعذّر إجراء عملية التحقق لأنّ عنوان التسليم خارج النطاق أو لأنّ هناك مشكلة في عنوان التسليم. عرض FoodErrorExtension مع FoodOrderError من نوع الخطأ OUT_OF_SERVICE_AREA.

تنسيق JSON

{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "error": {
              "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension",
              "foodOrderErrors": [
                {
                  "error": "OUT_OF_SERVICE_AREA",
                  "description": "Sorry, the restaurant cannot deliver to your address."
                }
              ]
            }
          }
        }
      ]
    }
  }
}

التحقّق من الحدّ الأدنى لقيمة طلب الشراء

يجب أن تتحقّق نقطة نهاية توصيل الطلبات من الحد الأدنى لقيمة طلب الشراء لكل CheckoutRequestMessage.

في حال عدم استيفاء الحدّ الأدنى لقيمة طلب الشراء، يجب أن يحتوي CheckoutResponseMessage التي تم إرجاعها من خلال توصيل الطلب على FoodOrderError من نوع الخطأ REQUIREMENTS_NOT_MET.

حالة الاستخدام كيفية التنفيذ
حالة الاستخدام 1: تعذّر إجراء عملية التحقق بسبب عدم استيفاء الحدّ الأدنى لقيمة طلب الشراء. عرض FoodErrorExtension مع FoodOrderError من نوع الخطأ REQUIREMENTS_NOT_MET.

تنسيق JSON

{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "error": {
              "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension",
              "foodOrderErrors": [
                {
                  "error": "REQUIREMENTS_NOT_MET",
                  "description": "The cart subtotal must be over $20."
                }
              ]
            }
          }
        }
      ]
    }
  }
}

التحقّق من صحة نافذة الطلب

يجب أن تتحقّق نقطة نهاية التنفيذ من أي عوامل قد تؤثر في نافذة الطلب لكل CheckoutRequestMessage.

على سبيل المثال، إذا كان المطعم مغلقًا أو لم يعُد يتلقّى الطلبات في الوقت الحالي، يجب أن يحتوي CheckoutResponseMessage الذي يعرضه تنفيذ الطلب على FoodOrderError من نوع الخطأ CLOSED أو NO_CAPACITY، على التوالي.

حالة الاستخدام كيفية التنفيذ
حالة الاستخدام 1: تعذّر إجراء عملية التحقق لأنّ المطعم مغلق أو لم يعُد متاحًا. عرض FoodErrorExtension مع FoodOrderError من نوع الخطأ CLOSED.
حالة الاستخدام 2: تعذّر إجراء عملية التحقّق لأنّ المطعم مشغول ولا يتلقّى الطلبات في الوقت الحالي. عرض FoodErrorExtension مع FoodOrderError من نوع الخطأ NO_CAPACITY.

تنسيق JSON

{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "error": {
              "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension",
              "foodOrderErrors": [
                {
                  "error": "CLOSED",
                  "description": "The restaurant is closed."
                }
              ]
            }
          }
        }
      ]
    }
  }
}

تنسيق JSON

{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "error": {
              "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension",
              "foodOrderErrors": [
                {
                  "error": "NO_CAPACITY",
                  "description": "Sorry, the restaurant is busy at the moment."
                }
              ]
            }
          }
        }
      ]
    }
  }
}

التحقق من صحة عناصر سلة التسوق

يجب أن تتحقّق نقطة نهاية توصيل الطلبات من سعر كل سلعة من سلّة التسوّق ومدى توفّرها في CheckoutRequestMessage.

في حال تغيير مدى التوفّر أو السعر، يجب أن تحتوي السمة CheckoutResponseMessage التي يعرضها توصيل الطلبات على FoodOrderError من نوع الخطأ AVAILABILITY_CHANGED أو PRICE_CHANGED، على التوالي.

حالة الاستخدام كيفية التنفيذ
حالة الاستخدام 1: تعذّر إجراء عملية التحقق لأنّ بعض عناصر القائمة و/أو تخصيصها غير صالحة أو غير متوفّرة. عرض FoodErrorExtension مع correctedProposedOrder وPaymentOptions وFoodOrderError من نوع الخطأ AVAILABILITY_CHANGED. يجب إزالة العناصر غير الصالحة من CorrectedProposedOrder.
حالة الاستخدام 2: تعذّر إجراء عملية التحقق لأنّ بعض عناصر القائمة و/أو تخصيصها غير صالحة أو غير متوفّرة. لم تعُد سلة التسوق المصحَّحة تستوفي الحد الأدنى المطلوب لقيمة طلب الشراء. عرض FoodErrorExtension مع FoodOrderError من نوعَي الخطأ AVAILABILITY_CHANGED وREQUIREMENTS_NOT_MET.
حالة الاستخدام 3: تعذّر إجراء عملية التحقق بسبب تغيير بعض عناصر القائمة و/أو أسعار التخصيص. عرض FoodErrorExtension مع correctedProposedOrder وPaymentOptions وFoodOrderError من نوع الخطأ PRICE_CHANGED. يجب تعديل الأسعار القديمة في CorrectedProposedOrder.
حالة الاستخدام 4: تعذّر إجراء عملية التحقق بسبب تغيّر بعض عناصر القائمة و/أو أسعار التخصيص. لم تعُد سلة التسوق المصحَّحة تستوفي متطلبات الحدّ الأدنى لقيمة طلب الشراء. عرض FoodErrorExtension مع FoodOrderError من نوعَي الخطأ PRICE_CHANGED وREQUIREMENTS_NOT_MET.

تنسيق JSON

{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "error": {
              "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension",
              "foodOrderErrors": [
                {
                  "error": "AVAILABILITY_CHANGED",
                  "id": "sample_item_offer_id_1",
                  "description": "The item is no longer available."
                },
                {
                  "error": "AVAILABILITY_CHANGED",
                  "id": "sample_item_offer_id_2",
                  "description": "The item is no longer available."
                }
              ],
              "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": "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
                }
              }
            }
          }
        }
      ]
    }
  }
}

تنسيق JSON

{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "error": {
              "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension",
              "foodOrderErrors": [
                {
                  "error": "REQUIREMENTS_NOT_MET",
                  "description": "The cart subtotal must be over $20."
                },
                {
                  "error": "AVAILABILITY_CHANGED",
                  "id": "cart_lineitem_id"
                  "description": "cart_lineitem_id is no longer available."
                }
              ]
            }
          }
        }
      ]
    }
  }
}

تنسيق JSON

{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "error": {
              "@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
                }
              }
            }
          }
        }
      ]
    }
  }
}

تنسيق JSON

{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "error": {
              "@type": "type.googleapis.com/google.actions.v2.orders.FoodErrorExtension",
              "foodOrderErrors": [
                {
                  "error": "REQUIREMENTS_NOT_MET",
                  "description": "The cart subtotal must be over $20."
                },
                {
                  "error": "PRICE_CHANGED",
                  "id": "cart_lineitem_id"
                  "description": "cart_lineitem_id price has been updated."
                  "updatedPrice": {
                    "currencyCode": "USD",
                    "units": "2",
                    "nanos": 750000000
                  }
                }
              ]
            }
          }
        }
      ]
    }
  }
}

تقديم طلب التحقق من صحة الطلب

كما هو موضّح في الخطوة 7: تنفيذ إرسال الطلب، يجب أن تُجري نقطة نهاية توصيل الطلبات التحقق من كل الطلبات الواردة SubmitOrderRequestMessage، والرد باستخدام SubmitOrderResponseMessage.

في ما يلي مثال على SubmitOrderResponseMessage للتحقق من صحة البيانات بنجاح:

حالة الاستخدام كيفية التنفيذ
حالة الاستخدام 1: تم إنشاء الطلب بنجاح SubmitOrderResponseMessage مع حالة ترتيب CREATED. ويجب أن يحتوي على actionOrderId وuserVisibleId وorderManagementActions وestimatedFulfillmentTime.
حالة الاستخدام 2: تم رفض الطلب بسبب مشاكل في الدفع SubmitOrderResponseMessage مع حالة ترتيب REJECTED. ويجب أن يحتوي على actionOrderId وuserVisibleId وorderManagementActions وrejectionInfo من النوع PAYMENT_DECLINED.
حالة الاستخدام 3: تم رفض الطلب بسبب تصنيف المستخدم على أنّه محظور SubmitOrderResponseMessage مع حالة الطلب REJECTED. ويجب أن يحتوي على actionOrderId وuserVisibleId وorderManagementActions وrejectionInfo من النوع INELIGIBLE.
حالة الاستخدام 4: تم رفض الطلب لأنّ معلومات المستخدم غير مكتملة أو غير صالحة. SubmitOrderResponseMessage مع حالة ترتيب REJECTED. ويجب أن يحتوي على actionOrderId وuserVisibleId وorderManagementActions وrejectionInfo من النوع INELIGIBLE.
حالة الاستخدام 5: تم رفض الطلب لسبب غير معروف SubmitOrderResponseMessage مع حالة ترتيب REJECTED. ويجب أن يحتوي على actionOrderId وuserVisibleId وorderManagementActions وrejectionInfo من النوع UNKNOWN.

تنسيق JSON

{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "orderUpdate": {
              "actionOrderId": "sample_action_order_id",
              "orderState": {
                "state": "CREATED",
                "label": "Order received"
              },
              "updateTime": "2017-05-10T02:30:00.000Z",
              "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",
                  "button": {
                    "title": "Call restaurant",
                    "openUrlAction": {
                      "url": "tel:+16505554679"
                    }
                  }
                },
                {
                  "type": "VIEW_DETAILS",
                  "button": {
                    "title": "View order",
                    "openUrlAction": {
                      "url": "https://orderview.partner.com?orderid=sample_action_order_id"
                    }
                  }
                }
              ]
            }
          }
        }
      ]
    }
  }
}

تنسيق JSON

{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "orderUpdate": {
              "actionOrderId": "sample_action_order_id",
              "orderState": {
                "state": "REJECTED",
                "label": "Order rejected"
              },
              "updateTime": "2017-05-10T02:30:00.000Z",
              "rejectionInfo": {
                 "type": "PAYMENT_DECLINED",
                 "reason": "Insufficient funds"
              },
              "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",
                  "button": {
                    "title": "Call restaurant",
                    "openUrlAction": {
                      "url": "tel:+16505554679"
                    }
                  }
                },
                {
                  "type": "VIEW_DETAILS",
                  "button": {
                    "title": "View order",
                    "openUrlAction": {
                      "url": "https://orderview.partner.com?orderid=sample_action_order_id"
                    }
                  }
                }
              ]
            }
          }
        }
      ]
    }
  }
}

تنسيق JSON

{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "orderUpdate": {
              "actionOrderId": "sample_action_order_id",
              "orderState": {
                "state": "REJECTED",
                "label": "Order rejected"
              },
              "updateTime": "2017-05-10T02:30:00.000Z",
              "rejectionInfo": {
                 "type": "INELIGIBLE",
                 "reason": "Sorry, we are not able to take orders from this user"
              },
              "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",
                  "button": {
                    "title": "Call restaurant",
                    "openUrlAction": {
                      "url": "tel:+16505554679"
                    }
                  }
                },
                {
                  "type": "VIEW_DETAILS",
                  "button": {
                    "title": "View order",
                    "openUrlAction": {
                      "url": "https://orderview.partner.com?orderid=sample_action_order_id"
                    }
                  }
                }
              ]
            }
          }
        }
      ]
    }
  }
}

تنسيق JSON

{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "orderUpdate": {
              "actionOrderId": "sample_action_order_id",
              "orderState": {
                "state": "REJECTED",
                "label": "Order rejected"
              },
              "updateTime": "2017-05-10T02:30:00.000Z",
              "rejectionInfo": {
                 "type": "INELIGIBLE",
                 "reason": "Sorry, the phone number must not be blank"
              },
              "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",
                  "button": {
                    "title": "Call restaurant",
                    "openUrlAction": {
                      "url": "tel:+16505554679"
                    }
                  }
                },
                {
                  "type": "VIEW_DETAILS",
                  "button": {
                    "title": "View order",
                    "openUrlAction": {
                      "url": "https://orderview.partner.com?orderid=sample_action_order_id"
                    }
                  }
                }
              ]
            }
          }
        }
      ]
    }
  }
}

تنسيق JSON

{
  "expectUserResponse": false,
  "finalResponse": {
    "richResponse": {
      "items": [
        {
          "structuredResponse": {
            "orderUpdate": {
              "actionOrderId": "sample_action_order_id",
              "orderState": {
                "state": "REJECTED",
                "label": "Order rejected"
              },
              "updateTime": "2017-05-10T02:30:00.000Z",
              "rejectionInfo": {
                 "type": "UNKNOWN",
                 "reason": "Sorry, there is something wrong with this order."
              },
              "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",
                  "button": {
                    "title": "Call restaurant",
                    "openUrlAction": {
                      "url": "tel:+16505554679"
                    }
                  }
                },
                {
                  "type": "VIEW_DETAILS",
                  "button": {
                    "title": "View order",
                    "openUrlAction": {
                      "url": "https://orderview.partner.com?orderid=sample_action_order_id"
                    }
                  }
                }
              ]
            }
          }
        }
      ]
    }
  }
}