Contents
On this page
Apply Coupon - Plugixa Car Rental
POST /plugixa-car-rental/v1/public/coupon
Apply a coupon to a held booking, or remove it with an empty code. The booking is priced again with the same dates, car and extras.
Public: no sign-in and no nonce. Needs the Booking form app on. Rate limited to 20 requests an hour per visitor address: see Public routes. The code is checked only when the Coupons app is on.
Note. A refused code answers
422plugixa_car_rental_coupon_refused, but the booking has already been priced again without any coupon. A coupon applied earlier is gone: read the booking again rather than assuming it kept its old price.
Request
POST https://your-site.example/wp-json/plugixa-car-rental/v1/public/coupon
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
token |
string |
Yes | The token Hold Car returned. |
coupon |
string |
No | The code, in any case. Empty removes the coupon. |
{
"token": "ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb",
"coupon": "WINTER10"
}
Responses
200 OK. data is the booking at its new price.
{
"success": true,
"data": {
"reference": "CR-2026-0128",
"status": "pending",
"vehicle_model_name": "Peugeot 3008",
"pickup_location_name": "Paris Gare de Lyon",
"return_location_name": "Paris Gare de Lyon",
"pickup_local": "2026-12-01 10:00 CET",
"return_local": "2026-12-04 10:00 CET",
"days": 3,
"hold_expires_at": "2026-11-12T09:45:00Z",
"customer_name": "",
"customer_email": "",
"payment_method": "",
"currency": "EUR",
"line_items": [
{
"type": "rental",
"label": "Peugeot 3008, 3 days",
"quantity": 3.0,
"unit_price": 65.0,
"total": 195.0
},
{
"type": "extra",
"label": "Child seat",
"quantity": 1.0,
"unit_price": 24.0,
"total": 24.0
},
{
"type": "coupon",
"label": "Coupon WINTER10",
"quantity": 1.0,
"unit_price": -21.9,
"total": -21.9
}
],
"subtotal": 219.0,
"discount_total": 21.9,
"tax_total": 0.0,
"total": 197.1,
"deposit": 800.0,
"amount_paid": 0.0,
"payment_status": "unpaid",
"payment_options": [
{
"type": "full",
"amount": 197.1,
"label": ""
}
]
}
}
| Field | Type | Meaning |
|---|---|---|
data.line_items |
object[] |
Price lines: type, label, quantity, unit_price, total |
data.total |
number |
What the customer pays |
data.discount_total |
number |
The coupon’s discount, as a positive number |
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_car_rental_not_found |
No booking has that token, or it is in the trash. |
422 |
plugixa_car_rental_coupon_refused |
The code is unknown, unpublished, not valid yet, expired, used up, or the rental is too short for it. The message says which. |
409 |
plugixa_car_rental_booking_closed |
The booking is no longer pending. |
409 |
plugixa_car_rental_unknown_model |
The booking’s model was deleted for good. |
409 |
plugixa_car_rental_unknown_location |
A location the booking uses was deleted for good. |
422 |
plugixa_car_rental_not_priced |
The booking can no longer be priced: no published rate covers it. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-car-rental/v1/public/coupon" \
-H "Content-Type: application/json" \
-d '{"token":"ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb","coupon":"WINTER10"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-rental/v1/public/coupon');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'token' => 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb',
'coupon' => 'WINTER10',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-car-rental/v1/public/coupon', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
token: 'ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb',
coupon: 'WINTER10',
}),
});
const { data } = await response.json();
Quick Links
Share