Contents
On this page

Adjust Voucher Balance - Plugixa PDF Vouchers for WooCommerce

POST /plugixa-pdf-vouchers/v1/vouchers/{id}/adjust

Add value to a voucher or take some off, with a reason, like Adjust balance on the voucher page. Writes an adjust line. Adding value to a used-up voucher makes it active again. A balance can never go below zero.

Needs a user with the plugixa_pdfv_edit 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.

Request

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

Path parameters

Name Type Description
id integer The voucher’s id

Request body

Content type: application/json

Field Type Required Description
amount number Yes Positive to add, negative to remove. Not 0.
note string Yes The reason, kept in the history.
{
  "amount": 10,
  "note": "Goodwill: late delivery"
}

Responses

200 OK. data is the voucher with its history, as in Get Voucher.

{
  "success": true,
  "data": {
    "id": 95,
    "code": "PX-M9P2-FU55",
    "code_norm": "PXM9P2FU55",
    "kind": "mpv",
    "status": "active",
    "currency": "EUR",
    "initial_amount": 30,
    "balance": 40,
    "uses_allowed": 0,
    "uses_count": 0,
    "product_id": 0,
    "variation_id": 0,
    "order_id": 0,
    "order_item_id": 0,
    "allowed_product_ids": [],
    "allowed_category_ids": [],
    "buyer_user_id": 0,
    "buyer_email": "",
    "recipient_name": "Claire Morel",
    "recipient_email": "claire.morel@example.net",
    "from_name": "",
    "message": "Sorry for the wait during your last visit. Your next tea is on us.",
    "template_id": 1,
    "locale": "en_US",
    "vendor_id": 0,
    "source": "manual",
    "deliver_at": null,
    "delivered_at": "2026-11-07 16:51:19",
    "expires_at": "2027-02-05 16:50:39",
    "created_by": 1,
    "created_at": "2026-11-07 16:50:39",
    "updated_at": "2026-11-20 10:40:12",
    "version": 3,
    "batch": "",
    "recipient_phone": "",
    "meta": [],
    "is_expired": false,
    "order_url": "",
    "service": null,
    "transactions": [
      {
        "id": 175,
        "voucher_id": 95,
        "type": "issue",
        "amount": 30,
        "balance_after": 30,
        "order_id": 0,
        "ref_id": 0,
        "actor_user_id": 1,
        "source": "manual",
        "location": "",
        "note": "",
        "meta": null,
        "created_at": "2026-11-07 16:50:39"
      },
      {
        "id": 190,
        "voucher_id": 95,
        "type": "adjust",
        "amount": 10,
        "balance_after": 40,
        "order_id": 0,
        "ref_id": 0,
        "actor_user_id": 7,
        "source": "admin",
        "location": "",
        "note": "Goodwill: late delivery",
        "meta": null,
        "created_at": "2026-11-20 10:40:12"
      }
    ],
    "deliveries": [
      {
        "id": "88",
        "channel": "email",
        "recipient": "claire.morel@example.net",
        "status": "sent",
        "last_error": "",
        "sent_at": "2026-11-07 16:51:19",
        "created_at": "2026-11-07 16:51:19"
      }
    ],
    "pdf_url": "https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/pdf/95?expires=1795180412&sig=...&inline=1"
  }
}

The sig of pdf_url is shortened here.

Errors

Status Code When
401 / 403 plugixa_pdfv_forbidden The caller lacks the capability.
404 plugixa_pdfv_not_found No voucher with that id.
422 plugixa_pdfv_invalid_amount amount is 0: Enter an amount other than zero.
422 plugixa_pdfv_note_required No reason: Give a reason for the adjustment.
422 plugixa_pdfv_insufficient Removing more than the balance.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/vouchers/95/adjust" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"amount":10,"note":"Goodwill: late delivery"}'
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/vouchers/95/adjust');
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([
        'amount' => 10,
        'note'   => 'Goodwill: late delivery',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/vouchers/95/adjust', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ amount: 10, note: 'Goodwill: late delivery' }),
});
const { data } = await response.json();

Quick Links

Share