Contents
On this page

Push Display State - Plugixa POS for WooCommerce

PUT /plugixa-pos/v1/customer-display/state

The register sends the current cart; the display picks it up. Text is cleaned and cut on the server. POST and PATCH work the same way.

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

PUT https://your-site.example/wp-json/plugixa-pos/v1/customer-display/state

Request body

Content type: application/json

Field Type Required Description
register_id integer Yes The register.
state object Yes status (idle, cart, pay, thanks), store, up to 100 lines (name, detail, qty, total), and text subtotal, discount, tax, total, paid, change. With pay: qr (a PNG data URL) and provider.
{
  "register_id": 1,
  "state": {
    "status": "cart",
    "store": "Maison Plugixa Marais",
    "lines": [
      {
        "name": "Canvas tote - Natural",
        "qty": 1,
        "total": "25,00 €"
      }
    ],
    "total": "25,00 €"
  }
}

Responses

200 OK. data.version goes up with each change.

{
  "success": true,
  "data": {
    "version": 42
  }
}

Errors

Status Code When
403 plugixa_pos_register_forbidden The register is missing or archived, or the user may not use it.
413 plugixa_pos_display_too_big The state is larger than 24000 bytes.

Plus the errors every endpoint can return.

Examples

curl -s -X PUT "https://your-site.example/wp-json/plugixa-pos/v1/customer-display/state" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"register_id":1,"state":{"status":"cart","store":"Maison Plugixa Marais","lines":[{"name":"Canvas tote - Natural","qty":1,"total":"25,00 €"}],"total":"25,00 €"}}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/customer-display/state');
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([
        'register_id' => 1,
        'state'       => [
            'status' => 'cart',
            'store'  => 'Maison Plugixa Marais',
            'lines'  => [
                [
                    'name'  => 'Canvas tote - Natural',
                    'qty'   => 1,
                    'total' => '25,00 €',
                ],
            ],
            'total'  => '25,00 €',
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/customer-display/state', {
  method: 'PUT',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ register_id: 1, state: { status: 'cart', store: 'Maison Plugixa Marais', lines: [{ name: 'Canvas tote - Natural', qty: 1, total: '25,00 €' }], total: '25,00 €' } }),
});
const { data } = await response.json();

Quick Links

Share