Contents
On this page

Record Payment - Plugixa Car Rental

POST /plugixa-car-rental/v1/bookings/{id}/payments

Record money taken at the desk (cash, card terminal, transfer) against a booking.

Needs the Payments app, which is always on. The user needs the plugixa_car_rental_create capability.

Note. Recording a payment on a pending booking confirms it, as a payment online does. If the confirmation is refused (its car was taken, say), the payment stays recorded, the booking stays pending, and plugixa_car_rental_payment_unplaced fires. The booking’s amount_paid and payment_status are brought up to date either way.

Request

POST https://your-site.example/wp-json/plugixa-car-rental/v1/bookings/128/payments

Path parameters

Name Type Description
id integer The booking’s id

Request body

Content type: application/json

Field Type Required Description
amount number Yes More than 0 and at most what the booking still owes. Rounded to 2 decimals.
note string No Your note, up to 255 characters.
{
  "amount": 197.1,
  "note": "Card at the counter"
}

Responses

201 Created. data is the new ledger row.

{
  "success": true,
  "data": {
    "id": 41,
    "gateway": "desk",
    "gateway_label": "desk",
    "type": "desk",
    "amount": 197.1,
    "currency": "EUR",
    "status": "completed",
    "transaction_id": "",
    "note": "Card at the counter",
    "created_at": "2026-12-01 09:10:00"
  }
}
Field Type Meaning
data.id integer The ledger row’s id
data.gateway string desk for money taken or given back at the desk, else the online payment method’s id, such as stripe or paypal
data.gateway_label string That method’s name. For desk, the id itself
data.type string desk for a desk payment, refund for money given back, or what an online payment paid for, such as full, balance or part
data.amount number Always positive. A refund counts against what was paid

Errors

Status Code When
404 plugixa_car_rental_not_found No booking with that id, or it is in the trash.
422 plugixa_car_rental_invalid amount is not above 0, or is more than the booking still owes. data.field is amount.
503 plugixa_car_rental_busy Another payment for this booking was being recorded. Try again in a moment.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-car-rental/v1/bookings/128/payments" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"amount":197.1,"note":"Card at the counter"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-rental/v1/bookings/128/payments');
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([
        'amount' => 197.1,
        'note'   => 'Card at the counter',
    ]),
]);
$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/payments', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${auth}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ amount: 197.1, note: 'Card at the counter' }),
});
const { data } = await response.json();

Quick Links

Share