Book API
The Book API is the final step in the booking flow. It submits the reservation to the supplier and returns a bookingId and confirmation voucher. Before calling Book, you must have called Pricing — and you should have called BookInit first if your flow takes the user through a payment page.
BookInit → Book — the recommended sequence
BookInit and Book accept the same request structure. The difference is timing and purpose.
User clicks Pay
Before redirecting to the payment page, call BookInit. For suppliers that support hold bookings, this reserves the rate for up to 10 minutes. For others, it creates a database entry with no supplier action. Implement it regardless — as more suppliers adopt hold booking, you will be ready with no code changes.
Payment succeeds
Call Book immediately after payment confirmation. ZentrumHub submits the booking to the supplier and returns a bookingId and voucher to send to the customer.
What to pass in the request
Both BookInit and Book require the same fields:
allGuestInfoRequired field from the Price API response. If true, you must pass full details for every guest. If false, type and age (for children) is sufficient.Payment details — depends on your account configuration and supplier requirements. If a credit card is required, pass it in the request. ZentrumHub forwards it to the supplier and does not store or charge it.
👻 Handling ghost bookings — required implementation
A ghost booking occurs when the Book API times out or returns a failure, but the supplier has actually processed the reservation in the background. If you show the user a hard failure and let them retry, you risk a duplicate booking.
Ghost booking recovery — implement this
When Book returns a timeout (error 5002) or non-confirmed status, do not show a hard error. Instead, start polling Get Booking Details:
Call Get Booking Details every 3-5 seconds
Continue for up to 3 minutes (approximately 20–30 polling attempts)
If status returns confirmed — show the user the booking confirmation
If still unconfirmed after 5 minutes — show an error and advise the user to contact support with their correlationId
Error codes
| Code | Message |
|---|---|
| 4000 | Mandatory fields missing in request |
| 4001 | Invalid data in request — refer to fields[] for details |
| 4004 | Hotel is sold out |
| 4005 | Price has changed — re-run Pricing and show new price to user |
| 4006 | Rate has expired — restart from search |
| 4007 | Booking with same details already exists |
| 4008 | Insufficient funds on credit card |
| 5000 | Unknown system error — contact support with correlationId |
| 5001 | Unknown supplier error — contact support with correlationId |
| 5002 | Timeout — start ghost booking recovery flow immediately |
| 5004 | Booking confirmation pending from supplier — start ghost booking recovery flow |
Updated 23 days ago