Contents
On this page

Refund Booking - Plugixa Chauffeur

POST /plugixa-chauffeur/v1/bookings/{id}/refund

Send money back to the customer through Stripe, all of it or part of it.

Needs a signed-in user with the plugixa_chauffeur_manage capability (administrators have it after activation). The refund is made with the Stripe secret key from Settings.

Note. Only bookings paid by card through Stripe Checkout can be refunded here: the booking must hold a Stripe payment reference (pi_...). Cash, bank transfer and pay-on-pickup bookings answer 409.

Request

POST https://your-site.example/wp-json/plugixa-chauffeur/v1/bookings/42/refund

Path parameters

Name Type Description
id integer The booking’s id

Request body

Content type: application/json

Field Type Required Description
amount number No The amount to refund, in the booking’s currency, at least 0.01. Leave it out to refund everything not refunded yet.

The amount can be sent in the body or the query string. Every successful call is a new refund: do not retry a call that succeeded.

{
  "amount": 20
}

Responses

200 Refunded. data is the booking afterwards.

{
  "success": true,
  "message": "",
  "data": {
    "id": "42",
    "booking_number": "PXC-20261112-0815",
    "booking_form_id": 1,
    "service_type": "distance",
    "transfer_type": "one_way",
    "status": "processing",
    "vehicle_id": 3,
    "driver_id": 2,
    "pickup_address": "Paris Charles de Gaulle Airport, Terminal 2E",
    "pickup_lat": null,
    "pickup_lng": null,
    "dropoff_address": "Hotel Lutetia, 45 Boulevard Raspail, Paris",
    "dropoff_lat": null,
    "dropoff_lng": null,
    "pickup_datetime": "2026-11-20 14:30:00",
    "return_datetime": null,
    "duration_hours": null,
    "distance_km": 32.5,
    "travel_minutes": null,
    "passengers": 2,
    "luggage": 3,
    "customer_name": "Claire Martin",
    "customer_email": "claire.martin@example.com",
    "customer_phone": "+33 6 12 34 56 78",
    "notes": "Flight AF1234, arriving 14:05.",
    "price_base": 20.0,
    "price_distance": 58.5,
    "price_time": 0.0,
    "price_total": 78.5,
    "currency": "EUR",
    "payment_method": "stripe",
    "payment_status": "partially_refunded",
    "payment_reference": "pi_3QaBcD2eZvKYlo2C1x9yAbCd",
    "created_at": "2026-11-12 09:30:00",
    "modified_at": "2026-11-21 10:12:00",
    "vehicle_name": "Mercedes E-Class",
    "driver_name": "Thomas Leroy"
  }
}
Field Type Meaning
data.payment_status string partially_refunded while part of the charge remains, refunded once all of it is refunded
data.status string A full refund also sets the booking to refunded, unless it is already completed, cancelled or refunded

The same outcome is recorded again when Stripe sends its refund.* webhook, so a refund made in the Stripe Dashboard updates the booking too.

Errors

Status Code When
409 rest_error The booking has no Stripe payment to refund, or there is no booking with that id.
502 rest_error Stripe refused or failed the refund, the amount is more than what is left, or no Stripe secret key is set. The message is Stripe’s.
400 rest_invalid_param amount is below 0.01 or not a number.

Plus the errors every endpoint can return.

Examples

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

Quick Links

Share