{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sitesplaced-com/json-schema/sitesplaced-com-order-input-schema.json",
  "title": "OrderInput",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sitesplaced-com-openapi.json#/components/schemas/OrderInput",
  "type": "object",
  "required": [
    "external_id",
    "totals"
  ],
  "properties": {
    "external_id": {
      "type": "string",
      "description": "The order's id on the other system. Sending the same one again updates the order."
    },
    "number": {
      "type": "string",
      "description": "The order number a shopper sees."
    },
    "status": {
      "type": "string",
      "description": "Read according to `status_kind`."
    },
    "status_kind": {
      "type": "string",
      "enum": [
        "woocommerce",
        "shopify",
        "sitesplaced"
      ],
      "description": "`woocommerce`: WooCommerce status slugs, with or without `wc-`. `shopify`: `open`, `partial`, `fulfilled` or `cancelled`. `sitesplaced`: the six order statuses, plus the aliases `delivered`, `fulfilled`, `processing`, `paid` and `canceled`. A connection key defaults to its platform; any other key defaults to `sitesplaced`."
    },
    "payment": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "unpaid",
            "pending",
            "paid",
            "failed",
            "refunded",
            "partially_refunded"
          ],
          "description": "Send it. If it is missing the server guesses from the status."
        },
        "method": {
          "type": "string"
        },
        "method_title": {
          "type": "string"
        },
        "is_cod": {
          "type": "boolean",
          "description": "True for cash on delivery. This is what turns on the COD risk flags."
        },
        "transaction_id": {
          "type": "string"
        },
        "refunded_amount": {
          "type": "number"
        }
      }
    },
    "currency": {
      "type": "string"
    },
    "totals": {
      "type": "object",
      "required": [
        "total"
      ],
      "properties": {
        "total": {
          "type": "number",
          "minimum": 0
        },
        "discount": {
          "type": "number"
        },
        "shipping": {
          "type": "number"
        },
        "cod_fee": {
          "type": "number"
        },
        "tax": {
          "type": "number"
        }
      }
    },
    "customer": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "phone": {
          "type": "string"
        },
        "address_line1": {
          "type": "string"
        },
        "address_line2": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "state": {
          "type": "string"
        },
        "postcode": {
          "type": "string"
        },
        "country": {
          "type": "string"
        }
      }
    },
    "items": {
      "type": "array",
      "description": "Up to 200 line items are kept.",
      "items": {
        "type": "object",
        "properties": {
          "external_product_id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "variant": {
            "type": "string"
          },
          "quantity": {
            "type": "number"
          },
          "unit_price": {
            "type": "number"
          },
          "image_url": {
            "type": "string"
          }
        }
      }
    },
    "note": {
      "type": "string"
    },
    "tracking": {
      "type": "object",
      "properties": {
        "number": {
          "type": [
            "string",
            "null"
          ]
        },
        "courier": {
          "type": [
            "string",
            "null"
          ]
        },
        "url": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601, in UTC."
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Older than the copy SitesPlaced holds → ignored (`action: \"unchanged\"`)."
    },
    "admin_url": {
      "type": "string",
      "description": "The order's admin address on the other system."
    },
    "deleted": {
      "type": "boolean",
      "description": "True archives the copy. It is never hard-deleted."
    },
    "test": {
      "type": "boolean",
      "description": "True → skipped."
    },
    "delivered": {
      "type": "boolean"
    }
  }
}