Contents
On this page

Create Supplier Return - Plugixa POS for WooCommerce

POST /plugixa-pos/v1/supplier-returns

Create a draft return. Stock leaves when you send it.

Needs a user with the plugixa_pos_purchase capability (signed in with an Application Password, or the login cookie with an X-WP-Nonce header). Unlike the other capabilities, Pro gives this one to administrators and to the WooCommerce Shop manager role.

Request

POST https://your-site.example/wp-json/plugixa-pos/v1/supplier-returns

Request body

Content type: application/json

Field Type Required Description
supplier_id integer Yes The supplier.
outlet_id integer No The store the goods leave from. Defaults to the home store.
reason string No Up to 500 characters.
lines object[] Yes 1 to 500: product_id (with stock management), qty, optional unit_cost.
{
  "supplier_id": 1,
  "outlet_id": 1,
  "reason": "Damaged in transit",
  "lines": [
    {
      "product_id": 3720,
      "qty": 2
    }
  ]
}

Responses

201 Created.

{
  "success": true,
  "data": {
    "id": 1,
    "number": "RT-000001",
    "supplier_id": 1,
    "supplier_name": "Torréfaction du Marais",
    "outlet_id": 1,
    "outlet_name": "Maison Plugixa Marais",
    "status": "draft",
    "reason": "Damaged in transit",
    "created_at": "2026-10-13 08:00:00",
    "sent_at": null,
    "total": "7.60",
    "items": [
      {
        "product_id": 3720,
        "name": "House espresso beans 250 g",
        "sku": "COF-HOUSE",
        "qty": 2,
        "unit_cost": "3.8000",
        "total": "7.60"
      }
    ]
  }
}

Errors

Status Code When
422 plugixa_pos_not_found No supplier, or the store does not exist.
422 plugixa_pos_empty_return No lines.
422 plugixa_pos_invalid_line A product does not track stock, or a quantity is zero.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-pos/v1/supplier-returns" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"supplier_id":1,"outlet_id":1,"reason":"Damaged in transit","lines":[{"product_id":3720,"qty":2}]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/supplier-returns');
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([
        'supplier_id' => 1,
        'outlet_id'   => 1,
        'reason'      => 'Damaged in transit',
        'lines'       => [
            [
                'product_id' => 3720,
                'qty'        => 2,
            ],
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/supplier-returns', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ supplier_id: 1, outlet_id: 1, reason: 'Damaged in transit', lines: [{ product_id: 3720, qty: 2 }] }),
});
const { data } = await response.json();

Quick Links

Share