Contents
On this page

Start Layaway - Plugixa POS for WooCommerce

POST /plugixa-pos/v1/layaways

Put goods aside against a deposit. The body is the body of Create Sale with payments covering the deposit only, plus deposit. A customer is required, and the deposit is paid in cash or by card.

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/layaways

Request body

Content type: application/json

Field Type Required Description
deposit string Yes Deposit amount, decimal. It must be less than the total and at least the layaway_min_percent setting (10 % by default) of it.
(sale fields) Yes client_uuid, register_id, customer_id, lines, payments… as in Create Sale.
{
  "client_uuid": "0c8e4f6a-1b2d-4e7f-9a3c-5d6e7f8a9b0c",
  "register_id": 1,
  "customer_id": 88,
  "deposit": "10.00",
  "lines": [
    {
      "product_id": 3728,
      "qty": 1
    }
  ],
  "payments": [
    {
      "method": "cash",
      "amount": "10.00"
    }
  ]
}

Responses

201 Created.

{
  "success": true,
  "data": {
    "layaway": {
      "id": 4460,
      "number": "4460",
      "status": "open",
      "customer_id": 88,
      "customer": "Camille Martin",
      "phone": "06 10 20 31 40",
      "register_id": 1,
      "total": "27.00",
      "paid": "10.00",
      "balance": "17.00",
      "lines": [
        {
          "name": "French press 1 L",
          "qty": 1,
          "total": "27.00"
        }
      ],
      "deposits": [
        {
          "ticket": 315,
          "amount": "10.00",
          "methods": "Cash",
          "at": "2026-11-18T20:00:35+00:00"
        }
      ],
      "refund": null,
      "created_at": "2026-11-18T21:00:35+01:00"
    },
    "receipt": {
      "order_id": 4460,
      "order_number": "4460",
      "ticket": 315,
      "date": "November 19, 2026 3:12 pm",
      "store": {
        "name": "Maison Plugixa Marais",
        "address": {
          "address_1": "12 rue des Archives",
          "city": "Paris",
          "postcode": "75004",
          "country": "FR",
          "address_2": ""
        },
        "phone": "",
        "tax_id": "FR 40 123 456 789"
      },
      "register": "R1",
      "cashier": "Emma Laurent",
      "customer": "Camille Martin",
      "currency": "EUR",
      "lines": [
        {
          "name": "Canvas tote - Natural",
          "options": [],
          "qty": 1,
          "subtotal": "25.00",
          "total": "25.00"
        },
        {
          "name": "Greeting card",
          "options": [],
          "qty": 1,
          "subtotal": "4.00",
          "total": "4.00"
        }
      ],
      "discount": "0.00",
      "coupons": [],
      "taxes": [
        {
          "label": "TVA",
          "rate": "20%",
          "amount": "4.83"
        }
      ],
      "tax_total": "4.83",
      "total": "29.00",
      "payments": [
        {
          "method": "cash",
          "label": "Cash",
          "amount": "30.00"
        }
      ],
      "tendered": "30.00",
      "change": "1.00",
      "fiscal": {
        "hash_short": "EC60-5CEF",
        "software": "Plugixa POS 1.0.0"
      },
      "header": "Maison Plugixa\n12 rue des Archives, 75004 Paris",
      "footer": "Exchanges within 30 days with this receipt.\nThank you and see you soon!",
      "refunded": "0.00",
      "status": "completed"
    }
  }
}
Field Type Meaning
data.layaway object The layaway, as in Get Layaway
data.receipt object The receipt of the deposit or payment, as in Get Receipt

Errors

Status Code When
422 plugixa_pos_layaway_customer No customer chosen.
422 plugixa_pos_layaway_full The deposit covers the whole total: make a normal sale.
422 plugixa_pos_layaway_min The deposit is below the minimum. data.min is the minimum.
422 plugixa_pos_layaway_method The deposit is not paid in cash or by card.
409 plugixa_pos_in_progress The sale was already recorded as a normal sale.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-pos/v1/layaways" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -H "Content-Type: application/json" \
  -d '{"client_uuid":"0c8e4f6a-1b2d-4e7f-9a3c-5d6e7f8a9b0c","register_id":1,"customer_id":88,"deposit":"10.00","lines":[{"product_id":3728,"qty":1}],"payments":[{"method":"cash","amount":"10.00"}]}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-pos/v1/layaways');
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([
        'client_uuid' => '0c8e4f6a-1b2d-4e7f-9a3c-5d6e7f8a9b0c',
        'register_id' => 1,
        'customer_id' => 88,
        'deposit'     => '10.00',
        'lines'       => [
            [
                'product_id' => 3728,
                'qty'        => 1,
            ],
        ],
        'payments'    => [
            [
                'method' => 'cash',
                'amount' => '10.00',
            ],
        ],
    ]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-pos/v1/layaways', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ client_uuid: '0c8e4f6a-1b2d-4e7f-9a3c-5d6e7f8a9b0c', register_id: 1, customer_id: 88, deposit: '10.00', lines: [{ product_id: 3728, qty: 1 }], payments: [{ method: 'cash', amount: '10.00' }] }),
});
const { data } = await response.json();

Quick Links

Share