Contents
On this page

Set Commission Rates - Plugixa POS for WooCommerce

PUT /plugixa-pos/v1/reports/staff/rates

Set the default commission rate and per-person rates used by the staff report. POST and PATCH work the same way.

Needs a user with the plugixa_pos_manage_settings capability (signed in with an Application Password, or the login cookie with an X-WP-Nonce header). Administrators hold it; other roles only when you grant it.

Request

PUT https://your-site.example/wp-json/plugixa-pos/v1/reports/staff/rates

Request body

Content type: application/json

Field Type Required Description
default string No Default rate, a percent from 0 to 100 with up to 2 decimals (3 or 2.5).
users object No Rate per user id. An empty value or null removes the person’s own rate.
{
  "default": "3",
  "users": {
    "87": "4.5",
    "102": ""
  }
}

Responses

200 OK.

{
  "success": true,
  "data": {
    "default_rate": "3"
  }
}

Errors

Status Code When
422 plugixa_pos_invalid A rate is not a percent from 0 to 100.
404 plugixa_pos_not_found A user id does not exist.

Plus the errors every endpoint can return.

Examples

curl -s -X PUT "https://your-site.example/wp-json/plugixa-pos/v1/reports/staff/rates" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"default":"3","users":{"87":"4.5","102":""}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/reports/staff/rates');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'PUT',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_POSTFIELDS     => json_encode([
        'default' => '3',
        'users'   => [
            '87'  => '4.5',
            '102' => '',
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/reports/staff/rates', {
  method: 'PUT',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ default: '3', users: { "87": '4.5', "102": '' } }),
});
const { data } = await response.json();

Quick Links

Share