Contents
On this page

Resend Voucher Email - Plugixa PDF Vouchers for WooCommerce

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

Send the voucher email with its PDF again, like Resend email on the voucher page. It always sends at once, even for a gift scheduled for later with Pro. With Pro text messages, the text goes out again too.

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/26/resend

Path parameters

Name Type Description
id integer The voucher’s id

Request body

Content type: application/json

Field Type Required Description
email string No A new recipient address. It is saved on the voucher before sending.
{}

Responses

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

The request succeeds even when the email fails: read the newest entry of deliveries. A failed or skipped entry carries the reason in last_error, for example No email address on the voucher.

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_email The email address is not valid.

Plus the errors every endpoint can return.

Examples

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

Quick Links

Share