Contents
On this page
Price Return - Plugixa POS for WooCommerce
POST /plugixa-pos/v1/orders/{id}/return-quote
The amount the chosen items would pay back. Nothing is refunded.
Needs a user with the plugixa_pos_refund 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/orders/4460/return-quote
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The order’s id |
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
lines |
object[] |
Yes | 1 to 500 rows: item_id (the order line, from Get Refundable Items) and qty. |
{
"lines": [
{
"item_id": 8989,
"qty": 1
}
]
}
Responses
200 OK.
{
"success": true,
"data": {
"amount": "27.00"
}
}
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_pos_not_found |
Not a register order. |
422 |
plugixa_pos_invalid_line |
A line is not on this sale. |
422 |
plugixa_pos_nothing_refunded |
No quantity chosen. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-pos/v1/orders/4460/return-quote" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"lines":[{"item_id":8989,"qty":1}]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/orders/4460/return-quote');
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([
'lines' => [
[
'item_id' => 8989,
'qty' => 1,
],
],
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/orders/4460/return-quote', {
method: 'POST',
headers: {
'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ lines: [{ item_id: 8989, qty: 1 }] }),
});
const { data } = await response.json();
Quick Links
Share