Contents
On this page

Till Refund - Plugixa PDF Vouchers for WooCommerce

POST /plugixa-pdf-vouchers/v1/pos/refund

Put back on the voucher the whole amount of a redemption made with Till Redeem, found by its reference. Sending it again answers the first refund with replayed true.

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.

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

Request

POST https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/pos/refund

Request body

Content type: application/json

Field Type Required Description
reference string Yes The reference the redemption was made with.
{
  "reference": "till1-20261120-0042"
}

Responses

201 Created, or 200 with replayed true for a repeat.

{
  "success": true,
  "data": {
    "transaction_id": 813,
    "amount": 20,
    "replayed": false,
    "voucher": {
      "code": "PX-GHMR-PKT5",
      "kind": "mpv",
      "status": "active",
      "currency": "EUR",
      "balance": 56,
      "expires_at": "2027-10-21 12:39:17",
      "usable": true,
      "reason": ""
    }
  }
}

Fields as in Till Redeem. The history line is a refund with the note Till refund of transaction #812.

Errors

Status Code When
401 / 403 plugixa_pdfv_forbidden The caller lacks the capability.
400 rest_invalid_param reference is missing or not in the allowed form.
404 plugixa_pdfv_not_found No redemption was made with this reference.
409 plugixa_pdfv_busy The same reference is being handled right now.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/pos/refund" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"reference":"till1-20261120-0042"}'
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/pos/refund');
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([
        'reference' => 'till1-20261120-0042',
    ]),
]);
$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/refund', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ reference: 'till1-20261120-0042' }),
});
const { data } = await response.json();

Quick Links

Share