İlk Rezervasyon (Uçtan Uca)
Bu rehber, otel araması yapıp rezervasyon oluşturmaya kadar tüm akışı adım adım anlatır.
1. Erişim Tokenu Alın
TOK=$(curl -s -X POST https://example.com/apiv2/partner-api/v1/oauth/token \
-H "Content-Type: application/json" \
-d '{
"grant_type": "client_credentials",
"client_id": "YOUR_CID",
"client_secret": "YOUR_SECRET",
"scope": "hotels:read reservations:write"
}' | jq -r '.data.access_token')
2. Otel Arayın
curl -X POST https://example.com/apiv2/partner-api/v1/hotels/search \
-H "Authorization: Bearer $TOK" \
-H "Content-Type: application/json" \
-d '{
"destination": {"type": "CITY", "id": 1},
"check_in": "2026-06-01",
"check_out": "2026-06-05",
"rooms": [{"adults": 2, "children_ages": []}],
"client_nationality": "TR",
"currency": "TRY"
}'
Yanıtta gelen her offer.offer_id 15 dakika geçerlidir ve yalnızca bir kez rezervasyona dönüştürülebilir.
3. Rezervasyon Oluşturun
curl -X POST https://example.com/apiv2/partner-api/v1/reservations/hotel \
-H "Authorization: Bearer $TOK" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"offer_id": "off_XXXX",
"client_reference_id": "BOOK-2026-00123",
"client_nationality": "TR",
"contact": {
"name": "Ahmet", "surname": "Yılmaz",
"email": "[email protected]",
"phone_country_code": "+90", "phone_number": "5551234567"
},
"guests": [
{
"type": "ADULT", "name": "Ahmet", "surname": "Yılmaz",
"birth_date": "1985-01-15", "gender": "MALE", "nationality": "TR",
"identity": {"type": "TC", "number": "12345678901"},
"is_lead": true
}
],
"payment": {"mode": "account"}
}'
Ödeme Modları
| Mod | Davranış |
|---|---|
account | Cari bakiyeden düşülür; rezervasyon doğrudan CONFIRMED olarak oluşur |
instant | PENDING_PAYMENT durumunda oluşur. Müşteriyi payment.url adresine yönlendirin; ödeme tamamlandığında reservation.confirmed webhook bildirimi gelir |
4. Voucher İndirin
Rezervasyon CONFIRMED durumuna geçtiğinde:
curl https://example.com/apiv2/partner-api/v1/reservations/BWZFKU/voucher \
-H "Authorization: Bearer $TOK"
Yanıtta gelen voucher.url, imzalı bir PDF bağlantısıdır ve 1 saat geçerlidir. Kimlik doğrulama gerektirmez; imzalı token URL'in içindedir.
Sonraki Adımlar
- Voucher detayları
- Webhook abonelikleri
- İptal akışı —
POST /reservations/{ref}/cancel