Une fois qu'un client a passé une commande, vous pouvez l'informer des modifications apportées à la commande en envoyant un message de mise à jour de la commande à Google. Google transmet ensuite ce message au client dans l'interface de commande.
Voici quelques raisons courantes d'envoyer des informations sur la commande:
- La date et l'heure d'exécution estimées de la commande sont disponibles ou modifiées.
- L'état d'une commande change.
- La commande ne peut plus être traitée.
- Le prix d'un article du menu inclus dans la commande a changé.
- Le client dispose d'un nouveau moyen de gérer sa commande, comme un numéro de téléphone du service client ou du restaurant.
- Le reçu de la commande est disponible.
Par exemple, l'exemple suivant utilise une mise à jour de commande pour modifier l'état de la commande d'un client de CREATED
à CONFIRMED
une fois que le restaurant a confirmé la commande:
Cas d'utilisation | Mise en œuvre |
---|---|
Cas d'utilisation 1:Le restaurant confirme la commande | Un OrderUpdate avec un état CONFIRMED est envoyé à Google. Il doit contenir actionOrderId , userVisibleOrderId , orderManagementActions et estimatedFulfillmentTime . |
JSON
{ "isInSandbox": true, "customPushMessage": { "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": "EMAIL", "button": { "title": "Email restaurant", "openUrlAction": { "url": "mailto:person@example.com" } } }, { "type": "CALL_RESTAURANT", "button": { "title": "Call restaurant", "openUrlAction": { "url": "tel:+16505554679" } } }, { "type": "CALL_DRIVER", "button": { "title": "Call driver", "openUrlAction": { "url": "tel:+16505554681" } } } ], "infoExtension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "estimatedFulfillmentTimeIso8601": "2017-07-17T13:00:00Z/2017-07-17T13:30:00Z" } } } }
Pour découvrir les principes de base de l'implémentation des mises à jour de commande pour votre projet, consultez le guide Mises à jour de commande asynchrones.
Les sections suivantes fournissent des exemples de scénarios de mise à jour de commande plus avancés.
État refusé
Les exemples ci-dessous montrent un AsyncOrderUpdateRequestMessage
pour les commandes refusées pour diverses raisons. Par exemple, le restaurant ne peut plus honorer la commande ou l'adresse de livraison associée à la commande est hors de portée.
Cas d'utilisation | Mise en œuvre |
---|---|
Cas d'utilisation 1:la commande est refusée, car le fournisseur ne parvient pas à contacter le restaurant ou que le restaurant ne peut pas honorer la commande. | Envoyez un OrderUpdate avec un état REJECTED à Google. Il doit comporter actionOrderId , userVisibleOrderId , orderManagementActions , rejectionInfo et foodOrderError de type d'erreur NO_CAPACITY . |
Cas d'utilisation 2:la commande est refusée, car le livreur n'est pas disponible ou l'adresse de livraison est hors zone. | Envoyez un OrderUpdate avec un état REJECTED à Google. Il doit comporter actionOrderId , userVisibleOrderId , orderManagementActions , rejectionInfo et foodOrderError de type d'erreur OUT_OF_SERVICE_AREA . |
Cas d'utilisation 3:la commande est refusée, car le restaurant est fermé de manière inattendue ou est en train de fermer. | Envoyez un OrderUpdate avec un état REJECTED à Google. Il doit comporter actionOrderId , userVisibleOrderId , orderManagementActions , rejectionInfo et foodOrderError de type d'erreur CLOSED . |
Cas d'utilisation 4:la commande est refusée, car certains articles ne sont pas disponibles. | Envoyez un OrderUpdate avec un état REJECTED à Google. Il doit comporter actionOrderId , userVisibleOrderId , orderManagementActions , rejectionInfo et foodOrderError de type d'erreur AVAILABILITY_CHANGED . |
Cas d'utilisation 5:la commande est refusée pour des raisons inconnues ou non catégorisées. | Envoyez un OrderUpdate avec un état REJECTED à Google. Il doit comporter actionOrderId , userVisibleOrderId , orderManagementActions et rejectionInfo de type d'erreur UNKNOWN . |
JSON
{ "isInSandbox": true, "customPushMessage": { "orderUpdate": { "actionOrderId": "sample_action_order_id", "orderState": { "state": "REJECTED", "label": "Order rejected" }, "updateTime": "2017-05-10T02:30:00.000Z", "rejectionInfo": { "type": "UNKNOWN", "reason": "Sorry, the restaurant cannot take your order right now." }, "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" } } }, { "type": "CALL_DRIVER", "button": { "title": "Call driver", "openUrlAction": { "url": "tel:+16505554681" } } } ], "infoExtension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "foodOrderErrors": [ { "error": "NO_CAPACITY", "description": "Sorry, the restaurant cannot take your order right now." } ] } } } }
JSON
{ "isInSandbox": true, "customPushMessage": { "orderUpdate": { "actionOrderId": "sample_action_order_id", "orderState": { "state": "REJECTED", "label": "Order rejected" }, "updateTime": "2017-05-10T02:30:00.000Z", "rejectionInfo": { "type": "UNKNOWN", "reason": "Sorry, delivery is currently not available to your address." }, "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" } } }, { "type": "CALL_DRIVER", "button": { "title": "Call driver", "openUrlAction": { "url": "tel:+16505554681" } } } ], "infoExtension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "foodOrderErrors": [ { "error": "OUT_OF_SERVICE_AREA", "description": "Sorry, delivery is currently not available to your address." } ] } } } }
JSON
{ "isInSandbox": true, "customPushMessage": { "orderUpdate": { "actionOrderId": "sample_action_order_id", "orderState": { "state": "REJECTED", "label": "Order rejected" }, "updateTime": "2017-05-10T02:30:00.000Z", "rejectionInfo": { "type": "UNKNOWN", "reason": "Sorry, the restaurant is closed unexpectedly." }, "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" } } }, { "type": "CALL_DRIVER", "button": { "title": "Call driver", "openUrlAction": { "url": "tel:+16505554681" } } } ], "infoExtension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "foodOrderErrors": [ { "error": "CLOSED", "description": "Sorry, the restaurant is closed unexpectedly." } ] } } } }
JSON
{ "isInSandbox": true, "customPushMessage": { "orderUpdate": { "actionOrderId": "sample_action_order_id", "orderState": { "state": "REJECTED", "label": "Order rejected" }, "updateTime": "2017-05-10T02:30:00.000Z", "rejectionInfo": { "type": "UNKNOWN", "reason": "Sorry, some of items are not available right now." }, "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" } } }, { "type": "CALL_DRIVER", "button": { "title": "Call driver", "openUrlAction": { "url": "tel:+16505554681" } } } ], "infoExtension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "foodOrderErrors": [ { "error": "AVAILABILITY_CHANGED", "id": "sample_menu_item_id", "description": "Sorry, some of the items are not available right now." } ] } } } }
JSON
{ "isInSandbox": true, "customPushMessage": { "orderUpdate": { "actionOrderId": "sample_action_order_id", "orderState": { "state": "REJECTED", "label": "Order rejected" }, "updateTime": "2017-05-10T02:30:00.000Z", "rejectionInfo": { "type": "UNKNOWN", "reason": "Sorry, your order is rejected." }, "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" } } }, { "type": "CALL_DRIVER", "button": { "title": "Call driver", "openUrlAction": { "url": "tel:+16505554681" } } } ] } } }
État "Annulé"
L'exemple ci-dessous illustre un AsyncOrderUpdateRequestMessage
pour les commandes annulées à la demande du client.
Cas d'utilisation | Mise en œuvre |
---|---|
Cas d'utilisation 1:la commande est annulée à la demande du client | Envoyez un OrderUpdate avec un état CANCELLED à Google. Il doit contenir actionOrderId , userVisibleOrderId , orderManagementActions et cancellationInfo . |
JSON
{ "isInSandbox": true, "customPushMessage": { "orderUpdate": { "actionOrderId": "sample_action_order_id", "orderState": { "state": "CANCELLED", "label": "Order cancelled" }, "updateTime": "2017-05-10T02:30:00.000Z", "cancellationInfo": { "reason": "Customer requested" }, "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" } } }, { "type": "CALL_DRIVER", "button": { "title": "Call driver", "openUrlAction": { "url": "tel:+16505554681" } } } ] } } }
État "Traitée"
L'exemple ci-dessous illustre un AsyncOrderUpdateRequestMessage
pour les commandes qui ont été traitées.
Cas d'utilisation | Mise en œuvre |
---|---|
Cas d'utilisation 1:traitement de la commande | Envoyez un OrderUpdate avec un état FULFILLED à Google. Il doit contenir actionOrderId , userVisibleOrderId et orderManagementActions . |
JSON
{ "isInSandbox": true, "customPushMessage": { "orderUpdate": { "actionOrderId": "sample_action_order_id", "orderState": { "state": "FULFILLED", "label": "Order delivered" }, "updateTime": "2017-05-10T02:30:00.000Z", "fulfillmentInfo": { "deliveryTime": "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_RESTAURANT", "button": { "title": "Call restaurant", "openUrlAction": { "url": "tel:+16505554679" } } }, { "type": "CALL_DRIVER", "button": { "title": "Call driver", "openUrlAction": { "url": "tel:+16505554681" } } } ] } } }
État en transit
L'exemple ci-dessous illustre un AsyncOrderUpdateRequestMessage
pour les commandes de livraison en cours de livraison au client.
Cas d'utilisation | Mise en œuvre |
---|---|
Cas d'utilisation 1:la commande de livraison est en transit. | Envoyez un OrderUpdate avec un état IN_TRANSIT à Google. Il doit contenir actionOrderId , userVisibleOrderId , orderManagementActions et estimatedFulfillmentTime . |
JSON
{ "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", "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" } } }, { "type": "CALL_DRIVER", "button": { "title": "Call driver", "openUrlAction": { "url": "tel:+16505554681" } } } ], "infoExtension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "estimatedFulfillmentTimeIso8601": "PT20M" } } } }
État de disponibilité pour le retrait
L'exemple ci-dessous montre un AsyncOrderUpdateRequestMessage
pour les commandes prêtes à être retirées par le client.
Cas d'utilisation | Mise en œuvre |
---|---|
Cas d'utilisation 1:la commande est prête à être retirée. | Envoyez un OrderUpdate avec un état READY_FOR_PICKUP à Google. Il doit contenir actionOrderId , userVisibleOrderId , orderManagementActions et estimatedFulfillmentTime . |
JSON
{ "isInSandbox": true, "customPushMessage": { "orderUpdate": { "actionOrderId": "sample_action_order_id", "orderState": { "state": "READY_FOR_PICKUP", "label": "Order is ready for pickup" }, "updateTime": "2018-04-15T12: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" } } }, { "type": "CALL_DRIVER", "button": { "title": "Call driver", "openUrlAction": { "url": "tel:+16505554681" } } } ], "infoExtension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "estimatedFulfillmentTimeIso8601": "PT20M" } } } }
État de la préparation des repas
L'exemple ci-dessous montre un AsyncOrderUpdateRequestMessage
pour les commandes en cours de préparation par le restaurant.
Cas d'utilisation | Mise en œuvre |
---|---|
Cas d'utilisation 1:la commande est en cours de préparation par le restaurant. | Envoyez un OrderUpdate avec un état IN_PREPARATION à Google. Il doit contenir actionOrderId , userVisibleOrderId , orderManagementActions et estimatedFulfillmentTime . |
JSON
{ "isInSandbox": true, "customPushMessage": { "orderUpdate": { "actionOrderId": "sample_action_order_id", "orderState": { "state": "IN_PREPARATION", "label": "Order is being prepared" }, "updateTime": "2018-04-15T11:30: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" } } }, { "type": "CALL_DRIVER", "button": { "title": "Call driver", "openUrlAction": { "url": "tel:+16505554681" } } } ], "infoExtension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "estimatedFulfillmentTimeIso8601": "PT20M" } } } }
État de la commande modifié
Les exemples ci-dessous montrent un AsyncOrderUpdateRequestMessage
pour diverses modifications apportées à la commande d'un client.
Cas d'utilisation 1:la durée estimée de traitement doit être mise à jour. | Envoyez un OrderUpdate à Google avec un état de commande, actionOrderId , userVisibleOrderId , orderManagementAction et la estimatedFulfillmentTime mise à jour. |
Cas d'utilisation 2:le prix total de la commande doit être mis à jour. | Envoyez un OrderUpdate à Google avec un état de commande, actionOrderId , userVisibleOrderId , orderManagementAction , estimatedFulfillmentTime et la totalPrice mise à jour. |
Cas d'utilisation 3:les actions de gestion des commandes doivent être mises à jour. | Envoyez un OrderUpdate à Google avec un état de commande, actionOrderId , userVisibleOrderId , estimatedFulfillmentTime et la orderManagementActions mise à jour. |
JSON
{ "isInSandbox": true, "customPushMessage": { "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": "EMAIL", "button": { "title": "Email restaurant", "openUrlAction": { "url": "mailto:person@example.com" } } }, { "type": "CALL_RESTAURANT", "button": { "title": "Call restaurant", "openUrlAction": { "url": "tel:+16505554679" } } }, { "type": "CALL_DRIVER", "button": { "title": "Call driver", "openUrlAction": { "url": "tel:+16505554681" } } } ], "infoExtension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "estimatedFulfillmentTimeIso8601": "2017-07-17T13:00:00Z/2017-07-17T13:30:00Z" } } } }
JSON
{ "isInSandbox": true, "customPushMessage": { "orderUpdate": { "actionOrderId": "sample_action_order_id", "orderState": { "state": "CONFIRMED", "label": "Provider confirmed" }, "receipt": { "userVisibleOrderId": "userVisibleId1234" }, "totalPrice": { "type": "ESTIMATE", "amount": { "currencyCode": "USD", "units": "20", "nanos": 500000000 } }, "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" } } }, { "type": "CALL_DRIVER", "button": { "title": "Call driver", "openUrlAction": { "url": "tel:+16505554681" } } } ], "infoExtension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "estimatedFulfillmentTimeIso8601": "2017-07-17T13:00:00Z/2017-07-17T13:30:00Z" } } } }
JSON
{ "isInSandbox": true, "customPushMessage": { "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": "EMAIL", "button": { "title": "Email restaurant", "openUrlAction": { "url": "mailto:person@example.com" } } }, { "type": "CALL_RESTAURANT", "button": { "title": "Call restaurant", "openUrlAction": { "url": "tel:+16505554679" } } }, { "type": "CALL_DRIVER", "button": { "title": "Call driver", "openUrlAction": { "url": "tel:+16505554681" } } } ], "infoExtension": { "@type": "type.googleapis.com/google.actions.v2.orders.FoodOrderUpdateExtension", "estimatedFulfillmentTimeIso8601": "2017-07-17T13:00:00Z/2017-07-17T13:30:00Z" } } } }