{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/wenmarpro-com/json-schema/wenmarpro-com-close-body-schema.json",
  "title": "CloseBody",
  "description": "Optional body for close. `charge_to_account` posts the unpaid balance to\nthe customer's account (spec D10; any customer — cash terms add a\n`cash_terms_charged` warning, O1). `invoice_date` (`YYYY-MM-DD`) defaults to\nthe shop's today and must fall inside the posting window (O2). `tenders`\n(plan 67) takes the payment in the same step: without `charge_to_account`\nthey must cover the balance exactly.",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/wenmarpro-com-app-openapi.json#/components/schemas/CloseBody",
  "properties": {
    "by_order_terms": {
      "description": "The order's terms decide cash or charge (plan 408): cash terms need\n`tenders` covering the balance; other terms take none and charge it",
      "type": "boolean"
    },
    "cash_received_cents": {
      "description": "The cash the customer handed over for the cash tender (plan 1599): stored with the change\nso a reprinted receipt shows both. Never refuses the post (`cash_received_ignored`).",
      "format": "int64",
      "type": [
        "integer",
        "null"
      ]
    },
    "charge_to_account": {
      "type": "boolean"
    },
    "complete_first": {
      "description": "Complete and post an in-progress order in one step (plan 408)",
      "type": "boolean"
    },
    "expected_invoice_number": {
      "description": "The invoice number printed from `close/preview/document`; a post that\nwould assign another number is refused (409 `conflict`).",
      "format": "int64",
      "type": [
        "integer",
        "null"
      ]
    },
    "invoice_date": {
      "type": [
        "string",
        "null"
      ]
    },
    "tenders": {
      "items": {
        "$ref": "#/$defs/TenderBody"
      },
      "type": "array"
    }
  },
  "type": "object",
  "$defs": {
    "TenderBody": {
      "description": "One payment type's share of a cash-terms post (plan 67).",
      "properties": {
        "amount_cents": {
          "description": "Cents: > 0 when the order's balance is owed; < 0 (money handed back) on a\ncredit order whose balance is negative. Never 0.",
          "format": "int64",
          "type": "integer"
        },
        "card_last4": {
          "description": "The card's last 4 digits (debit, visa, mastercard, amex, other)",
          "type": [
            "string",
            "null"
          ]
        },
        "method": {
          "description": "cash | cheque | debit | visa | mastercard | amex | other",
          "type": "string"
        },
        "reference": {
          "description": "Cheque or authorization number",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "method",
        "amount_cents"
      ],
      "type": "object"
    }
  }
}