Get Booking Details - Chi Tiết Booking
API Endpoint: GET /api/v1/services/booking/v1/thong-tin-ve/{ve_id}
📋 Overview
Lấy thông tin chi tiết của một booking (vé, hành khách, chặng bay, dịch vụ đã mua).
When to call: After selecting booking from list to view/manage details.
🔌 API Specification
Endpoint
GET {{base_url}}/api/v1/services/booking/v1/thong-tin-ve/{ve_id}
URL Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
ve_id | number | ✅ Yes | Booking ID from list API |
Headers
{
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Bearer {access_token}"
}
✅ Success Response
Status: 200 OK
{
"message": "Lấy thông tin vé thành công",
"data": {
"ve": {
"id": 68,
"pnr": "37UQPF",
"uuid": "b31c2b48-aea3-11f0-8b81-86d224031662",
"trang_thai": 0,
"hang_bay": "VJ",
"so_hieu": "VJ 636",
"hanh_trinh": "SGN - DAD",
"nguoi_dai_dien": "NGUYEN VAN TEST",
"tong_hanh_khach": 1,
"tong_nguoi_lon": 1,
"tong_tre_em": 0,
"tong_em_be": 0,
"ngay_bay": "25-10-2025 20:20:00",
"ngay_book": "22-10-2025 00:31:00",
"ngay_het_han": "22-10-2025 04:31:00",
"ngay_xuat": null,
"gia_net": 1436400,
"gia_fare": 1339400,
"thue": 97000,
"hang_ve": "Eco1",
"quoc_te": false
},
"chang_bay": [
{
"key_chang_bay": "encoded-key",
"hang_bay": "VJ",
"so_hieu": "VJ 636",
"hanh_trinh": "SGN - DAD",
"diem_di": "SGN",
"tinh_di": "Hồ Chí Minh",
"diem_den": "DAD",
"tinh_den": "Đà Nẵng",
"ngay_di": "25-10-2025 20:20:00",
"ngay_den": "25-10-2025 21:40:00",
"thoi_gian_bay": "1h 20m",
"hang_ve": "Z1_ECO",
"loai_hang_ve": "Eco1",
"cabin": "ECONOMY",
"gia_net": 1436400
}
],
"hanh_khach": [
{
"id": 93,
"ve_id": 68,
"ho": "NGUYEN VAN",
"ten": "TEST",
"email": "test@example.com",
"so_dien_thoai": "0987654321",
"ngay_sinh": "01-01-1990",
"loai_hanh_khach": 1,
"danh_xung": 1
}
]
},
"status": "success",
"code": 200
}
📦 Response Structure
Booking Info (ve)
| Field | Type | Description |
|---|---|---|
id | number | Booking ID (ve_id) |
pnr | string | PNR - Booking reference |
uuid | string | Booking UUID |
trang_thai | number | Status: 0 = HOLD, 1 = ISSUED |
hang_bay | string | Airline code ("VJ") |
so_hieu | string | Flight number |
hanh_trinh | string | Route (e.g., "SGN - HAN") |
nguoi_dai_dien | string | Lead passenger name |
tong_hanh_khach | number | Total passengers |
ngay_bay | string | Flight date |
ngay_book | string | Booking date |
ngay_het_han | string/null | Payment deadline (HOLD only) |
ngay_xuat | string/null | Issue date (ISSUED only) |
gia_net | number | Total net price (VND) |
gia_fare | number | Base fare |
thue | number | Tax |
hang_ve | string | Fare class |
quoc_te | boolean | International flight |
Flight Segments (chang_bay)
| Field | Type | Description |
|---|---|---|
key_chang_bay | string | Segment key (for MMB operations) |
hang_bay | string | Airline |
so_hieu | string | Flight number |
diem_di | string | Departure airport code |
tinh_di | string | Departure city |
diem_den | string | Arrival airport code |
tinh_den | string | Arrival city |
ngay_di | string | Departure time |
ngay_den | string | Arrival time |
thoi_gian_bay | string | Flight duration |
cabin | string | Cabin class |
gia_net | number | Segment price |
Passengers (hanh_khach)
| Field | Type | Description |
|---|---|---|
id | number | Passenger ID (hanh_khach_id) |
ve_id | number | Booking ID |
ho | string | Last name |
ten | string | First name |
email | string | |
so_dien_thoai | string | Phone |
ngay_sinh | string | Date of birth |
loai_hanh_khach | number | Type: 1=Adult, 2=Child, 3=Infant |
danh_xung | number | Title: 1=Mr, 2=Mrs, 3=Ms |
💡 Example: cURL
curl -X GET "{{base_url}}/api/v1/services/booking/v1/thong-tin-ve/68" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {access_token}"
Response:
{
"message": "Lấy thông tin vé thành công",
"data": {
"ve": {
"id": 68,
"pnr": "37UQPF",
"trang_thai": 0,
"gia_net": 1436400
},
"chang_bay": [...],
"hanh_khach": [...]
},
"status": "success"
}
🎯 Use Cases
1. Display Booking Details
const { ve, chang_bay, hanh_khach } = response.data;
console.log("PNR:", ve.pnr);
console.log("Status:", ve.trang_thai === 0 ? "HOLD" : "ISSUED");
console.log("Route:", ve.hanh_trinh);
console.log("Flight:", ve.so_hieu);
console.log("Date:", ve.ngay_bay);
console.log("Total:", ve.gia_net.toLocaleString(), "VND");
if (ve.trang_thai === 0) {
console.log("Payment deadline:", ve.ngay_het_han);
}
2. Check if Can Be Modified
const canPay = ve.trang_thai === 0; // HOLD bookings can be paid
const canAddServices = ve.trang_thai === 0; // Usually HOLD only
const canUpdateJourney = true; // Both HOLD and ISSUED (with fees)
console.log("Can pay:", canPay);
console.log("Can add services:", canAddServices);
3. Get IDs for MMB Operations
// Save these for later operations
const ve_id = ve.id; // 68
const hanh_khach_id = hanh_khach[0].id; // 93
const key_chang_bay = chang_bay[0].key_chang_bay; // "encoded-key"
// Use in subsequent API calls
⚠️ Important Notes
1. Save Critical IDs
From response, save these for MMB operations:
STATE.ve_id = response.data.ve.id;
STATE.hanh_khach_id = response.data.hanh_khach[0].id;
STATE.key_chang_bay_0 = response.data.chang_bay[0].key_chang_bay;
2. Status Meanings
if (ve.trang_thai === 0) {
// HOLD - Can pay, add services
// Has payment deadline
} else if (ve.trang_thai === 1) {
// ISSUED - Already paid
// Limited modifications
}
3. Payment Deadline
For HOLD bookings:
const deadline = new Date(ve.ngay_het_han);
const now = new Date();
const hoursLeft = (deadline - now) / (1000 * 60 * 60);
if (hoursLeft < 0) {
console.log("Payment deadline expired!");
} else {
console.log(`${hoursLeft.toFixed(1)} hours left to pay`);
}
4. Multiple Passengers
hanh_khach.forEach((pax, index) => {
console.log(`Passenger ${index + 1}:`, pax.ho, pax.ten);
console.log(" ID:", pax.id); // Use for seat/service assignment
});
🐛 Common Issues
Booking Not Found (404)
Response:
{
"message": "Không tìm thấy vé",
"status": "error"
}
Cause: Invalid ve_id
Solution: Verify ve_id from list API
Unauthorized (401)
Cause: Invalid or expired token
Solution: Re-authenticate
🔗 Next Steps
After getting details, you can:
If HOLD (trang_thai: 0)
-
Payment →
03-PAYMENT.mdPOST /api/v1/services/booking/v1/thanh-toan -
Add Services →
04-UPDATE-SERVICES.mdPOST /api/v1/services/booking/v1/cap-nhat-dich-vu -
Buy Seat →
05-BUY-SEAT.mdPOST /api/v1/services/booking/v1/cap-nhat-cho-ngoi
If ISSUED (trang_thai: 1)
- Update Journey →
06-UPDATE-JOURNEY.mdPOST /api/v1/services/booking/v1/cap-nhat-hanh-trinh
📝 Notes
- Returns complete booking information
- Includes passengers, flights, and services
- Save
ve_id,hanh_khach_id,key_chang_bayfor MMB operations - Check
trang_thaito determine available actions:0(HOLD): Can pay, add services/seats1(ISSUED): Can update journey (with fees)
- HOLD bookings have
ngay_het_han(payment deadline) - ISSUED bookings have
ngay_xuat(issue date)