Contents
On this page
Update Settings - Plugixa Chauffeur
POST /plugixa-chauffeur/v1/settings
Change the settings you send and keep the others.
Needs the WordPress manage_options capability (an administrator). The chauffeur capabilities are not enough.
Note. Any key is stored, including keys the plugin does not know, so a typo in a key name saves a setting nothing reads. Check the key names against Get Settings.
Request
POST https://your-site.example/wp-json/plugixa-chauffeur/v1/settings
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
any setting key |
mixed |
No | A key from Get Settings with its new value. |
stripe_secret_key |
string |
No | An empty value means “unchanged”: a saved secret cannot be cleared through this endpoint. |
stripe_webhook_secret |
string |
No | The same. |
A merge: keys you leave out keep their value. items_per_page and first_day_of_week are saved as integers; the payment_*_enabled, email_enabled and delete_data_on_uninstall keys as booleans; the payment instructions keep their line breaks; other text is saved as plain text. stripe_secret_key_set and stripe_webhook_secret_set are ignored.
{
"currency": "EUR",
"payment_wire_enabled": true,
"payment_wire_instructions": "IBAN FR76 3000 6000 0112 3456 7890 189"
}
Responses
200 Saved. data is every setting afterwards, secrets hidden.
{
"success": true,
"message": "Settings updated.",
"data": {
"items_per_page": 20,
"currency": "EUR",
"currency_position": "left",
"distance_unit": "km",
"date_format": "M j, Y",
"time_format": "H:i",
"first_day_of_week": 1,
"google_maps_api_key": "AIzaSyExampleKey123",
"default_booking_status": "pending",
"payment_cash_enabled": true,
"payment_cash_label": "",
"payment_cash_instructions": "Please pay the driver in cash at pickup.",
"payment_wire_enabled": true,
"payment_wire_label": "",
"payment_wire_instructions": "IBAN FR76 3000 6000 0112 3456 7890 189",
"payment_pickup_enabled": true,
"payment_pickup_label": "",
"payment_pickup_instructions": "You can pay by card to the driver at pickup.",
"payment_stripe_enabled": true,
"stripe_publishable_key": "pk_live_51ExampleKey",
"stripe_secret_key": "",
"stripe_webhook_secret": "",
"email_enabled": true,
"email_from_name": "Riviera Chauffeurs",
"email_from_address": "bookings@your-site.example",
"email_admin_recipients": "dispatch@your-site.example",
"delete_data_on_uninstall": false,
"stripe_secret_key_set": true,
"stripe_webhook_secret_set": true
}
}
| Field | Type | Meaning |
|---|---|---|
data.currency |
string |
Site currency, used when a form has none |
data.distance_unit |
string |
km or mi |
data.payment_*_enabled |
boolean |
Which payment methods the wizard offers. Stripe is offered only when it is enabled and a secret key is saved |
Errors
| Status | Code | When |
|---|---|---|
varies |
varies |
Code added through the plugixa_chauffeur_validate_settings filter refused the change. Nothing is saved. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-chauffeur/v1/settings" \
-u "admin:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"currency":"EUR","payment_wire_enabled":true,"payment_wire_instructions":"IBAN FR76 3000 6000 0112 3456 7890 189"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-chauffeur/v1/settings');
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([
'currency' => 'EUR',
'payment_wire_enabled' => true,
'payment_wire_instructions' => 'IBAN FR76 3000 6000 0112 3456 7890 189',
]),
]);
$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/settings', {
method: 'POST',
headers: {
'Authorization': `Basic ${auth}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
currency: 'EUR',
payment_wire_enabled: true,
payment_wire_instructions: 'IBAN FR76 3000 6000 0112 3456 7890 189',
}),
});
const { data } = await response.json();
Quick Links
Share