Contents
On this page

Create Extra - Plugixa Car Parking

POST /plugixa-car-parking/v1/booking-extras

Create an extra: a paid add-on the customer can choose on the booking form, such as EV charging or a car wash. See Extras.

Needs Plugixa Car Parking Pro. The WordPress user needs the plugixa_carparking_create capability (create records).

Request

POST https://your-site.example/wp-json/plugixa-car-parking/v1/booking-extras

Request body

Content type: application/json

Field Type Required Description
name string Yes Must not be blank.
price number No Zero or more. Defaults to 0.
price_type string No What the price is multiplied by: per_booking (nothing), per_day (days of the stay), per_hour (hours of the stay) or per_unit (spaces booked). Defaults to per_booking.
max_quantity integer No Zero or more. 0 means no limit. Defaults to 1.
status string No active or inactive. Defaults to active.
description string No HTML. Tags not allowed in a post are stripped.
icon string No Plain text, up to 100 characters.
applies_to object|null No {"locations": [2, 5]} to offer the extra only at those locations. null, an empty string or an empty list means every location.
display_order integer No May be negative. Defaults to 0.

Values the extra does not have are ignored. Only locations is kept from applies_to; a list that holds anything other than a positive location id is refused rather than cleaned. When a customer picks the extra, the quantity they ask for is capped at max_quantity.

{
  "name": "EV charging",
  "description": "<p>Charge your car while it is parked.</p>",
  "price": 12.5,
  "price_type": "per_day",
  "max_quantity": 1,
  "applies_to": {
    "locations": [2, 5]
  }
}

Responses

201 Created. data is the new extra.

{
  "success": true,
  "data": {
    "id": 4,
    "name": "EV charging",
    "description": "<p>Charge your car while it is parked.</p>",
    "icon": null,
    "price": 12.5,
    "price_type": "per_day",
    "max_quantity": 1,
    "applies_to": {
      "locations": [2, 5]
    },
    "status": "active",
    "display_order": 0,
    "created_by": 1,
    "modified_by": 1,
    "created_at": "2026-11-12 09:30:00",
    "modified_at": "2026-11-12 09:30:00",
    "deleted_at": null
  }
}
Field Type Meaning
data.id integer The extra’s id
data.name string Shown to the customer on the booking form
data.price number The price, before price_type multiplies it
data.price_type string per_booking, per_day, per_hour or per_unit
data.max_quantity integer Most a customer can take on one booking. 0 means no limit
data.status string active or inactive
data.description string|null HTML, or null when none was given
data.icon string|null As stored, or null when none was given
data.applies_to object|null {"locations": [ids]} when the extra is offered only at those locations, null when it is offered everywhere
data.display_order integer Lower numbers are listed first on the booking form
data.created_at string UTC datetime
data.modified_at string UTC datetime of the last change. Send it back on an update to have the change refused if somebody else saved first
data.deleted_at string|null null unless the record is in the trash

Errors

Status Code When
422 plugixa_carparking_missing_name name is missing or blank.
422 plugixa_carparking_invalid_choice status or price_type is not one of the accepted values. data.allowed lists them.
422 plugixa_carparking_not_a_number price, max_quantity or display_order is not a number. Use a dot for decimals.
422 plugixa_carparking_number_too_large A number is larger than 99999999.
422 plugixa_carparking_negative_number price or max_quantity is negative.
422 plugixa_carparking_invalid_scope applies_to is not an object whose locations is a list of location ids.
422 plugixa_carparking_too_long A text field is longer than its column holds. data.field names it and data.max gives the limit.
500 plugixa_carparking_insert_failed The database refused the new row.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-car-parking/v1/booking-extras" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"name":"EV charging","description":"<p>Charge your car while it is parked.</p>","price":12.5,"price_type":"per_day","max_quantity":1,"applies_to":{"locations":[2,5]}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-parking/v1/booking-extras');
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([
        'name'         => 'EV charging',
        'description'  => '<p>Charge your car while it is parked.</p>',
        'price'        => 12.5,
        'price_type'   => 'per_day',
        'max_quantity' => 1,
        'applies_to'   => [
            'locations' => [2, 5],
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-car-parking/v1/booking-extras', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ name: 'EV charging', description: '<p>Charge your car while it is parked.</p>', price: 12.5, price_type: 'per_day', max_quantity: 1, applies_to: { locations: [2, 5] } }),
});
const { data } = await response.json();

Quick Links

Share