Contents
On this page

Refund Payment - Plugixa Car Parking

POST /plugixa-car-parking/v1/payments/{id}/refund

Refund a completed payment, in full or in part. A payment taken online is refunded at its payment provider first; the refund is then recorded on the ledger as a row of its own, and the booking’s paid state is worked out again.

The user needs the plugixa_carparking_edit capability.

Note. An amount you send is capped by what the booking has been paid net of earlier refunds, not by the amount of this payment. On a booking paid in two parts, a refund against the smaller payment can ask for more than that payment held; the payment provider may then refuse it. Leave amount out to refund this payment in full, or what is left of the booking’s payments if that is less.

Request

POST https://your-site.example/wp-json/plugixa-car-parking/v1/payments/32/refund

Path parameters

Name Type Description
id integer The payment to refund

Request body

Content type: application/json

Field Type Required Description
amount number No More than zero, with a dot for decimals. Omitted or an empty string, the payment is refunded in full (up to what the booking has been paid).

Where the money goes. When the payment has a transaction id and its method can refund (Stripe, PayPal, Mollie, Adyen and Klarna PRO), the plugin asks the provider to refund it and records the provider’s refund reference as the new row’s transaction_id. A payment recorded by staff, or one taken with offline, is refunded on the ledger only: hand the money back yourself.

The booking follows the ledger: after a partial refund that leaves something paid it becomes confirmed with payment_status deposit_paid; once nothing is left paid, a booking that was paid or confirmed becomes refunded with payment_status unpaid.

{
  "amount": 15
}

Responses

201 Created. data is the refund, a new row on the ledger.

{
  "success": true,
  "data": {
    "id": 33,
    "booking_id": 57,
    "gateway": "stripe",
    "transaction_id": "re_3QxY7d2eZvKYlo2C1e2f3g4h",
    "type": "refund",
    "amount": 15,
    "currency": "EUR",
    "status": "completed",
    "response": { "refund_of": 32 },
    "created_by": 1,
    "modified_by": 1,
    "created_at": "2026-11-30 11:12:00",
    "updated_at": null,
    "modified_at": "2026-11-30 11:12:00",
    "deleted_at": null,
    "booking_ref": "PKG-3F9A1C",
    "gateway_label": "Credit / debit card (Stripe)"
  }
}
Field Type Meaning
data.id integer The refund’s own id
data.type string Always refund
data.amount number The amount refunded, positive
data.transaction_id string|null The provider’s refund reference, null for a refund on the ledger only
data.response.refund_of integer The payment refunded

Errors

Status Code When
404 plugixa_carparking_not_found No payment with that id.
422 plugixa_carparking_not_refundable The payment is itself a refund, or is not completed.
422 plugixa_carparking_not_a_number amount is not a number.
422 plugixa_carparking_negative_number amount is negative.
422 plugixa_carparking_invalid_amount amount is zero.
422 plugixa_carparking_refund_too_large amount is more than the booking has been paid, or it has already been refunded in full. data.max gives what can still be refunded.
409 plugixa_carparking_booking_unavailable The payment’s booking is in the trash or no longer exists. Restore the booking first.
409 plugixa_carparking_gateway_unavailable The payment was taken online, but its payment method is no longer set up.
502 plugixa_carparking_gateway_refund_failed The payment provider refused the refund. The message carries the provider’s reason.
409 plugixa_carparking_payment_not_recorded The refund could not be recorded, for example because another refund for the booking was being saved. Try again.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-car-parking/v1/payments/32/refund" \
  -u "admin:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"amount":15}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-car-parking/v1/payments/32/refund');
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' => 15]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-car-parking/v1/payments/32/refund', {
  method: 'POST',
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ amount: 15 }),
});
const { data } = await response.json();

Quick Links

Share