Contents
On this page

Cancel Customer Booking - Plugixa Car Parking

POST /plugixa-car-parking/v1/account/bookings/{ref}/cancel

Cancel a booking on the customer’s behalf, as the cancel button of the customer account page does.

Anyone may call it with the public nonce the plugin’s pages print (see Public routes), but only for a booking they own: the signed-in customer the booking belongs to, or anyone who sends the e-mail on the booking. It counts against the account_change rate limit: 10 an hour per visitor address.

Note. Cancelling only changes the booking’s status to cancelled, which frees its space. Nothing is refunded by this route: a payment already taken stays recorded until staff refund it.

Request

POST https://your-site.example/wp-json/plugixa-car-parking/v1/account/bookings/PKG-3F9A2C/cancel

Path parameters

Name Type Description
ref string The booking reference: letters, digits and hyphens

Request body

Content type: application/json. Send the nonce as security here or in the X-Plugixa-Carparking-Nonce header.

Field Type Required Description
email string No The e-mail on the booking, matched without regard to case. Needed unless the caller is signed in as the booking’s owner.
security string Yes The public nonce, unless sent in the header.

Only a booking whose status is pending, confirmed or paid can be cancelled, and only before the cancellation cut-off set in the settings: that many hours before the entry time (no cut-off by default).

{
  "email": "lucas@example.com"
}

Responses

200 OK. data is the cancelled booking.

{
  "success": true,
  "message": "Your booking has been cancelled.",
  "data": {
    "id": 57,
    "booking_ref": "PKG-3F9A2C",
    "status": "cancelled",
    "payment_status": "unpaid",
    "entry_datetime": "2026-11-20 08:00:00",
    "exit_datetime": "2026-11-23 18:00:00",
    "quantity": 1,
    "total": 48.0,
    "currency": "EUR",
    "location_name": "Airport Parking P1",
    "space_type_name": "Standard car",
    "can_cancel": false,
    "summary_url": ""
  }
}

data has the same fields as a row of List Customer Bookings.

Field Type Meaning
data.status string Now cancelled
data.can_cancel boolean Now false

Errors

Status Code When
403 rest_error The nonce is missing or not valid.
404 rest_error “Booking not found.”: no booking has that reference.
403 rest_error “You are not allowed to manage this booking.”: the caller is not the owner and email does not match.
409 rest_error “This booking can no longer be cancelled.”: its status is not pending, confirmed or paid.
409 rest_error “The cancellation cut-off for this booking has passed.”

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-car-parking/v1/account/bookings/PKG-3F9A2C/cancel" \
  -H "Content-Type: application/json" \
  -H "X-Plugixa-Carparking-Nonce: $PCP_NONCE" \
  -d '{"email":"lucas@example.com"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-parking/v1/account/bookings/PKG-3F9A2C/cancel');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        'Content-Type: application/json',
        'X-Plugixa-Carparking-Nonce: ' . getenv('PCP_NONCE'),
    ],
    CURLOPT_POSTFIELDS     => json_encode([
        'email' => 'lucas@example.com',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-car-parking/v1/account/bookings/PKG-3F9A2C/cancel', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Plugixa-Carparking-Nonce': PCP_NONCE,
  },
  body: JSON.stringify({ email: 'lucas@example.com' }),
});
const { data } = await response.json();

Quick Links

Share