Contents
On this page

Save Wallet Settings - Plugixa PDF Vouchers for WooCommerce

POST /plugixa-pdf-vouchers/v1/wallet/settings

Save the plain fields of the wallet settings. Keys and certificates are uploaded with Upload Wallet Key.

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

Request body

Content type: application/json

Field Type Required Description
color string No Hex colour of the passes. An invalid one saves #7a1f2b.
apple.pass_type_id string No Up to 120 characters.
apple.team_id string No Up to 20 characters.
apple.org_name string No The name on the pass, up to 120 characters.
google.issuer_id string No Digits only, up to 30.
{
  "color": "#7a1f2b",
  "apple": {
    "pass_type_id": "pass.com.example.giftcard",
    "team_id": "A1B2C3D4E5",
    "org_name": "Maison Willow"
  },
  "google": {
    "issuer_id": "3388000000022123456"
  }
}

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.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/wallet/settings" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"color":"#7a1f2b","apple":{"pass_type_id":"pass.com.example.giftcard","team_id":"A1B2C3D4E5","org_name":"Maison Willow"},"google":{"issuer_id":"3388000000022123456"}}'
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/wallet/settings');
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([
        'color'  => '#7a1f2b',
        'apple'  => [
            'pass_type_id' => 'pass.com.example.giftcard',
            'team_id'      => 'A1B2C3D4E5',
            'org_name'     => 'Maison Willow',
        ],
        'google' => [
            'issuer_id' => '3388000000022123456',
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/wallet/settings', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ color: '#7a1f2b', apple: { pass_type_id: 'pass.com.example.giftcard', team_id: 'A1B2C3D4E5', org_name: 'Maison Willow' }, google: { issuer_id: '3388000000022123456' } }),
});
const { data } = await response.json();

Quick Links

Share