Contents
On this page
Record Payment - Plugixa Boat Rental
POST /pbr/v1/payments
Record a payment taken outside the plugin against a booking, as the office does by hand. The booking’s amount paid, payment status and status follow from it.
An API key PRO with Read and write access, or a signed-in user with the plugixa_boatrental_create capability.
Note. Nothing stops an amount larger than the booking still owes: the payment is recorded in full, and the part above the total is noted in the row’s
response.overpayment. The same goes for a payment on a cancelled booking, which counts in full as overpayment. Nothing is charged or sent to a payment provider: this only writes to the ledger.
Request
POST https://your-site.example/wp-json/pbr/v1/payments
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
booking_id |
integer |
Yes | The booking. Must exist and not be in the trash. |
amount |
number |
Yes | More than 0, with a dot for decimals. Rounded to four decimals. |
type |
string |
No | full (the default), deposit or balance, plus any type a Pro app adds. A label for the ledger: the booking’s paid state is worked out from the amounts alone. |
gateway |
string |
No | The payment method’s id, such as offline (the default). Must be one the site has. |
method |
string |
No | How the money was taken, when a Pro app offers a list of methods (cash at the counter, for example). Refused when no app offers that one. |
The payment is recorded as completed. Then the booking is worked out again from all its payments: paid in full becomes payment status paid and status paid, paid in part becomes deposit_paid and confirmed. A booking that is cancelled or completed keeps its status. The payment.captured webhook and, when the booking is now paid in full and emails are on, the payment email follow.
{
"booking_id": 412,
"amount": 100,
"type": "deposit",
"gateway": "offline"
}
Responses
201 Created. data is the new ledger row.
{
"success": true,
"data": {
"id": 233,
"booking_id": 412,
"gateway": "offline",
"transaction_id": null,
"type": "deposit",
"amount": 100.0,
"currency": "EUR",
"status": "completed",
"response": { "source": "manual" },
"created_by": 0,
"modified_by": 0,
"created_at": "2026-11-12 09:45:00",
"updated_at": null,
"modified_at": "2026-11-12 09:45:00",
"deleted_at": null,
"booking_ref": "BOAT-7F3A91",
"gateway_label": "Pay on arrival"
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The ledger row’s id |
data.booking_id |
integer |
The booking it was recorded against |
data.booking_ref |
string|null |
That booking’s reference |
data.amount |
number |
The amount recorded |
data.currency |
string |
The booking’s currency |
data.status |
string |
Always completed here |
data.response |
object |
source is manual; method when one was sent; overpayment when the amount went past the booking’s total |
data.gateway_label |
string |
The payment method’s name, or the method’s when one was sent |
data.created_at |
string |
UTC datetime |
Read the booking again with Get Booking to see its new amount_paid, payment_status and status. A key cannot read the payments ledger itself.
Errors
| Status | Code | When |
|---|---|---|
422 |
plugixa_boatrental_invalid_booking |
booking_id is missing, or the booking does not exist or is in the trash. |
422 |
plugixa_boatrental_invalid_amount |
amount is missing, 0 or less. |
422 |
plugixa_boatrental_not_a_number |
booking_id or amount is not a number. |
422 |
plugixa_boatrental_negative_number |
booking_id or amount is negative. |
422 |
plugixa_boatrental_number_too_large |
amount is beyond what the ledger holds. |
422 |
plugixa_boatrental_invalid_choice |
type, gateway or method is not one of the allowed values. data.allowed lists them. |
409 |
plugixa_boatrental_payment_not_recorded |
Another payment for the same booking was being written. Try again. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/pbr/v1/payments" \
-H "Authorization: Bearer $PBR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"booking_id":412,"amount":100,"type":"deposit","gateway":"offline"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/pbr/v1/payments');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('PBR_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'booking_id' => 412,
'amount' => 100,
'type' => 'deposit',
'gateway' => 'offline',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/pbr/v1/payments', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.PBR_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ booking_id: 412, amount: 100, type: 'deposit', gateway: 'offline' }),
});
const { data } = await response.json();
Quick Links
Share