Contents
On this page

Download Voucher PDF - Plugixa PDF Vouchers for WooCommerce

GET /plugixa-pdf-vouchers/v1/pdf/{id}

The voucher’s PDF file. The links in voucher emails, in My Account and in pdf_url of Get Voucher all point here.

Either a signed link (expires and sig, see Signed links), or a signed-in user who holds plugixa_pdfv_view, bought the voucher, or has the buyer’s or the recipient’s email address.

Request

GET https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/pdf/26?expires=1795179133&sig=3526abd1d39101d6e51be3adadd7b17d97daea63af778a5b598a41f3000b8152

Path parameters

Name Type Description
id integer The voucher’s id

Query parameters

Field Type Required Description
expires integer With sig The link’s end, as a Unix time.
sig string No The signature. Without it, the signed-in user is checked instead.
inline boolean No 1 opens the PDF in the browser; otherwise it downloads.

Responses

200 OK. The PDF itself, not JSON.

Headers: Content-Type: application/pdf, Content-Disposition: attachment; filename="voucher-PX-GHMR-PKT5.pdf" (or inline), X-Robots-Tag: noindex, nofollow, and no caching.

Errors

Status Code When
404 plugixa_pdfv_not_found No such voucher, or the link is expired, altered, or for a code that has changed: Voucher not found.
500 plugixa_pdfv_pdf_failed The PDF could not be made.

Plus the errors every endpoint can return.

Examples

curl -s "https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/pdf/26?expires=1795179133&sig=3526abd1d39101d6e51be3adadd7b17d97daea63af778a5b598a41f3000b8152" \
  -o "voucher-PX-GHMR-PKT5.pdf"
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/pdf/26?expires=1795179133&sig=3526abd1d39101d6e51be3adadd7b17d97daea63af778a5b598a41f3000b8152');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
]);
file_put_contents('voucher-PX-GHMR-PKT5.pdf', curl_exec($ch));
curl_close($ch);
const response = await fetch('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/pdf/26?expires=1795179133&sig=3526abd1d39101d6e51be3adadd7b17d97daea63af778a5b598a41f3000b8152');
const { data } = await response.json();

Quick Links

Share