Setelah pelanggan mengirimkan pesanan, Anda dapat memberi tahu pelanggan tentang perubahan pesanan dengan mengirimkan pesan pembaruan pesanan ke Google. Google kemudian meneruskan pesan tersebut kepada pelanggan dalam UI pemesanan.
Alasan umum untuk mengirim pembaruan pesanan meliputi:
- Perkiraan waktu pemenuhan pesanan tersedia atau berubah.
- Status pesanan akan berubah.
- Pesanan tidak dapat lagi dipenuhi.
- Harga item menu yang disertakan dalam pesanan telah berubah.
- Pelanggan memiliki cara baru untuk mengelola pesanannya, seperti dukungan pelanggan atau nomor telepon restoran.
- Tanda terima pesanan tersedia.
Misalnya, contoh berikut menggunakan pembaruan pesanan untuk mengubah status pesanan pelanggan dari CREATED
menjadi CONFIRMED
setelah restoran mengonfirmasi pesanan:
Kasus penggunaan | Cara menerapkan |
---|---|
Kasus penggunaan 1: Restoran mengonfirmasi pesanan | OrderUpdate dengan status CONFIRMED dikirim
ke Google. Class harus memiliki actionOrderId ,
userVisibleOrderId , orderManagementActions , dan
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" } } } }
Untuk dasar-dasar penerapan update pesanan untuk project Anda, baca panduan Update pesanan asinkron.
Bagian berikutnya memberikan contoh untuk skenario pembaruan pesanan yang lebih lanjut.
Status ditolak
Contoh di bawah ini menunjukkan AsyncOrderUpdateRequestMessage
untuk pesanan yang telah ditolak karena berbagai alasan. Beberapa contoh alasan
penolakan adalah saat restoran tidak dapat lagi memenuhi pesanan atau saat
alamat pengiriman yang terkait dengan pesanan berada di luar rentang.
Kasus penggunaan | Cara menerapkan |
---|---|
Kasus penggunaan 1: Pesanan ditolak karena penyedia tidak dapat menghubungi restoran atau restoran tidak dapat memenuhi pesanan. | Kirim OrderUpdate dengan status REJECTED ke
Google. Class harus memiliki actionOrderId ,
userVisibleOrderId , orderManagementActions ,
rejectionInfo , dan foodOrderError dari jenis error
NO_CAPACITY . |
Kasus penggunaan 2: Pesanan ditolak karena pengemudi tidak tersedia atau alamat pengiriman berada di luar rentang. | Kirim OrderUpdate dengan status REJECTED ke
Google. Class harus memiliki actionOrderId ,
userVisibleOrderId , orderManagementActions ,
rejectionInfo , dan foodOrderError dari jenis error
OUT_OF_SERVICE_AREA . |
Kasus penggunaan 3: Pesanan ditolak karena restoran tutup tiba-tiba atau tutup. | Kirim OrderUpdate dengan status REJECTED ke
Google. Class harus memiliki actionOrderId ,
userVisibleOrderId , orderManagementActions ,
rejectionInfo , dan foodOrderError dari jenis error
CLOSED . |
Kasus penggunaan 4: Pesanan ditolak karena beberapa item habis. | Kirim OrderUpdate dengan status REJECTED ke
Google. Class harus memiliki actionOrderId ,
userVisibleOrderId , orderManagementActions ,
rejectionInfo , dan foodOrderError dari jenis error
AVAILABILITY_CHANGED . |
Kasus penggunaan 5: Pesanan ditolak karena alasan yang tidak diketahui atau tidak dikategorikan. | Kirim OrderUpdate dengan status REJECTED ke
Google. Class harus memiliki actionOrderId ,
userVisibleOrderId , orderManagementActions , dan
rejectionInfo dari jenis error 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" } } } ] } } }
Status dibatalkan
Contoh di bawah menunjukkan AsyncOrderUpdateRequestMessage
untuk pesanan yang dibatalkan berdasarkan permintaan pelanggan.
Kasus penggunaan | Cara menerapkan |
---|---|
Kasus penggunaan 1: Pesanan dibatalkan atas permintaan pelanggan | Kirim OrderUpdate dengan status CANCELLED ke
Google. Class harus memiliki actionOrderId ,
userVisibleOrderId , orderManagementActions , dan
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" } } } ] } } }
Status terpenuhi
Contoh di bawah menunjukkan AsyncOrderUpdateRequestMessage
untuk
pesanan yang telah terpenuhi.
Kasus penggunaan | Cara menerapkan |
---|---|
Kasus penggunaan 1: Pesanan terpenuhi | Kirim OrderUpdate dengan status FULFILLED ke
Google. Class harus memiliki actionOrderId ,
userVisibleOrderId , dan 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" } } } ] } } }
Status dalam transit
Contoh di bawah ini menunjukkan AsyncOrderUpdateRequestMessage
untuk
pesanan pengiriman yang sedang dalam proses pengiriman kepada pelanggan.
Kasus penggunaan | Cara menerapkan |
---|---|
Kasus penggunaan 1: Pesanan pengiriman sedang dalam pengiriman. | Kirim OrderUpdate dengan status IN_TRANSIT
ke Google. Class harus memiliki actionOrderId ,
userVisibleOrderId , orderManagementActions , dan
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" } } } }
Status siap diambil
Contoh di bawah menunjukkan AsyncOrderUpdateRequestMessage
untuk
pesanan yang siap diambil oleh pelanggan.
Kasus penggunaan | Cara menerapkan |
---|---|
Kasus penggunaan 1: Pesanan siap diambil. | Kirim OrderUpdate dengan status READY_FOR_PICKUP
ke Google. Class harus memiliki actionOrderId ,
userVisibleOrderId , orderManagementActions , dan
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" } } } }
Status penyiapan makanan
Contoh di bawah menunjukkan AsyncOrderUpdateRequestMessage
untuk
pesanan yang sedang disiapkan oleh restoran.
Kasus penggunaan | Cara menerapkan |
---|---|
Kasus penggunaan 1: Pesanan sedang disiapkan oleh restoran. | Kirim OrderUpdate dengan status IN_PREPARATION
ke Google. Class harus memiliki actionOrderId ,
userVisibleOrderId , orderManagementActions , dan
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" } } } }
Status pesanan diubah
Contoh di bawah menunjukkan AsyncOrderUpdateRequestMessage
untuk
berbagai perubahan yang dibuat pada pesanan pelanggan.
Kasus penggunaan 1: Perkiraan waktu pemenuhan harus diperbarui. | Mengirim OrderUpdate ke Google dengan status pesanan,
actionOrderId , userVisibleOrderId ,
orderManagementAction , dan estimatedFulfillmentTime
yang diperbarui. |
Kasus penggunaan 2: Harga total pesanan harus diperbarui. | Mengirim OrderUpdate ke Google dengan status pesanan,
actionOrderId , userVisibleOrderId ,
orderManagementAction , estimatedFulfillmentTime ,
dan totalPrice yang diperbarui. |
Kasus penggunaan 3: Tindakan pengelolaan pesanan dari pesanan perlu diperbarui. | Mengirim OrderUpdate ke Google dengan status pesanan,
actionOrderId , userVisibleOrderId ,
estimatedFulfillmentTime , dan orderManagementActions
yang diperbarui. |
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" } } } }