Contents
On this page

Place Booking - Plugixa Chauffeur

POST /plugixa-chauffeur/v1/public/book

Create a booking the way the booking wizard does: checked, priced on the server, and followed by the booking e-mails.

Public: no login and no capability. The request must carry the booking nonce, see below.

The nonce. A page that shows the [plugixa_chauffeur_booking_form] shortcode carries a nonce for the action plugixa_chauffeur_frontend, in plugixaChauffeurBooking.nonce. Send it back as nonce in the body, or in the X-Plugixa-Chauffeur-Nonce header. A nonce expires within a day, so a page served from a long-lived cache can hold a stale one.

Note. When Stripe Checkout cannot be started, the response is 502, but the booking has already been saved, as pending and unpaid, and its e-mails have gone out.

Request

POST https://your-site.example/wp-json/plugixa-chauffeur/v1/public/book

Request body

Content type: application/json

Field Type Required Description
nonce string Yes The booking nonce, unless sent in the header.
form_id integer Yes A published booking form.
service_type string No distance (the default), hourly, or flat with Pro.
transfer_type string No return doubles the distance part; anything else means one_way.
distance_km number No One-way distance, for distance trips. The plugin does not measure it: send it.
duration_hours number No Hours, for hourly trips.
passengers integer No At least 1 (the default). Vehicles with fewer seats are left out.
pickup_datetime string Yes when availability is on YYYY-MM-DD HH:MM, or with a T between date and time, in the site’s time zone.
vehicle_id integer Yes A published vehicle with enough seats for passengers.
customer_name string Yes Must not be blank.
customer_email string Yes A valid e-mail address.
customer_phone string Depends Required when the form asks for a phone. When sent, 7 to 15 digits, with only spaces and + ( ) - . around them.
pickup_address string No Plain text. Replaced by the route’s pickup label on a flat booking.
dropoff_address string No Plain text. Replaced by the route’s drop-off label on a flat booking.
luggage integer No Number of bags. Not checked against the vehicle.
notes string No Plain text, line breaks kept.
payment_method string No stripe, cash, wire or pickup. A method that is not enabled is replaced by the first enabled one.
route_id integer No The flat-rate route PRO, for flat bookings.
return_url string No For Stripe: the page the customer comes back to. Must be on this site, or the home page is used.

In order, the server checks the nonce, loads the published form, checks the pickup time against the availability rules and then against the form’s own minimum notice, checks the customer details, loads the vehicle, and works out the fare itself: any price in the request is ignored. The booking is saved as pending and unpaid, the booking e-mails go to the customer and the admin (when e-mails are on), and plugixa_chauffeur_booking_created fires.

{
  "nonce": "a1b2c3d4e5",
  "form_id": 1,
  "service_type": "distance",
  "transfer_type": "one_way",
  "distance_km": 32.5,
  "passengers": 2,
  "pickup_datetime": "2026-11-20 14:30",
  "vehicle_id": 3,
  "customer_name": "Claire Martin",
  "customer_email": "claire.martin@example.com",
  "customer_phone": "+33 6 12 34 56 78",
  "pickup_address": "Paris Charles de Gaulle Airport, Terminal 2E",
  "dropoff_address": "Hotel Lutetia, 45 Boulevard Raspail, Paris",
  "luggage": 3,
  "payment_method": "stripe",
  "return_url": "https://your-site.example/book"
}

Responses

200 Booked. data is the new booking’s summary.

{
  "success": true,
  "message": "Booking received.",
  "data": {
    "booking_id": 42,
    "booking_number": "PXC-20261112-0815",
    "status": "pending",
    "price_total": 78.5,
    "currency": "EUR",
    "vehicle_name": "Mercedes E-Class",
    "payment_method": "stripe",
    "payment_label": "Pay online (card)",
    "payment_type": "online",
    "payment_instructions": "",
    "checkout_url": "https://checkout.stripe.com/c/pay/cs_live_a1B2c3D4e5F6"
  }
}
Field Type Meaning
data.booking_id integer The new booking’s id
data.booking_number string Show it to the customer
data.price_total number The fare the server worked out
data.payment_type string online (Stripe) or offline
data.payment_instructions string The method’s instructions from Settings, for offline methods
data.checkout_url string Stripe bookings only: the Stripe Checkout page to send the customer to

After paying, Stripe sends the customer to return_url with plugixa_chauffeur_booking=success, ref (the booking number) and session_id added. Confirm the payment from there with Confirm Stripe Payment; the webhook confirms it too.

Errors

Status Code When
403 rest_error The nonce is missing, wrong or expired (“Security check failed. Please refresh and try again.”).
404 rest_error No published form with form_id.
422 plugixa_chauffeur_unavailable Availability is on and the pickup time is missing or malformed, too soon, beyond the horizon, on a blackout date, on a closed day or outside business hours. The message says which.
400 rest_error The pickup time is sooner than the form’s minimum notice, or malformed while the form has one.
400 rest_error The name is blank or the e-mail invalid, the phone is missing or invalid, the vehicle is not published, or it has too few seats.
500 rest_error The booking could not be saved.
502 rest_error The booking was saved but Stripe Checkout could not be started (Stripe not configured or Stripe refused). The message says why.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-chauffeur/v1/public/book" \
  -H "Content-Type: application/json" \
  -d '{"nonce":"a1b2c3d4e5","form_id":1,"service_type":"distance","transfer_type":"one_way","distance_km":32.5,"passengers":2,"pickup_datetime":"2026-11-20 14:30","vehicle_id":3,"customer_name":"Claire Martin","customer_email":"claire.martin@example.com","customer_phone":"+33 6 12 34 56 78","pickup_address":"Paris Charles de Gaulle Airport, Terminal 2E","dropoff_address":"Hotel Lutetia, 45 Boulevard Raspail, Paris","luggage":3,"payment_method":"stripe","return_url":"https://your-site.example/book"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-chauffeur/v1/public/book');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS     => json_encode([
        'nonce'           => 'a1b2c3d4e5',
        'form_id'         => 1,
        'service_type'    => 'distance',
        'transfer_type'   => 'one_way',
        'distance_km'     => 32.5,
        'passengers'      => 2,
        'pickup_datetime' => '2026-11-20 14:30',
        'vehicle_id'      => 3,
        'customer_name'   => 'Claire Martin',
        'customer_email'  => 'claire.martin@example.com',
        'customer_phone'  => '+33 6 12 34 56 78',
        'pickup_address'  => 'Paris Charles de Gaulle Airport, Terminal 2E',
        'dropoff_address' => 'Hotel Lutetia, 45 Boulevard Raspail, Paris',
        'luggage'         => 3,
        'payment_method'  => 'stripe',
        'return_url'      => 'https://your-site.example/book',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-chauffeur/v1/public/book', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    nonce: 'a1b2c3d4e5',
    form_id: 1,
    service_type: 'distance',
    transfer_type: 'one_way',
    distance_km: 32.5,
    passengers: 2,
    pickup_datetime: '2026-11-20 14:30',
    vehicle_id: 3,
    customer_name: 'Claire Martin',
    customer_email: 'claire.martin@example.com',
    customer_phone: '+33 6 12 34 56 78',
    pickup_address: 'Paris Charles de Gaulle Airport, Terminal 2E',
    dropoff_address: 'Hotel Lutetia, 45 Boulevard Raspail, Paris',
    luggage: 3,
    payment_method: 'stripe',
    return_url: 'https://your-site.example/book',
  }),
});
const { data } = await response.json();

Quick Links

Share