Contents
On this page
Approve Override - Plugixa POS for WooCommerce
POST /plugixa-pos/v1/staff/override
A manager types their PIN on the cashier’s till to allow one thing the cashier may not do alone. The answer is a one-time token, valid 5 minutes, bound to this register, cashier and action. Send it in an X-Plugixa-Override header with the request it unlocks; for that request the cashier holds the needed capability. The override is written to the audit log.
Needs a user with the plugixa_pos_sell 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. The user must also be allowed to use the register (register access).
Request
POST https://your-site.example/wp-json/plugixa-pos/v1/staff/override
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
register_id |
integer |
Yes | The register. |
manager_id |
integer |
Yes | The approving manager. |
pin |
string |
Yes | 4 to 6 digits. |
action |
string |
Yes | discount (needs plugixa_pos_discount), discount_limit (a discount over the staff_discount_limit setting) or refund (needs plugixa_pos_refund). |
{
"register_id": 1,
"manager_id": 87,
"pin": "1739",
"action": "refund"
}
Responses
201 Created.
{
"success": true,
"data": {
"token": "b1f0c4d2e8a94f37a6c51d0e9b2f7a83",
"expires_in": 300,
"manager": "Emma Laurent"
}
}
Errors
| Status | Code | When |
|---|---|---|
403 |
plugixa_pos_register_forbidden |
The register is missing or archived, or the user may not use it. |
422 |
plugixa_pos_override_invalid |
The approval is not possible. |
403 |
plugixa_pos_override_not_manager |
This person may not approve it. |
403 |
plugixa_pos_pin_wrong |
Wrong PIN. |
429 |
plugixa_pos_pin_locked |
Five wrong PINs: PIN checks for that user, or from that address, are locked for 15 minutes. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-pos/v1/staff/override" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"register_id":1,"manager_id":87,"pin":"1739","action":"refund"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/staff/override');
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([
'register_id' => 1,
'manager_id' => 87,
'pin' => '1739',
'action' => 'refund',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/staff/override', {
method: 'POST',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ register_id: 1, manager_id: 87, pin: '1739', action: 'refund' }),
});
const { data } = await response.json();
Quick Links
Share