CreateBooking 示例和定义
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
CreateBooking 请求和响应示例
CreateBooking 请求
{
"idempotency_token" : "18307119013960637991",
"payment_information" : {
"prepayment_status" : "PREPAYMENT_NOT_PROVIDED"
},
"slot" : {
"confirmation_mode" : "CONFIRMATION_MODE_SYNCHRONOUS",
"duration_sec" : "1800",
"merchant_id" : "1234",
"resources" : {
"party_size" : 2
},
"service_id" : "5678",
"start_sec" : "1606467600"
},
"user_information" : {
"email" : "john.smith@gmail.com",
"family_name" : "Smith",
"given_name" : "John",
"telephone" : "+12091111111",
"user_id" : "1111111111111111111"
}
}
CreateBooking 响应
{
"booking" : {
"booking_id" : "890",
"payment_information" : {
"prepayment_status" : "PREPAYMENT_NOT_PROVIDED"
},
"slot" : {
"confirmation_mode" : "CONFIRMATION_MODE_SYNCHRONOUS",
"duration_sec" : "1800",
"merchant_id" : "1234",
"resources" : {
"party_size" : 2
},
"service_id" : "5678",
"start_sec" : "1606467600"
},
"status" : "CONFIRMED",
"user_information" : {
"email" : "john.smith@gmail.com",
"family_name" : "Smith",
"given_name" : "John",
"telephone" : "+12091111111",
"user_id" : "1111111111111111111"
}
}
}
定义
CreateBooking 请求
// Request to create a Booking for an inventory slot. Consumes the lease if
// provided.
message CreateBookingRequest {
// The inventory slot that is being requested to make this booking.
// If lease_ref is provided, slot must match the lease; slot is provided for
// the partner to verify the lease information.
// If lease_ref is absent, then create the booking for the slot. (required)
Slot slot = 1;
// Personal information of the user making the appointment (required)
UserInformation user_information = 3;
// Information about payments. When payment authorizations are handled by
// Google, if the booking request doesn't succeed, payment authorizations are
// automatically canceled. (optional)
PaymentInformation payment_information = 4;
// 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). (optional)
PaymentProcessingParameters payment_processing_parameters = 5;
// Idempotency token for CreateBooking requests. (required)
//
// This uniquely identifies a booking request. Specifically:
// - If a booking was already created for a CreateBooking request with this
// idempotency token, that booking should be returned.
// - If no booking has been created for a CreateBooking request with this
// idempotency token, this should be considered to be a request for a new
// booking, and **no previously-created booking may be returned**.
//
// If a partner considers the requested booking to be a duplicate of a
// previously-created booking, this request should fail with reason
// BookingFailure.OVERLAPPING_RESERVATION. The partner is responsible for
// determining whether this duplicates a previous booking, but for example the
// partner may consider a booking request to be a duplicate if an existing
// booking has the same party size, time, and email address.
string idempotency_token = 6;
// A string from the user which contains any special requests or additional
// information that they would like to notify the merchant about. (optional)
string additional_request = 7;
// Partner provided offer ID associated with this slot. (optional)
//
// If the offer is no longer available, the booking should not be made, and in
// response.booking_failure should be set to OFFER_UNAVAILABLE.
string offer_id = 9;
}
CreateBooking 响应
// Response with the created Booking for an inventory slot.
message CreateBookingResponse {
// The created booking (required)
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.
// (optional)
UserPaymentOption user_payment_option = 2;
// If creating a booking fails, this field should reflect the business logic
// error (e.g., slot has become unavailable) and all other fields in the
// CreateBookingResponse message are expected to be unset. (required if
// failure occurs)
BookingFailure booking_failure = 3;
}
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[],[],null,["# CreateBooking Samples and Definitions\n\nCreateBooking request and response sample\n-----------------------------------------\n\n### CreateBooking request\n\n {\n \"idempotency_token\" : \"18307119013960637991\",\n \"payment_information\" : {\n \"prepayment_status\" : \"PREPAYMENT_NOT_PROVIDED\"\n },\n \"slot\" : {\n \"confirmation_mode\" : \"CONFIRMATION_MODE_SYNCHRONOUS\",\n \"duration_sec\" : \"1800\",\n \"merchant_id\" : \"1234\",\n \"resources\" : {\n \"party_size\" : 2\n },\n \"service_id\" : \"5678\",\n \"start_sec\" : \"1606467600\"\n },\n \"user_information\" : {\n \"email\" : \"john.smith@gmail.com\",\n \"family_name\" : \"Smith\",\n \"given_name\" : \"John\",\n \"telephone\" : \"+12091111111\",\n \"user_id\" : \"1111111111111111111\"\n }\n }\n\n### CreateBooking response\n\n {\n \"booking\" : {\n \"booking_id\" : \"890\",\n \"payment_information\" : {\n \"prepayment_status\" : \"PREPAYMENT_NOT_PROVIDED\"\n },\n \"slot\" : {\n \"confirmation_mode\" : \"CONFIRMATION_MODE_SYNCHRONOUS\",\n \"duration_sec\" : \"1800\",\n \"merchant_id\" : \"1234\",\n \"resources\" : {\n \"party_size\" : 2\n },\n \"service_id\" : \"5678\",\n \"start_sec\" : \"1606467600\"\n },\n \"status\" : \"CONFIRMED\",\n \"user_information\" : {\n \"email\" : \"john.smith@gmail.com\",\n \"family_name\" : \"Smith\",\n \"given_name\" : \"John\",\n \"telephone\" : \"+12091111111\",\n \"user_id\" : \"1111111111111111111\"\n }\n }\n }\n\nDefinitions\n-----------\n\n### CreateBooking request\n\n // Request to create a Booking for an inventory slot. Consumes the lease if\n // provided.\n message CreateBookingRequest {\n // The inventory slot that is being requested to make this booking.\n // If lease_ref is provided, slot must match the lease; slot is provided for\n // the partner to verify the lease information.\n // If lease_ref is absent, then create the booking for the slot. (required)\n Slot slot = 1;\n\n // Personal information of the user making the appointment (required)\n UserInformation user_information = 3;\n\n // Information about payments. When payment authorizations are handled by\n // Google, if the booking request doesn't succeed, payment authorizations are\n // automatically canceled. (optional)\n PaymentInformation payment_information = 4;\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). (optional)\n PaymentProcessingParameters payment_processing_parameters = 5;\n\n // Idempotency token for CreateBooking requests. (required)\n //\n // This uniquely identifies a booking request. Specifically:\n // - If a booking was already created for a CreateBooking request with this\n // idempotency token, that booking should be returned.\n // - If no booking has been created for a CreateBooking request with this\n // idempotency token, this should be considered to be a request for a new\n // booking, and **no previously-created booking may be returned**.\n //\n // If a partner considers the requested booking to be a duplicate of a\n // previously-created booking, this request should fail with reason\n // BookingFailure.OVERLAPPING_RESERVATION. The partner is responsible for\n // determining whether this duplicates a previous booking, but for example the\n // partner may consider a booking request to be a duplicate if an existing\n // booking has the same party size, time, and email address.\n string idempotency_token = 6;\n\n // A string from the user which contains any special requests or additional\n // information that they would like to notify the merchant about. (optional)\n string additional_request = 7;\n\n // Partner provided offer ID associated with this slot. (optional)\n //\n // If the offer is no longer available, the booking should not be made, and in\n // response.booking_failure should be set to OFFER_UNAVAILABLE.\n string offer_id = 9;\n\n }\n\n### CreateBooking response\n\n // Response with the created Booking for an inventory slot.\n message CreateBookingResponse {\n // The created booking (required)\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 // (optional)\n UserPaymentOption user_payment_option = 2;\n\n // If creating a booking fails, this field should reflect the business logic\n // error (e.g., slot has become unavailable) and all other fields in the\n // CreateBookingResponse message are expected to be unset. (required if\n // failure occurs)\n BookingFailure booking_failure = 3;\n }"]]