Setelah pelanggan mengirimkan pesanan, Anda dapat memberi tahu pelanggan tentang perubahan untuk pesanan dengan mengirimkan pesan pembaruan pesanan ke Google. Google kemudian menyampaikannya kepada pelanggan dalam UI pemesanan.
Alasan umum untuk mengirimkan pembaruan pesanan meliputi:
- Estimasi waktu pemenuhan pesanan untuk pesanan tersedia atau berubah.
- Status pesanan berubah.
- Pesanan tidak dapat dipenuhi lagi.
- Harga item menu yang disertakan dalam pesanan 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
ke CONFIRMED
setelah restoran mengonfirmasi
pesanan:
Kasus penggunaan | Cara menerapkan |
---|---|
Kasus penggunaan 1: Restoran mengonfirmasi pesanan | OrderUpdate dengan status CONFIRMED dikirim
ke Google. URL 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 pembaruan pesanan pada project Anda, baca panduannya Pembaruan urutan asinkron.
Bagian berikutnya memberikan contoh untuk skenario pembaruan pesanan lanjutan lainnya.
Status ditolak
Contoh di bawah menunjukkan AsyncOrderUpdateRequestMessage
untuk
pesanan yang telah ditolak karena berbagai alasan. Beberapa contoh penolakan
Alasannya adalah ketika restoran tidak lagi dapat memenuhi
pesanan atau ketika
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 itu tidak dapat memenuhi pesanan. | Kirim OrderUpdate dengan status REJECTED ke
Google. URL 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. URL harus memiliki actionOrderId ,
userVisibleOrderId , orderManagementActions ,
rejectionInfo , dan foodOrderError dari jenis error
OUT_OF_SERVICE_AREA . |
Kasus penggunaan 3: Pesanan ditolak karena restoran tutup secara tidak terduga atau menutup. | Kirim OrderUpdate dengan status REJECTED ke
Google. URL harus memiliki actionOrderId ,
userVisibleOrderId , orderManagementActions ,
rejectionInfo , dan foodOrderError dari jenis error
CLOSED . |
Kasus penggunaan 4: Pesanan ditolak karena sebagian item tidak ada stok. | Kirim OrderUpdate dengan status REJECTED ke
Google. URL harus memiliki actionOrderId ,
userVisibleOrderId , orderManagementActions ,
rejectionInfo , dan foodOrderError dari jenis error
AVAILABILITY_CHANGED . |
Kasus penggunaan 5: Pesanan ditolak untuk yang tidak diketahui atau tidak dikategorikan alasan. | Kirim OrderUpdate dengan status REJECTED ke
Google. URL 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 dibatalkan atas permintaan pelanggan.
Kasus penggunaan | Cara menerapkan |
---|---|
Kasus penggunaan 1: Pesanan dibatalkan atas permintaan pelanggan | Kirim OrderUpdate dengan status CANCELLED ke
Google. URL 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 dipenuhi.
Kasus penggunaan | Cara menerapkan |
---|---|
Kasus penggunaan 1: Pesanan terpenuhi | Kirim OrderUpdate dengan status FULFILLED ke
Google. URL 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 pengiriman
Contoh di bawah menunjukkan AsyncOrderUpdateRequestMessage
untuk
pengiriman pesanan yang sedang
dikirim ke pelanggan.
Kasus penggunaan | Cara menerapkan |
---|---|
Kasus penggunaan 1: Pesanan pengiriman sedang dalam pengiriman. | Mengirim OrderUpdate dengan status IN_TRANSIT
ke Google. URL 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 pelanggan.
Kasus penggunaan | Cara menerapkan |
---|---|
Kasus penggunaan 1: Pesanan siap diambil. | Kirim OrderUpdate dengan READY_FOR_PICKUP
ke Google. URL 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
dipersiapkan oleh restoran.
Kasus penggunaan | Cara menerapkan |
---|---|
Kasus penggunaan 1: Pesanan sedang disiapkan oleh restoran. | Kirim OrderUpdate dengan IN_PREPARATION
ke Google. URL 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 dilakukan
pada pesanan pelanggan.
Kasus penggunaan 1: Perkiraan waktu pemenuhan perlu diperbarui. | Kirim OrderUpdate ke Google dengan status pesanan,
actionOrderId , userVisibleOrderId ,
orderManagementAction , dan versi
estimatedFulfillmentTime . |
Kasus penggunaan 2: Harga total pesanan perlu diperbarui. | Kirim OrderUpdate ke Google dengan status pesanan,
actionOrderId , userVisibleOrderId ,
orderManagementAction , estimatedFulfillmentTime ,
dan totalPrice yang diupdate. |
Kasus penggunaan 3: Tindakan pengelolaan pesanan pada pesanan harus diperbarui. | Kirim OrderUpdate ke Google dengan status pesanan,
actionOrderId , userVisibleOrderId ,
estimatedFulfillmentTime , dan versi
orderManagementActions . |
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" } } } }