Contents
On this page

Till Balance - Plugixa PDF Vouchers for WooCommerce

GET /plugixa-pdf-vouchers/v1/pos/balance

What a voucher can pay now. Call it before taking a payment. See Plugixa POS and tills.

Needs a user with the plugixa_pdfv_redeem 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. The Pro Voucher staff role has it. For a till, create a user with the Voucher staff role and an Application Password.

Note. Pro only: on the free plugin this route answers 404 rest_no_route.

Request

GET https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/pos/balance?code=PX-GHMR-PKT5

Query parameters

Field Type Required Description
code string Yes The code as printed or scanned.

Responses

200 OK.

{
  "success": true,
  "data": {
    "code": "PX-GHMR-PKT5",
    "kind": "mpv",
    "status": "active",
    "currency": "EUR",
    "balance": 56,
    "expires_at": "2027-10-21 12:39:17",
    "usable": true,
    "reason": ""
  }
}
Field Type Meaning
data.code string The code
data.kind string mpv gift card or spv product voucher
data.status string active, redeemed, expired, void or pending
data.currency string The voucher’s currency
data.balance number What is left, rounded to 2 decimals
data.expires_at string UTC, empty when it never expires
data.usable boolean Whether it can pay now
data.reason string When it cannot, why, in words a cashier can read out

A voucher that cannot pay is still answered 200, with usable false and the reason, for example This voucher has expired.

Errors

Status Code When
401 / 403 plugixa_pdfv_forbidden The caller lacks the capability.
404 plugixa_pdfv_not_found Unknown code: This voucher code is not valid.

Plus the errors every endpoint can return.

Examples

curl -s "https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/pos/balance?code=PX-GHMR-PKT5" \
  -u "$WP_USER:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/pos/balance?code=PX-GHMR-PKT5');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/pos/balance?code=PX-GHMR-PKT5', {
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
  },
});
const { data } = await response.json();

Quick Links

Share