Booking API¶
The Booking API allows you to check availability and create direct bookings from a website or application.
Authentication¶
Authorization: Bearer your_api_token
Content-Type: application/json
POST /api/v1/airdoo/availability¶
Checks availability for a period and calculates the price.
Request Body¶
{
"accommodation_id": 1,
"checkin": "2026-06-15",
"checkout": "2026-06-20",
"guest_count": 2,
"extras": {
"breakfast": true,
"linen": false,
"late_checkin": false
}
}
| Parameter | Type | Required | Description |
|---|---|---|---|
accommodation_id |
integer | ✅ | Accommodation ID |
checkin |
string (YYYY-MM-DD) | ✅ | Arrival date |
checkout |
string (YYYY-MM-DD) | ✅ | Departure date |
guest_count |
integer | ❌ | Number of guests (default: 2) |
extras.breakfast |
boolean | ❌ | Breakfast |
extras.linen |
boolean | ❌ | Linen |
extras.late_checkin |
boolean | ❌ | Late check-in |
Example¶
curl -X POST "https://your-odoo.com/api/v1/airdoo/availability" \
-H "Authorization: Bearer your_token" \
-H "Content-Type: application/json" \
-d '{
"accommodation_id": 1,
"checkin": "2026-06-15",
"checkout": "2026-06-20",
"guest_count": 2
}'
Response — Available¶
{
"success": true,
"data": {
"available": true,
"nights": 5,
"pricing": {
"total": 850.00,
"per_night": 170.00,
"cleaning_fee": 80.00,
"extras_total": 0.00,
"breakdown": {
"nights_cost": 770.00,
"cleaning": 80.00
}
},
"restrictions": {
"min_stay": 2,
"max_stay": 30
},
"message": "Available"
}
}
Response — Not Available¶
{
"success": true,
"data": {
"available": false,
"message": "These dates are not available",
"nights": 0,
"pricing": null,
"restrictions": null
}
}
Validation Rules¶
checkinmust be in the futurecheckoutmust be strictly aftercheckin- The stay must respect the accommodation's
min_stay(for direct bookings)
POST /api/v1/airdoo/bookings¶
Creates a direct booking. Use this after confirming availability and completing the Stripe payment.
Request Body¶
{
"accommodation_id": 1,
"partner_data": {
"title": "Mr.",
"first_name": "John",
"last_name": "Smith",
"email": "john.smith@email.com",
"phone": "+44712345678",
"address": {
"street": "123 Example Street",
"city": "London",
"zip": "SW1A 1AA",
"country": "United Kingdom"
}
},
"booking_data": {
"checkin_date": "2026-06-15",
"checkout_date": "2026-06-20",
"adults_count": 2,
"children_count": 1,
"babies_count": 0,
"guest_notes": "Wedding anniversary",
"payment_method": "stripe",
"expected_amount": 850.00,
"idempotency_key": "pi_3Abc123_1740744000",
"payment_intent_id": "pi_3Abc123"
},
"extras": {
"breakfast": false,
"linen": false,
"late_checkin": false
}
}
| Parameter | Description | Required |
|---|---|---|
accommodation_id |
Accommodation ID | ✅ |
partner_data.first_name |
First name | ✅ |
partner_data.last_name |
Last name | ✅ |
partner_data.email |
Guest email | ✅ |
booking_data.checkin_date |
Arrival date | ✅ |
booking_data.checkout_date |
Departure date | ✅ |
booking_data.adults_count |
Number of adults | ✅ |
booking_data.payment_method |
"stripe" or "bank_transfer" |
✅ |
booking_data.expected_amount |
Expected amount (verified by Odoo) | ✅ |
booking_data.idempotency_key |
Unique key to prevent duplicates | ✅ |
booking_data.payment_intent_id |
Stripe PaymentIntent ID | ❌ |
Example¶
curl -X POST "https://your-odoo.com/api/v1/airdoo/bookings" \
-H "Authorization: Bearer your_token" \
-H "Content-Type: application/json" \
-d '{
"accommodation_id": 1,
"partner_data": {
"first_name": "John",
"last_name": "Smith",
"email": "john.smith@email.com"
},
"booking_data": {
"checkin_date": "2026-06-15",
"checkout_date": "2026-06-20",
"adults_count": 2,
"payment_method": "stripe",
"expected_amount": 850.00,
"idempotency_key": "pi_3Abc123_1740744000"
}
}'
Response¶
{
"success": true,
"data": {
"booking_id": 456,
"booking_name": "S00456",
"status": "confirmed",
"checkin_date": "2026-06-15",
"checkout_date": "2026-06-20",
"nights": 5,
"total_amount": 850.00,
"partner": {
"id": 789,
"name": "John Smith",
"email": "john.smith@email.com"
},
"message": "Booking created successfully"
}
}
GET /api/v1/airdoo/bookings/<id>¶
Retrieves the details of an existing booking.
Example¶
curl -X GET "https://your-odoo.com/api/v1/airdoo/bookings/456" \
-H "Authorization: Bearer your_token"
Recommended Direct Booking Flow¶
1. GET /api/v1/airdoo/health → Check API is available
2. POST /api/v1/airdoo/calendar → Display availability in the calendar
3. POST /api/v1/airdoo/availability → Confirm availability + get price
4. [Stripe] Create PaymentIntent → Frontend/backend side
5. [Stripe] Confirm payment → Guest enters their card
6. POST /api/v1/airdoo/bookings → Create booking with payment_intent_id
7. GET /api/v1/airdoo/bookings/<id> → Verify the created booking
Operation order
Always create the Odoo booking after Stripe payment confirmation,
never before. The idempotency_key (based on payment_intent_id) protects against
duplicate creation in case of network issues.
Next.js Integration¶
See Next.js Integration for a complete implementation with Stripe.
← Back: Calendar API | Next: Webhooks →