同步預訂是指已確認或遭拒的預訂 即時監控業務成效
非同步預訂是指商家確認或 之後拒絕支付
系統會將預訂指定為同步或非同步, 供應情形層級也就是說,對於特定商家和服務 同步和非同步的供應時段可能都會有版位。
為了決定適當的導入方式,首先要找出合適的類別 廣告空間所屬的類別如下:
非同步預訂條件
- 不會修改 Actions Center 上的非同步預訂 支援。
- 商家應能透過 合作夥伴的線上系統 (例如餐廳的代管面板)。呼叫 商家,以判斷商家是否接受 禁止拒絕預訂。
- 不支援商家提議新的預訂時間, 你必須在原始狀態下接受或拒絕預訂要求。
只啟用同步預訂功能
標準導入作業預設為同步預訂。請參閱 詳情請參閱「預訂」端對端整合說明文件。
啟用非同步預訂
如果部分或所有商家採用非同步預訂流程, 必須進行下列變更:
-
確認模式:現在所有供應時段的表示法 包含說明預訂方式的
confirmation_mode
欄位 已確認預訂時段請指定 每個供應時段的confirmation_mode
包括:- 在供應情形動態饋給中,
confirmation_mode
是在 供應情形等級 - 在 Booking Server API 方法中,
confirmation_mode
的指定位置為 版位層級 - 在 Real-Time Updates API 方法中,已指定
confirmation_mode
供應情形等級
- 在供應情形動態饋給中,
- 預訂狀態:所有預訂的表示法都包含一個
代表預訂狀態的
status
欄位。三段 導入了新的非同步狀態值:PENDING_CONFIRMATION
、DECLINED_BY_MERCHANT
和FAILED
。您可使用這些新狀態值 處理建立、拒絕和非同步預訂失敗的情況。 - 預訂更新:所有針對 預訂記錄應透過 Booking Notification API 的 bookings.patch 方法。
下圖顯示確認模式和預訂狀態的使用方式 以執行非同步預訂的方式
![圖 1:非同步預訂流程](https://developers-dot-devsite-v2-prod.appspot.com/static/actions-center/images/enabling_async_1.png?authuser=19&hl=zh-tw)
- 供應情形動態饋給已更新,現在每個供應時段的 已指定確認模式。請務必在 動態饋給,以便我們針對預訂的非同步性質 使用者在流程初期階段
- 時間
BatchAvailabilityLookup
敬上 或CheckAvailability
。 我們會傳送確認模式,理想情況下 。這麼做可確保使用者看到適當的訊息。 - 時間
CreateBooking
敬上 我們就會將確認模式傳送到 指出預期的確認模式。非同步預訂時 要求提交後,預訂會傳回並狀態PENDING_MERCHANT_CONFIRMATION
。 - 商家接受或拒絕預訂要求時,相關預訂 狀態是透過即時更新 Booking Notification API 的 bookings.patch 方法。如果您想要自動拒絕 並透過相同的即時更新的方式及時回應 方法。
供應情形動態饋給
在供應情形動態饋給中,指定各個時段是同步或
非同步顯示方法是設定新的 confirmation_mode
] 欄位。
// Mode by which bookings for an availability slot are confirmed. enum ConfirmationMode { // The confirmation mode was not specified. // Synchronous confirmation will be assumed. CONFIRMATION_MODE_UNSPECIFIED = 0; // Bookings for this availability will be confirmed synchronously. CONFIRMATION_MODE_SYNCHRONOUS = 1; // Bookings for this availability will be confirmed asynchronously. CONFIRMATION_MODE_ASYNCHRONOUS = 2; }
雖然在沒有模式的情況下,系統會預設採用同步確認模式 因此強烈建議你明確指定模式 ,避免因意外遺漏任何資料而造成混淆
非同步
{ "availability": [ { "merchant_id": "10001", "service_id": "1000", "spots_open": 3, "spots_total": 3, "duration_sec": 3600, "start_sec": 1535806800, "resources": { "party_size": 4 }, "confirmation_mode": "CONFIRMATION_MODE_ASYNCHRONOUS" } ] }
同步
{ "availability": [ { "merchant_id": "10001", "service_id": "1000", "spots_open": 3, "spots_total": 3, "duration_sec": 3600, "start_sec": 1535806800, "resources": { "party_size": 4 }, "confirmation_mode": "CONFIRMATION_MODE_SYNCHRONOUS" } ] }
非同步與同步
{ "availability": [ { "merchant_id": "10001", "service_id": "1000", "spots_open": 3, "spots_total": 3, "duration_sec": 3600, "start_sec": 1535806800, "resources": { "party_size": 4 }, "confirmation_mode": "CONFIRMATION_MODE_SYNCHRONOUS" }, { "merchant_id": "10002", "service_id": "1000", "spots_open": 4, "spots_total": 4, "duration_sec": 3600, "start_sec": 1535806800, "resources": { "party_size": 2 }, "confirmation_mode": "CONFIRMATION_MODE_ASYNCHRONOUS" } ] }
預訂伺服器
BatchAvailabilityLookup 或 CheckAvailability
在
BatchAvailabilityLookupResponse
(BAL)
或
CheckAvailabilityResponse
(CA),傳回相同的 confirmation_mode
並透過
BatchAvailabilityLookupRequest
或
CheckAvailabilityRequest
。
BAL-非同步
{ "slot_time_availability": [ { "slot_time": { "duration_sec": "3600", "resource_ids": { "party_size": 3 }, "service_id": "1000", "start_sec": "1546458300", "confirmation_mode": "CONFIRMATION_MODE_ASYNCHRONOUS" }, "available": true } ] }
BAL-同步
{ "slot_time_availability": [ { "slot_time": { "duration_sec": "3600", "resource_ids": { "party_size": 3 }, "service_id": "1000", "start_sec": "1546458300", "confirmation_mode": "CONFIRMATION_MODE_SYNCHRONOUS" }, "available": true } ] }
CA-非同步
{ "slot": { "duration_sec": "3600", "merchant_id": "317652", "resources": { "party_size": 3 }, "service_id": "1000", "start_sec": "1546458300", "confirmation_mode": "CONFIRMATION_MODE_ASYNCHRONOUS" }, "count_available": 1, "duration_requirement": "DO_NOT_SHOW_DURATION" }
CA-同步
{ "slot": { "duration_sec": "3600", "merchant_id": "317652", "resources": { "party_size": 3 }, "service_id": "1000", "start_sec": "1546458300", "confirmation_mode": "CONFIRMATION_MODE_SYNCHRONOUS" }, "count_available": 1, "duration_requirement": "DO_NOT_SHOW_DURATION" }
CreateBooking
請務必使用可用的供應情形傳回正確的預訂狀態 選項如下:
// Status of a booking. // // Updating booking status does not change the status of the associated payment. // Prepayment status updates should be done using the PrepaymentStatus enum. enum BookingStatus { // Not specified. BOOKING_STATUS_UNSPECIFIED = 0; // Booking has been confirmed CONFIRMED = 1; // Booking is awaiting confirmation by the merchant before it can transition // into CONFIRMED status. Only applicable to non-payments Dining or // Beauty verticals. PENDING_MERCHANT_CONFIRMATION = 2; // Booking has been canceled on behalf of the user. // The merchant can still trigger a manual refund. CANCELED = 3; // User did not show for the appointment NO_SHOW = 4; // User did not show for the appointment in violation of the cancellation // policy. NO_SHOW_PENALIZED = 5; // Booking could not be completed by the async backend due to a failure. FAILED = 6; // Booking was asynchronously declined by the merchant. Only applicable to // non-payments Dining or Beauty verticals. DECLINED_BY_MERCHANT = 7; }
在 CreateBookingResponse
中,
針對提供的預訂匯總時段,傳回目前的 confirmation_mode
在 CreateBookingRequest 中設定此外,如果預訂為非同步
將 status
設為 PENDING_MERCHANT_CONFIRMATION
。請確認
confirmation_mode
是使用者和預訂服務
Google 希望避免讓使用者感到困惑。
非同步
{ "booking": { "slot": { "duration_sec": "3600", "merchant_id": "100001", "resources": { "party_size": 2 }, "service_id": "1000", "start_sec": "1546647234", "confirmation_mode": "CONFIRMATION_MODE_ASYNCHRONOUS" }, "user_information": { "email": "johnsmith@gmail.com", "family_name": "John", "given_name": "Smith", "telephone": "+1 800-123-4567", "user_id": "2017492857928759285" }, "payment_information": { "prepayment_status": "PREPAYMENT_NOT_PROVIDED" }, "status": "PENDING_MERCHANT_CONFIRMATION" } }
同步
{ "booking": { "slot": { "duration_sec": "3600", "merchant_id": "100001", "resources": { "party_size": 2 }, "service_id": "1000", "start_sec": "1546647234", "confirmation_mode": "CONFIRMATION_MODE_SYNCHRONOUS" }, "user_information": { "email": "johnsmith@gmail.com", "family_name": "John", "given_name": "Smith", "telephone": "+1 800-123-4567", "user_id": "2017492857928759285" }, "payment_information": { "prepayment_status": "PREPAYMENT_NOT_PROVIDED" }, "status": "CONFIRMED" } }
UpdateBooking
在非同步的初始版本中,使用者修改了現有預訂 不支援。使用者應改為取消預訂, 新的預訂。
即時更新
如要即時更新供應情形,請confirmation_mode
。這適用於下列方法:
廣告空間 RTU (ReplaceServiceAvailability 或 BatchReplaceServiceAvailability)
使用
availability.replace
(批次) 方法
或
services.availability.replace
方法,
將 Availability
中的 confirmation_mode
設為 CONFIRMATION_MODE_ASYNCHRONOUS
非同步
{ "extendedServiceAvailability": [ { "merchantId": "1001", "serviceId": "12310", "startTimeRestrict": "2014-10-02T15:01:23.045123456Z", "endTimeRestrict": "2014-10-02T19:01:23.045123456Z", "availability": [ { "startTime": "2014-10-02T15:30:00.00Z", "duration": "3600s", "spotsOpen": "0", "spotsTotal": "2", "availabilityTag": "1000001", "confirmation_mode": "CONFIRMATION_MODE_ASYNCHRONOUS" } ] } ] }
同步
{ "extendedServiceAvailability": [ { "merchantId": "1001", "serviceId": "12310", "startTimeRestrict": "2014-10-02T15:01:23.045123456Z", "endTimeRestrict": "2014-10-02T19:01:23.045123456Z", "availability": [ { "startTime": "2014-10-02T15:30:00.00Z", "duration": "3600s", "spotsOpen": "0", "spotsTotal": "2", "availabilityTag": "1000001", "confirmation_mode": "CONFIRMATION_MODE_SYNCHRONOUS" } ] } ] }
非同步與同步
{ "extendedServiceAvailability": [ { "merchantId": "1001", "serviceId": "12310", "startTimeRestrict": "2014-10-02T15:01:23.045123456Z", "endTimeRestrict": "2014-10-02T19:01:23.045123456Z", "availability": [ { "startTime": "2014-10-02T15:30:00.00Z", "duration": "3600s", "spotsOpen": "0", "spotsTotal": "2", "availabilityTag": "1000001", "confirmation_mode": "CONFIRMATION_MODE_ASYNCHRONOUS" }, { "startTime": "2014-10-03T11:00:00.00Z", "duration": "5400s", "spotsOpen": "1", "spotsTotal": "1", "availabilityTag": "1000002", "confirmation_mode": "CONFIRMATION_MODE_SYNCHRONOUS" } ] } ] }
Booking Notification API
以非同步方式更新預訂狀態時,必須透過預訂進行 Notification API bookings.patch 方法。
更新狀態時,請務必將 status
欄位名稱加入
updateMask
。
狀態 | 說明 |
---|---|
CONFIRMED | 商家已確認預訂 |
FAILED | 合作夥伴無法向商家確認或拒絕預訂 |
DECLINED_BY_MERCHANT | 商家拒絕預訂 |
Request: PATCH https://mapsbooking.googleapis.com/v1alpha/notification/partners/<PARTNER_ID>/bookings/<BOOKING_ID>?updateMask=status Body: {"name":"partners/<PARTNER_ID>/bookings/<BOOKING_ID>", "status":"DECLINED_BY_MERCHANT"}
如果預訂失敗,請將預訂狀態設為「FAILED
」,並
並指定 Booking_failure如果狀態設為其他項目,
已忽略 booking_failure
。
Request: PATCH https://mapsbooking.googleapis.com/v1alpha/notification/partners/<PARTNER_ID>/bookings/<BOOKING_ID>?updateMask=status&booking_failure.cause="SLOT_UNAVAILABLE" Body: {"name":"partners/<PARTNER_ID>/bookings/<BOOKING_ID>", "status":"FAILED"}
電子郵件通知
針對非同步預訂,系統可能會收到五封與 向使用者顯示的預訂狀態。
PENDING_MERCHANT_CONFIRMATION
CONFIRMED
DECLINED_BY_MERCHANT
FAILED
CANCELED