Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Para completar la tarea del hito CreateBooking Listo, debes compilar y entregar correctamente el método CreateBooking. Se llama a este método cuando un usuario intenta crear una reserva. Si se crea una reserva exitosa, la respuesta incluye un booking_id único para hacer referencia a la reserva en solicitudes o actualizaciones futuras.
Requisitos de la tarea CreateBooking
10 respuestas CreateBooking correctas con una tasa de error inferior al 10%
Conceptos básicos de CreateBooking
Cuando un usuario inicia una reserva, se envía una solicitud CreateBooking al servidor de reservas del socio. La respuesta a la solicitud indica si la reserva se realizó correctamente o si hubo un error. Si hay una falla en la reserva, la respuesta debe incluir el error de lógica empresarial correspondiente. Por ejemplo, el espacio dejó de estar disponible o el mismo usuario ya lo reservó.
Cuando un usuario crea una reserva, Google te envía su nombre, apellido, número de teléfono y correo electrónico. Para obtener más información, consulta la Política de creación y vinculación de cuentas.
Idempotencia
La comunicación a través de la red no siempre es confiable, y Google puede reintentar las solicitudes HTTP si no se recibe ninguna respuesta. Por este motivo, todos los métodos que mutan el estado deben ser idempotentes:
CreateBooking
UpdateBooking
Para todos los mensajes de solicitud, excepto UpdateBooking, se incluyen tokens de idempotencia a fin de identificar exclusivamente la solicitud. Esto te permite distinguir entre una llamada de REST que se reintentó, con la intención de crear una sola solicitud, y dos solicitudes separadas. Los respectivos IDs de entrada de reserva de los UpdateBooking ayudan a identificarlos de forma única, por lo que no se incluye ningún token de idempotencia en sus solicitudes.
Los siguientes son algunos ejemplos de cómo manejan la idempotencia los servidores de reservas:
Una respuesta HTTP correcta a CreateBooking debe incluir la reserva creada. En algunos casos, el pago se procesa como parte del flujo de reserva. Si se recibe la misma solicitud CreateBookingRequest por segunda vez con el mismo idempotency_token, se debe mostrar la misma respuesta CreateBookingResponse. No se crea una segunda reserva y se le cobra al usuario exactamente una vez, si corresponde.
El requisito de idempotencia se aplica a todos los métodos que mutan el estado.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-07-26 (UTC)"],[],[],null,["# CreateBooking Ready\n\nTo complete the `CreateBooking` Ready milestone task, you need to successfully\nbuild and deliver the `CreateBooking` method. This method is called when a user\nattempts to create a booking. If a successful booking is created, the response\nincludes a unique `booking_id` to refer to the booking for future requests or\nupdates.\n\nCreateBooking task requirements\n-------------------------------\n\n- 10 successful `CreateBooking` responses with an error rate less than 10%.\n\nCreateBooking basics\n--------------------\n\nWhen a user initiates a booking, a `CreateBooking` request is sent to the\npartner Booking Server. The response to the request indicates either a\nsuccessful booking or booking failure. If there is a booking failure, the\nresponse needs to include the business logic error for failure. For example, the\nslot has become unavailable or the slot has been already booked by the same\nuser.\n\nWhen a user creates a booking, Google sends you the user's given name, surname,\nphone number, and email. For more information, see\n[Account matching and creation policy](/actions-center/verticals/reservations/e2e/policies/platform-policies#account_matching_and_creation_policy).\n| **Note:** Business logic errors must be returned in the `CreateBookingResponse.booking_failure` field, rather than through a non-200 HTTP response code.\n| **Warning:** Booking failures because of the unavailability of the slot are considered `CreateBooking` errors. Your integration can be disabled when there are many `CreateBooking` errors. High error rate for `CreateBooking` availability errors indicate that your `BatchAvailabilityLookup` slot click response doesn't accurately reflect real-time inventory.\n\n### Idempotency\n\nCommunication over the network isn't always reliable, and Google can retry HTTP\nrequests if no response is received. For this reason, all methods that mutate\nstate must be idempotent:\n\n- `CreateBooking`\n- `UpdateBooking`\n\nFor every request message, except `UpdateBooking`, idempotency tokens are\nincluded to uniquely identify the request. This lets you distinguish between a\nretried REST call, with the intent to create a single request and two separate\nrequests. The respective booking entry IDs of the `UpdateBooking` help to\nuniquely identify them, so no idempotency token is included in their requests.\n\nThe following are some examples of how Booking Servers handle idempotency:\n\n- A successful\n [`CreateBooking`](/actions-center/verticals/reservations/e2e/reference/booking-server-api-rest/e2e-methods/createbooking-method)\n HTTP response includes the created booking. In some cases, payment is processed\n as part of the booking flow. If the same `CreateBookingRequest` is received a\n second time with the same `idempotency_token`, the same `CreateBookingResponse`\n must be returned. A second booking isn't created, and\n the user is charged exactly once, if applicable.\n\n | **Note:** If a `CreateBooking` attempt fails and the same request is re-sent, your backend must retry the `CreateBooking` request.\n\nThe idempotency requirement applies to all methods that mutate state."]]