Contents
Issue Invoice - Plugixa Car Rental
POST /plugixa-car-rental/v1/bookings/{id}/invoice
Issue the invoice for a booking now, rather than waiting for it to be completed.
Needs the Invoices app on. The user needs the plugixa_car_rental_create capability.
A confirmed, picked_up, returned or completed booking can be invoiced. A booking is invoiced once: the invoice freezes the seller, the customer and the price lines as they are, and is never changed. When a booking is completed, its invoice is issued on its own.
Note. Asking again for a booking that already has an invoice answers
201with the existing invoice, unchanged. Nothing new is issued.
Request
POST https://your-site.example/wp-json/plugixa-car-rental/v1/bookings/128/invoice
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The booking’s id |
Responses
201 Created. data is the invoice.
{
"success": true,
"data": {
"id": 7,
"number": "INV-2026-00007",
"issued_at": "2026-12-04 09:20:00",
"total": 197.1,
"currency": "EUR",
"url": "https://your-site.example/wp-admin/admin-post.php?action=plugixa_car_rental_invoice&invoice=7&_wpnonce=3f9a1c2b7d"
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The invoice’s id |
data.number |
string |
Invoice number: your prefix, the year and a sequence that restarts each year |
data.issued_at |
string |
UTC datetime it was issued |
data.total |
number |
The booking’s total when it was issued |
data.currency |
string |
Currency code |
data.url |
string |
Address of the printable invoice in the admin |
url opens the printable invoice in wp-admin, for a signed-in user. It carries a nonce made for the session that asked, so a link fetched by a script may not open in someone else’s browser. plugixa_car_rental_invoice_issued fires for a new invoice.
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_car_rental_not_found |
No booking with that id, or it is in the trash. |
409 |
plugixa_car_rental_not_invoiceable |
The booking is pending, cancelled, no_show or expired. |
409 |
plugixa_car_rental_busy |
Another invoice was being issued at that moment. Try again. |
500 |
plugixa_car_rental_insert_failed |
The invoice could not be written. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-car-rental/v1/bookings/128/invoice" \
-u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-rental/v1/bookings/128/invoice');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
]);
$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-car-rental/v1/bookings/128/invoice', {
method: 'POST',
headers: {
'Authorization': `Basic ${auth}`,
},
});
const { data } = await response.json();
Quick Links
Share