GOCheap Developers

Tạo chuyến

POST
/bookings

Tạo chuyến từ báo giá còn hiệu lực. Chuyến được phát cho tài xế ngay (sandbox thì không). Gửi lại cùng Idempotency-Key trong 24 giờ sẽ nhận lại đúng chuyến đã tạo, không tạo thêm.

Authorization

ApiKeyAuth
headerAuthorization<token>

Authorization: ApiKey <key>. Key sandbox bắt đầu bằng gc_test_, production bằng gc_live_. Key chỉ hiện một lần lúc tạo. Không dùng key trong app di động hay trình duyệt.

Header Parameters

Idempotency-Key?string

Chuỗi ngẫu nhiên (khuyến nghị UUID) để chống tạo trùng khi gửi lại request.

Lengthlength <= 64

Request Body

application/json
  1. body
quote_id*string
partner_reference_id*string

Mã đơn bên đối tác, duy nhất trong tài khoản đối tác.

Lengthlength <= 64
customer*
vehicle?

Xe của khách (dịch vụ lái hộ)

flight_code?string

Số hiệu chuyến bay nếu đón ở sân bay

Lengthlength <= 20
payment_method?string

cash: khách trả tài xế. partner_invoice: đối tác thanh toán theo kỳ (cần được mở trong hợp đồng).

Default"cash"
Value in"cash""partner_invoice"
note?string

Ghi chú cho tài xế

Lengthlength <= 500

Response Body

Đã tạo chuyến

application/json
  1. response
success*boolean
data*
Example Request
curl -X POST 'https://api-stag.gocheap.vn/open-api/v1/bookings' \  -H 'Content-Type: application/json' \  -d '{  "quote_id": "qt_7Hc2kP9xLm",  "partner_reference_id": "HTL-20261112-0042",  "customer": {    "name": "Nguyễn Văn An",    "phone": "0912345678"  },  "vehicle": {    "model": "Toyota Vios",    "license_plate": "30A-123.45"  },  "note": "Khách đợi ở sảnh A"}'
Example Response
{  "success": true,  "data": {    "booking_id": "string",    "partner_reference_id": "string",    "service": "thue-tai-xe",    "status": "searching",    "pick_up": {      "place_id": "string",      "name": "string",      "address": "string",      "lat": 0.1,      "lng": 0.1    },    "destination": {      "place_id": "string",      "name": "string",      "address": "string",      "lat": 0.1,      "lng": 0.1    },    "pick_up_time": "2019-08-24T14:15:22Z",    "ways": "one_way",    "distance_m": 0,    "price": 0,    "final_price": 0,    "currency": "VND",    "payment_method": "cash",    "customer": {      "name": "string",      "phone": "string",      "external_id": "string"    },    "driver": {      "name": "string",      "phone": "string",      "rating": 0,      "eta_s": 0,      "location": {        "lat": 0.1,        "lng": 0.1,        "updated_at": "2019-08-24T14:15:22Z"      }    },    "cancellation": {      "cancelled_by": "client",      "reason": "string",      "cancelled_at": "2019-08-24T14:15:22Z"    },    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z"  }}