CreateBooking 方法
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
要求
CreateBookingRequest
傳回值
CreateBookingResponse
連帶影響
CreateBooking 會占用保留名額,導致該名額無法供其他預訂使用。
標準 gRPC 錯誤代碼
INVALID_ARGUMENT
:因為漏填欄位之類的原因,導致提供的 ClientInformation 無效。
NOT_FOUND
:提供的保留 ID 無效。
RESOURCE_EXHAUSTED
:因為預訂相互衝突之類的問題,時段自建立保留後就不再開放預約。
ALREADY_EXISTS
:客戶在該時段已有預訂。
// Request to create a [ext.maps.booking.partner.v0.Booking] for an inventory
// slot. Consumes the lease.
message CreateBookingRequest {
// The lease that is being confirmed to make this booking
LeaseReference lease_ref = 1;
// Personal information of the client making the appointment
ClientInformation client_information = 2;
// Information about payments. If the booking request does not succeed,
// payment authorizations are automatically canceled.
PaymentInformation payment_information = 3;
// The parameters to be used if the payment is processed by the partner
// (i.e. payment_information.payment_processed_by is equal to
// PROCESSED_BY_PARTNER).
PaymentProcessingParameters payment_processing_parameters = 4;
}
// Response with the created [ext.maps.booking.partner.v0.Booking] for an
// inventory slot
message CreateBookingResponse {
// The created booking
Booking booking = 1;
// The updated user payment option used in this booking.
// If a new payment option was purchased to pay for the booking, this should
// be a newly created user payment option.
// If an already purchased user payment option was used for this booking,
// this should reflect an updated version of that user payment option.
UserPaymentOption user_payment_option = 2;
}
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003eThe \u003ccode\u003eCreateBooking\u003c/code\u003e API creates a booking for an inventory slot using a provided lease, client, payment, and payment processing information.\u003c/p\u003e\n"],["\u003cp\u003eIf successful, it returns the created booking and potentially updated user payment information, consuming the initial lease.\u003c/p\u003e\n"],["\u003cp\u003ePotential errors include invalid client data, invalid lease ID, slot unavailability due to conflict or if the client already has a booking for the given slot.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eCreateBookingRequest\u003c/code\u003e contains lease, client, payment, and processing details, while \u003ccode\u003eCreateBookingResponse\u003c/code\u003e returns the booking and user payment information.\u003c/p\u003e\n"]]],["The `CreateBookingRequest` message initiates a booking, consuming a lease and requiring `LeaseReference`, `ClientInformation`, and `PaymentInformation`. A successful request returns a `CreateBookingResponse` containing the `Booking` details and potentially an updated `UserPaymentOption`. Side effects include lease invalidation. Errors include `INVALID_ARGUMENT` (invalid client info), `NOT_FOUND` (invalid lease), `RESOURCE_EXHAUSTED` (slot unavailable), and `ALREADY_EXISTS` (existing booking). The request also includes optional `PaymentProcessingParameters` for partner-processed payments.\n"],null,["# CreateBooking method\n\n**Request**\n\nCreateBookingRequest\n\n**Return value**\n\nCreateBookingResponse\n\n**Side effects**\n\nCreateBooking consumes a Lease, rendering it invalid for any further bookings.\n\n**Canonical gRPC error codes**\n\n- `INVALID_ARGUMENT` if the provided ClientInformation is invalid, e.g. due to missing fields\n- `NOT_FOUND` if the provided lease ID is not valid.\n- `RESOURCE_EXHAUSTED` (if the slot has become unavailable since creating the lease, e.g. due to a conflicting booking)\n- `ALREADY_EXISTS` (if the client already has a booking for the slot)\n\n```scilab\n// Request to create a [ext.maps.booking.partner.v0.Booking] for an inventory\n// slot. Consumes the lease.\nmessage CreateBookingRequest {\n // The lease that is being confirmed to make this booking\n LeaseReference lease_ref = 1;\n\n // Personal information of the client making the appointment\n ClientInformation client_information = 2;\n\n // Information about payments. If the booking request does not succeed,\n // payment authorizations are automatically canceled.\n PaymentInformation payment_information = 3;\n\n // The parameters to be used if the payment is processed by the partner\n // (i.e. payment_information.payment_processed_by is equal to\n // PROCESSED_BY_PARTNER).\n PaymentProcessingParameters payment_processing_parameters = 4;\n}\n\n// Response with the created [ext.maps.booking.partner.v0.Booking] for an\n// inventory slot\nmessage CreateBookingResponse {\n // The created booking\n Booking booking = 1;\n\n // The updated user payment option used in this booking.\n // If a new payment option was purchased to pay for the booking, this should\n // be a newly created user payment option.\n // If an already purchased user payment option was used for this booking,\n // this should reflect an updated version of that user payment option.\n UserPaymentOption user_payment_option = 2;\n}\n```"]]