Contents
On this page

Update Settings - Plugixa PDF Vouchers for WooCommerce

POST /plugixa-pdf-vouchers/v1/settings

Save settings. PUT works the same way. Send only the keys you change: the others keep their value. Every value is cleaned: numbers outside their range are brought to the nearest limit, and an invalid code pattern saves the default.

Needs a user with the plugixa_pdfv_manage_settings capability (signed in with an Application Password, or the login cookie with an X-WP-Nonce header). Administrators and shop managers get it when the plugin is activated; see Staff access. Changing delete_data_on_uninstall also needs manage_options (a site administrator).

Request

POST https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/settings

Request body

Content type: application/json

Field Type Required Description
code_pattern string No Each # becomes a random letter or digit, at least 7. Capital letters, digits and dashes, 4 to 40 characters. An invalid pattern saves the default PX-####-####.
issue_status string No processing (paid) or completed: when vouchers are created.
default_expiry_days integer No 0 to 3650, 0 never expires.
hold_minutes integer No 10 to 1440: when an unpaid hold is released.
vouchers_buy_vouchers boolean No Allow paying for a voucher with another voucher.
email_copy_to_buyer boolean No Send the buyer a copy of gift vouchers.
balance_rate_limit integer No 1 to 100 balance checks per minute per visitor.
default_template_id integer No The default PDF design, 0 for the design marked as default.
delete_data_on_uninstall boolean No Delete every voucher when the plugin is deleted.
campaigns object[] No Pro campaigns: id, name, type (bonus_percent, bonus_fixed, discount), value, start, end, min. Up to 30.
template_by_locale object No Pro languages: a design per language.
vendor_redeem_any boolean No Pro marketplaces: any vendor takes any voucher.
reminder_days string No Pro expiry reminders: up to three numbers, 1 to 365, comma separated.
verify_threshold number No Pro large vouchers: 0 off.
{
  "default_expiry_days": 730,
  "hold_minutes": 30
}

Responses

200 OK. data.settings is every setting as saved.

{
  "success": true,
  "data": {
    "settings": {
      "currency": "USD",
      "currency_position": "before",
      "currency_decimals": 2,
      "decimal_places": 2,
      "decimal_separator": ".",
      "thousands_separator": ",",
      "date_format": "Y-m-d",
      "records_per_page": 50,
      "delete_data_on_uninstall": false,
      "code_pattern": "PX-####-####",
      "issue_status": "processing",
      "default_expiry_days": 730,
      "hold_minutes": 30,
      "vouchers_buy_vouchers": false,
      "email_copy_to_buyer": true,
      "balance_rate_limit": 10,
      "default_template_id": 0,
      "campaigns": [],
      "template_by_locale": [],
      "vendor_redeem_any": false,
      "reminder_days": "30,7",
      "verify_threshold": 0
    }
  }
}

Errors

Status Code When
401 / 403 plugixa_pdfv_forbidden The caller lacks the capability.
401 / 403 plugixa_pdfv_forbidden Changing delete_data_on_uninstall without manage_options: Only a site administrator can change what deleting the plugin does to the vouchers.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/settings" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"default_expiry_days":730,"hold_minutes":30}'
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/settings');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'default_expiry_days' => 730,
        'hold_minutes'        => 30,
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/settings', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ default_expiry_days: 730, hold_minutes: 30 }),
});
const { data } = await response.json();

Quick Links

Share