Contents
On this page

Upload Wallet Key - Plugixa PDF Vouchers for WooCommerce

POST /plugixa-pdf-vouchers/v1/wallet/settings/{part}

Upload one key file as multipart/form-data. It is checked, encrypted with a key derived from your site’s salts, and never sent back.

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

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/wallet/settings/apple

Path parameters

Name Type Description
part string apple (the pass certificate, .p12), wwdr (Apple’s WWDR certificate, .cer) or google (the service account JSON key)

Request body

Content type: application/json

Field Type Required Description
file file Yes The file, up to 64 KB.
password string For apple The .p12 password.

Responses

200 OK. data is the saved view, as in Get Wallet Settings.

Errors

Status Code When
401 / 403 plugixa_pdfv_forbidden The caller lacks the capability.
422 plugixa_pdfv_wallet No file or a file over 64 KB (Choose the file to upload.), a .p12 that cannot be opened with that password, a file that is not a certificate or a Google key, or a server without OpenSSL. The message says which.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/wallet/settings/apple" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -F "file=@giftcard-pass.p12" \
  -F "password=$P12_PASSWORD"
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/wallet/settings/apple');
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
    CURLOPT_POSTFIELDS     => [
        'file'     => new CURLFile('giftcard-pass.p12'),
        'password' => getenv('P12_PASSWORD'),
    ],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const form = new FormData();
form.append('file', p12File);
form.append('password', process.env.P12_PASSWORD);
const response = await fetch('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/wallet/settings/apple', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
  },
  body: form,
});
const { data } = await response.json();

Quick Links

Share