Contents
On this page
Enroll Fiscal Device - Plugixa POS for WooCommerce
POST /plugixa-pos/v1/fiscal/devices
Register the public key of a browser running the register, so the sales it records offline can be signed by the device and checked by the server.
Needs a user with the plugixa_pos_sell 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. The user must also be allowed to use the register (register access).
Request
POST https://your-site.example/wp-json/plugixa-pos/v1/fiscal/devices
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
register_id |
integer |
Yes | The register. |
public_key |
string |
Yes | The device’s public key, base64, up to 400 characters. |
{
"register_id": 1,
"public_key": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEExampleKey0000000000000000000000000000000000000000000000000000000000000000000=="
}
Responses
201 Created.
{
"success": true,
"data": {
"id": 1,
"code": "D1",
"register_id": 1,
"last_seq": 0,
"last_hash": "",
"status": "active"
}
}
Errors
| Status | Code | When |
|---|---|---|
403 |
plugixa_pos_register_forbidden |
The register is missing or archived, or the user may not use it. |
422 |
plugixa_pos_device_key |
The key is not valid. |
500 |
plugixa_pos_device_enroll |
The device could not be enrolled. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-pos/v1/fiscal/devices" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"register_id":1,"public_key":"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEExampleKey0000000000000000000000000000000000000000000000000000000000000000000=="}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/fiscal/devices');
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([
'register_id' => 1,
'public_key' => 'MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEExampleKey0000000000000000000000000000000000000000000000000000000000000000000==',
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/fiscal/devices', {
method: 'POST',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ register_id: 1, public_key: 'MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEExampleKey0000000000000000000000000000000000000000000000000000000000000000000==' }),
});
const { data } = await response.json();
Quick Links
Share