Contents
On this page

Add Stripe Reader - Plugixa POS for WooCommerce

POST /plugixa-pos/v1/stripe-terminal/readers

Register a reader with the code it shows. Without a code, a simulated reader is added (test keys only). The first time, a Stripe location is created from the WooCommerce shop address.

Needs a user with the plugixa_pos_manage_settings capability (signed in with an Application Password, or the login cookie with an X-WP-Nonce header). Administrators hold it; other roles only when you grant it.

Request

POST https://your-site.example/wp-json/plugixa-pos/v1/stripe-terminal/readers

Request body

Content type: application/json

Field Type Required Description
label string No A name, up to 100 characters. Defaults to Card reader.
registration_code string No The code on the reader’s screen. Empty for a simulated reader.
{
  "label": "Counter reader",
  "registration_code": "simulated-wpe"
}

Responses

201 Created.

{
  "success": true,
  "data": {
    "id": "tmr_GvfNXw1Yfn6yE9",
    "label": "Counter reader"
  }
}

Errors

Status Code When
409 plugixa_pos_stripe_test_only A simulated reader with a live key.
409 plugixa_pos_stripe_location Stripe needs the shop address to create a location.
409 plugixa_pos_stripe_not_configured No secret key saved.
502 plugixa_pos_stripe_unreachable Stripe could not be reached.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-pos/v1/stripe-terminal/readers" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"label":"Counter reader","registration_code":"simulated-wpe"}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/stripe-terminal/readers');
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([
        'label'             => 'Counter reader',
        'registration_code' => 'simulated-wpe',
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/stripe-terminal/readers', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ label: 'Counter reader', registration_code: 'simulated-wpe' }),
});
const { data } = await response.json();

Quick Links

Share