Contents
Create Booking - Plugixa Chauffeur
POST /plugixa-chauffeur/v1/bookings
Create a booking from your own data, the way staff enter a phone booking in the admin.
Needs a signed-in user with the plugixa_chauffeur_manage capability (administrators have it after activation).
Note. This endpoint stores what you send. It does not calculate the fare, does not run pricing rules, does not check availability or the vehicle’s seats, and sends no booking e-mails. To take a booking with all of that, use Place Booking.
Request
POST https://your-site.example/wp-json/plugixa-chauffeur/v1/bookings
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
status |
string |
No | pending, processing, completed, cancelled, on_hold, refunded or failed. Anything else is saved as pending. Default pending. |
service_type |
string |
No | distance, hourly, or flat with Pro. Stored as sent. Default distance. |
transfer_type |
string |
No | one_way or return. Stored as sent. Default one_way. |
booking_form_id |
integer |
No | The form the booking belongs to. 0 or empty stores null. |
vehicle_id |
integer |
No | The vehicle. 0 or empty stores null. Not checked against existing vehicles. |
driver_id |
integer |
No | The driver PRO. 0 or empty stores null. Not checked against existing drivers. |
pickup_address |
string |
No | Plain text. |
dropoff_address |
string |
No | Plain text. |
pickup_lat |
number |
No | Pickup latitude. |
pickup_lng |
number |
No | Pickup longitude. |
dropoff_lat |
number |
No | Drop-off latitude. |
dropoff_lng |
number |
No | Drop-off longitude. |
pickup_datetime |
string |
No | YYYY-MM-DD HH:MM:SS, site local time. Stored as sent, without a format check. |
return_datetime |
string |
No | The same, for the return leg. |
distance_km |
number |
No | Trip distance. |
duration_hours |
number |
No | Hours booked. |
travel_minutes |
integer |
No | Expected travel time. |
passengers |
integer |
No | Default 1. |
luggage |
integer |
No | Default 0. |
customer_name |
string |
No | Plain text. |
customer_email |
string |
No | Characters not allowed in an e-mail address are removed. Not otherwise validated. |
customer_phone |
string |
No | Plain text. |
notes |
string |
No | Plain text, line breaks kept. |
price_base |
number |
No | Base fare. Default 0. |
price_distance |
number |
No | Distance part of the fare. Default 0. |
price_time |
number |
No | Time part of the fare. Default 0. |
currency |
string |
No | For example EUR. Default empty. |
payment_method |
string |
No | For example cash, wire, pickup or stripe. Stored as sent. |
payment_status |
string |
No | For example unpaid or paid. Stored as sent. Default unpaid. |
Every field is optional: an empty body creates a pending booking with nothing in it. booking_number is generated for you. price_total cannot be sent: it is the sum of price_base, price_distance and price_time. Only the JSON body is read; form-encoded fields are ignored.
{
"status": "processing",
"service_type": "distance",
"transfer_type": "one_way",
"booking_form_id": 1,
"vehicle_id": 3,
"pickup_address": "Paris Charles de Gaulle Airport, Terminal 2E",
"dropoff_address": "Hotel Lutetia, 45 Boulevard Raspail, Paris",
"pickup_datetime": "2026-11-20 14:30:00",
"distance_km": 32.5,
"passengers": 2,
"luggage": 3,
"customer_name": "Claire Martin",
"customer_email": "claire.martin@example.com",
"customer_phone": "+33 6 12 34 56 78",
"price_base": 20,
"price_distance": 58.5,
"currency": "EUR",
"payment_method": "cash"
}
Responses
200 Created. data is the new booking.
A create answers 200, not 201.
{
"success": true,
"message": "",
"data": {
"id": "42",
"booking_number": "PXC-20261112-0815",
"booking_form_id": 1,
"service_type": "distance",
"transfer_type": "one_way",
"status": "processing",
"vehicle_id": 3,
"driver_id": null,
"pickup_address": "Paris Charles de Gaulle Airport, Terminal 2E",
"pickup_lat": null,
"pickup_lng": null,
"dropoff_address": "Hotel Lutetia, 45 Boulevard Raspail, Paris",
"dropoff_lat": null,
"dropoff_lng": null,
"pickup_datetime": "2026-11-20 14:30:00",
"return_datetime": null,
"duration_hours": null,
"distance_km": 32.5,
"travel_minutes": null,
"passengers": 2,
"luggage": 3,
"customer_name": "Claire Martin",
"customer_email": "claire.martin@example.com",
"customer_phone": "+33 6 12 34 56 78",
"notes": null,
"price_base": 20.0,
"price_distance": 58.5,
"price_time": 0.0,
"price_total": 78.5,
"currency": "EUR",
"payment_method": "cash",
"payment_status": "unpaid",
"payment_reference": null,
"created_at": "2026-11-12 09:30:00",
"modified_at": null,
"vehicle_name": "Mercedes E-Class",
"driver_name": null
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
string |
The booking id, as a string |
data.booking_number |
string |
PXC- + the creation date + 4 random digits, unique |
data.status |
string |
pending, processing, completed, cancelled, on_hold, refunded or failed |
data.service_type |
string |
distance, hourly, or flat with Pro |
data.transfer_type |
string |
one_way or return |
data.vehicle_id |
integer|null |
The vehicle, null when none |
data.driver_id |
integer|null |
The driver PRO, null when none |
data.pickup_datetime |
string|null |
Site local time, YYYY-MM-DD HH:MM:SS |
data.distance_km |
number|null |
Trip distance, for distance bookings |
data.duration_hours |
number|null |
Hours booked, for hourly bookings |
data.price_base |
number |
Base fare |
data.price_distance |
number |
Distance part of the fare |
data.price_time |
number |
Time part of the fare |
data.price_total |
number |
What the customer pays. Can differ from the sum of the three parts when a pricing rule or a flat rate set it |
data.payment_status |
string |
unpaid, pending, paid, failed, partially_refunded, refunded or disputed |
data.payment_reference |
string|null |
The Stripe PaymentIntent (pi_...) of a card payment, used for refunds |
data.created_at |
string |
Site local time |
data.vehicle_name |
string|null |
The vehicle’s name, joined in |
data.driver_name |
string|null |
The driver’s name, joined in |
Ids and the columns this endpoint does not convert come back as strings, exactly as the database returns them: compare them as strings or convert them.
Errors
| Status | Code | When |
|---|---|---|
500 |
rest_error |
The database refused the row (“Failed to create booking.”). |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-chauffeur/v1/bookings" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"status":"processing","service_type":"distance","transfer_type":"one_way","booking_form_id":1,"vehicle_id":3,"pickup_address":"Paris Charles de Gaulle Airport, Terminal 2E","dropoff_address":"Hotel Lutetia, 45 Boulevard Raspail, Paris","pickup_datetime":"2026-11-20 14:30:00","distance_km":32.5,"passengers":2,"luggage":3,"customer_name":"Claire Martin","customer_email":"claire.martin@example.com","customer_phone":"+33 6 12 34 56 78","price_base":20,"price_distance":58.5,"currency":"EUR","payment_method":"cash"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-chauffeur/v1/bookings');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'status' => 'processing',
'service_type' => 'distance',
'transfer_type' => 'one_way',
'booking_form_id' => 1,
'vehicle_id' => 3,
'pickup_address' => 'Paris Charles de Gaulle Airport, Terminal 2E',
'dropoff_address' => 'Hotel Lutetia, 45 Boulevard Raspail, Paris',
'pickup_datetime' => '2026-11-20 14:30:00',
'distance_km' => 32.5,
'passengers' => 2,
'luggage' => 3,
'customer_name' => 'Claire Martin',
'customer_email' => 'claire.martin@example.com',
'customer_phone' => '+33 6 12 34 56 78',
'price_base' => 20,
'price_distance' => 58.5,
'currency' => 'EUR',
'payment_method' => 'cash',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = Buffer.from(`admin:${process.env.WP_APP_PASSWORD}`).toString('base64');
const response = await fetch('https://your-site.example/wp-json/plugixa-chauffeur/v1/bookings', {
method: 'POST',
headers: {
'Authorization': `Basic ${auth}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
status: 'processing',
service_type: 'distance',
transfer_type: 'one_way',
booking_form_id: 1,
vehicle_id: 3,
pickup_address: 'Paris Charles de Gaulle Airport, Terminal 2E',
dropoff_address: 'Hotel Lutetia, 45 Boulevard Raspail, Paris',
pickup_datetime: '2026-11-20 14:30:00',
distance_km: 32.5,
passengers: 2,
luggage: 3,
customer_name: 'Claire Martin',
customer_email: 'claire.martin@example.com',
customer_phone: '+33 6 12 34 56 78',
price_base: 20,
price_distance: 58.5,
currency: 'EUR',
payment_method: 'cash',
}),
});
const { data } = await response.json();
Quick Links
Share