{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/green-check-verified/main/json-schema/green-check-verified-paged-sales-schema.json",
  "title": "PagedSales",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/green-check-verified-crb-sales-api-openapi.yml#/components/schemas/PagedSales",
  "properties": {
    "metadata": {
      "properties": {
        "total": {
          "$ref": "#/$defs/PositiveInteger"
        },
        "count": {
          "type": "string",
          "description": "Range of items returned"
        }
      },
      "required": [
        "total",
        "count"
      ],
      "type": "object"
    },
    "data": {
      "items": {
        "anyOf": [
          {
            "$ref": "#/$defs/RetailSale"
          },
          {
            "$ref": "#/$defs/WholesaleSale"
          }
        ]
      },
      "type": "array"
    }
  },
  "required": [
    "metadata",
    "data"
  ],
  "type": "object",
  "additionalProperties": false,
  "$defs": {
    "ComplianceStatus": {
      "enum": [
        "unchecked",
        "red_flag",
        "green_checked",
        "warning"
      ],
      "type": "string"
    },
    "FriendlyPosName": {
      "type": "string",
      "enum": [
        "Alleaves",
        "Dutchie",
        "Dutchie Wholesale",
        "Cova",
        "Meadow",
        "MJ Freeway",
        "MJ Freeway Wholesale",
        "Greenbits",
        "GrowFlow",
        "GrowFlow Wholesale",
        "Portal42",
        "Metrc S2S",
        "Metrc S2S Wholesale",
        "Flourish",
        "Flourish Wholesale",
        "Flowhub",
        "BioTrack",
        "BioTrack Wholesale",
        "Treez",
        "Blaze",
        "Quickbooks",
        "Sage Intacct",
        "Canix",
        "Brytemap",
        "POSaBIT",
        "Proteus420",
        "IndicaOnline",
        "Sweed",
        "Weave",
        "Jane",
        "Manual Upload Wholesale",
        "Cova Test Account",
        "Leaf Logix Test Account",
        "BioTrack Test Account",
        "Mj Freeway Test Account",
        "Treez IO Test Account",
        "Green Bits Test Account",
        "Manual Upload Retail",
        "Not Configured",
        "Unsupported",
        "CRBMonitor",
        "Plaid"
      ]
    },
    "IDType": {
      "enum": [
        "drivers",
        "medical",
        "ssn",
        "passport",
        "medical_with_rec",
        "medical_with_state_card",
        "caregiver",
        "minor_medical",
        "temporary_minor_medical",
        "temporary_adult"
      ],
      "type": "string"
    },
    "LocalDateTime": {
      "type": "string",
      "pattern": "^[2][0][0-9]{2}[-]([0][0-9]|[1][0-2])[-]([0-2][0-9]|[3][0-1])\\s([0-1][0-9]|[2][0-3])[:][0-5][0-9][:][0-5][0-9][.][0-9]{3}"
    },
    "MedicalOrRec": {
      "enum": [
        "medical",
        "rec"
      ],
      "type": "string"
    },
    "PaymentType": {
      "enum": [
        "cash",
        "check",
        "debit",
        "credit",
        "multiple",
        "ach",
        "wire",
        "other",
        "unknown"
      ],
      "type": "string"
    },
    "PositiveInteger": {
      "type": "integer",
      "format": "int32",
      "minimum": 0
    },
    "ProductCategoryType": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "flower",
        "oil/concentrate",
        "edible",
        "other",
        "seedling",
        "seed",
        "liquid",
        "solid",
        "extract",
        "plant",
        "accessory",
        "marijuana_product",
        "topical",
        "edible_liquid"
      ]
    },
    "RetailSale": {
      "properties": {
        "id": {
          "$ref": "#/$defs/UUID",
          "description": "Green Check generated ID"
        },
        "pos_sale_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Sale ID in the POS system"
        },
        "crb_id": {
          "$ref": "#/$defs/UUID",
          "description": "ID of the CRB"
        },
        "subtotal": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Pre-tax dollar amount in cents"
        },
        "total_discounts": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Total discount amount in cents"
        },
        "tax_paid": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Tax amount in cents"
        },
        "total_paid": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Price + Tax in cents"
        },
        "date": {
          "$ref": "#/$defs/UtcDateTime",
          "description": "UTC ISO Date of the Sale",
          "type": "string",
          "format": "date-time"
        },
        "local_date": {
          "$ref": "#/$defs/LocalDateTime",
          "description": "Local Date of the Sale",
          "type": "string",
          "pattern": "^[2][0][0-9]{2}[-]([0][0-9]|[1][0-2])[-]([0-2][0-9]|[3][0-1]\\s([0-1][0-9]|[2][0-3])[:][0-5][0-9][:][0-5][0-9]([.][0-9]{1,3})?"
        },
        "gc_created_date": {
          "$ref": "#/$defs/UtcDateTime",
          "description": "Our created / updated dates",
          "type": "string",
          "format": "date-time"
        },
        "gc_updated_date": {
          "$ref": "#/$defs/UtcDateTime",
          "type": "string",
          "format": "date-time"
        },
        "transaction_type": {
          "allOf": [
            {
              "$ref": "#/$defs/TransactionType"
            }
          ],
          "description": "Transaction Type provided by point of sale",
          "type": [
            "string",
            "null"
          ]
        },
        "pos_name": {
          "$ref": "#/$defs/FriendlyPosName",
          "description": "Point of Sale that the sale originated from"
        },
        "type": {
          "$ref": "#/$defs/SaleTypeRetail"
        },
        "employee_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Employee ID"
        },
        "line_items": {
          "items": {
            "$ref": "#/$defs/SaleLineItem"
          },
          "type": "array",
          "description": "Sale Line Items"
        },
        "discounts": {
          "items": {
            "$ref": "#/$defs/SaleDiscount"
          },
          "type": "array",
          "description": "Sale Discounts"
        },
        "taxes": {
          "items": {
            "$ref": "#/$defs/SaleTax"
          },
          "type": "array",
          "description": "Sale Taxes"
        },
        "payments": {
          "items": {
            "$ref": "#/$defs/SalePayment"
          },
          "type": "array",
          "description": "Payment type and amount"
        },
        "customer": {
          "$ref": "#/$defs/SaleCustomer",
          "description": "Customer Information"
        },
        "fees": {
          "items": {
            "$ref": "#/$defs/SaleFee"
          },
          "type": "array",
          "description": "Sale Fees"
        },
        "compliance_status": {
          "allOf": [
            {
              "$ref": "#/$defs/ComplianceStatus"
            }
          ],
          "description": "Green Check Verified compliance status",
          "type": [
            "string",
            "null"
          ]
        },
        "compliance_exceptions": {
          "items": {
            "type": "string"
          },
          "type": [
            "array",
            "null"
          ],
          "description": "Compliance Exceptions"
        },
        "compliance_warnings": {
          "items": {
            "type": "string"
          },
          "type": [
            "array",
            "null"
          ],
          "description": "Compliance Warnings"
        }
      },
      "required": [
        "id",
        "pos_sale_id",
        "crb_id",
        "subtotal",
        "total_discounts",
        "tax_paid",
        "total_paid",
        "date",
        "local_date",
        "gc_created_date",
        "gc_updated_date",
        "transaction_type",
        "pos_name",
        "type",
        "line_items",
        "discounts",
        "taxes",
        "payments",
        "customer",
        "fees",
        "compliance_status",
        "compliance_exceptions",
        "compliance_warnings"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "SaleCustomer": {
      "properties": {
        "customer_id": {
          "allOf": [
            {
              "$ref": "#/$defs/UUID"
            }
          ],
          "description": "Green Check Customer ID",
          "type": [
            "string",
            "null"
          ]
        },
        "pos_customer_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The customer ID in the POS system"
        },
        "type": {
          "allOf": [
            {
              "$ref": "#/$defs/MedicalOrRec"
            }
          ],
          "description": "Is Sale Medical or Adult Use",
          "type": [
            "string",
            "null"
          ]
        },
        "dob": {
          "type": [
            "string",
            "null"
          ],
          "description": "Customer Date of Birth yyyy-MM-dd"
        },
        "id_type": {
          "allOf": [
            {
              "$ref": "#/$defs/IDType"
            }
          ],
          "description": "Customer ID Type",
          "type": [
            "string",
            "null"
          ]
        },
        "id_expiration_date": {
          "type": [
            "string",
            "null"
          ],
          "description": "Customer ID Expiration Date"
        }
      },
      "required": [
        "customer_id",
        "pos_customer_id",
        "type",
        "dob",
        "id_type",
        "id_expiration_date"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "SaleDiscount": {
      "properties": {
        "flat_amount": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Discount amount in cents"
        },
        "pct_amount": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Discount percentage as a real number"
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Name of discount"
        }
      },
      "required": [
        "flat_amount",
        "pct_amount",
        "name"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "SaleFee": {
      "properties": {
        "fee_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Name of the fee"
        },
        "percent_amount": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Fee percentage as a real number"
        },
        "flat_amount": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Flat amount of fee in cents"
        },
        "included_in_subtotal": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "True if this fee's calculation is included in the subtotal"
        }
      },
      "required": [
        "fee_name",
        "percent_amount",
        "flat_amount",
        "included_in_subtotal"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "SaleLineItem": {
      "properties": {
        "product_id": {
          "allOf": [
            {
              "$ref": "#/$defs/UUID"
            }
          ],
          "description": "The unique ID of the product, can be accessed with /product endpoints",
          "type": [
            "string",
            "null"
          ]
        },
        "pos_product_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "The product ID in the POS system"
        },
        "product_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Name in POS system"
        },
        "num_units": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Number of units bought"
        },
        "price_per_unit": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Price per individual unit"
        },
        "grams": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Weight of product in grams"
        },
        "product_type": {
          "allOf": [
            {
              "$ref": "#/$defs/ProductCategoryType"
            }
          ],
          "description": "GCV mapped product type",
          "type": [
            "string",
            "null"
          ]
        },
        "cannabis_product": {
          "type": [
            "boolean",
            "null"
          ],
          "description": "Whether product contains cannabis"
        },
        "line_item_discounts": {
          "items": {
            "$ref": "#/$defs/SaleDiscount"
          },
          "type": "array",
          "description": "Line item specific discounts"
        },
        "line_item_taxes": {
          "items": {
            "$ref": "#/$defs/SaleTax"
          },
          "type": "array",
          "description": "Line item specific taxes"
        },
        "line_item_fees": {
          "items": {
            "$ref": "#/$defs/SaleFee"
          },
          "type": "array",
          "description": "Line item specific fees"
        }
      },
      "required": [
        "product_id",
        "pos_product_id",
        "product_name",
        "num_units",
        "price_per_unit",
        "grams",
        "product_type",
        "cannabis_product",
        "line_item_discounts",
        "line_item_taxes",
        "line_item_fees"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "SalePayment": {
      "properties": {
        "type": {
          "$ref": "#/$defs/PaymentType",
          "description": "Payment Type"
        },
        "amount_paid": {
          "type": "number",
          "format": "double",
          "description": "Amount in cents for this payment type"
        }
      },
      "required": [
        "type",
        "amount_paid"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "SaleTax": {
      "properties": {
        "flat_amount": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Tax amount in cents"
        },
        "pct_amount": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Tax percentage as a real number"
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Name of tax"
        }
      },
      "required": [
        "flat_amount",
        "pct_amount",
        "name"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "SaleTypeRetail": {
      "enum": [
        "retail"
      ],
      "type": "string"
    },
    "SaleTypeWholesale": {
      "enum": [
        "wholesale"
      ],
      "type": "string"
    },
    "TransactionType": {
      "enum": [
        "sale",
        "return",
        "adjustment"
      ],
      "type": "string"
    },
    "UUID": {
      "type": "string",
      "format": "uuid",
      "pattern": "^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$"
    },
    "UtcDateTime": {
      "type": "string",
      "format": "date-time"
    },
    "WholesaleSale": {
      "properties": {
        "id": {
          "$ref": "#/$defs/UUID",
          "description": "Green Check generated ID"
        },
        "pos_sale_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Sale ID in the POS system"
        },
        "crb_id": {
          "$ref": "#/$defs/UUID",
          "description": "ID of the CRB"
        },
        "subtotal": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Pre-tax dollar amount in cents"
        },
        "total_discounts": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Total discount amount in cents"
        },
        "tax_paid": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Tax amount in cents"
        },
        "total_paid": {
          "type": [
            "number",
            "null"
          ],
          "format": "double",
          "description": "Price + Tax in cents"
        },
        "date": {
          "$ref": "#/$defs/UtcDateTime",
          "description": "UTC ISO Date of the Sale",
          "type": "string",
          "format": "date-time"
        },
        "local_date": {
          "$ref": "#/$defs/LocalDateTime",
          "description": "Local Date of the Sale",
          "type": "string",
          "pattern": "^[2][0][0-9]{2}[-]([0][0-9]|[1][0-2])[-]([0-2][0-9]|[3][0-1]\\s([0-1][0-9]|[2][0-3])[:][0-5][0-9][:][0-5][0-9]([.][0-9]{1,3})?"
        },
        "gc_created_date": {
          "$ref": "#/$defs/UtcDateTime",
          "description": "Our created / updated dates",
          "type": "string",
          "format": "date-time"
        },
        "gc_updated_date": {
          "$ref": "#/$defs/UtcDateTime",
          "type": "string",
          "format": "date-time"
        },
        "transaction_type": {
          "allOf": [
            {
              "$ref": "#/$defs/TransactionType"
            }
          ],
          "description": "Transaction Type provided by point of sale",
          "type": [
            "string",
            "null"
          ]
        },
        "pos_name": {
          "$ref": "#/$defs/FriendlyPosName",
          "description": "Point of Sale that the sale originated from"
        },
        "type": {
          "$ref": "#/$defs/SaleTypeWholesale"
        },
        "employee_id": {
          "type": [
            "string",
            "null"
          ],
          "description": "Employee ID"
        },
        "line_items": {
          "items": {
            "$ref": "#/$defs/SaleLineItem"
          },
          "type": "array",
          "description": "Sale Line Items"
        },
        "discounts": {
          "items": {
            "$ref": "#/$defs/SaleDiscount"
          },
          "type": "array",
          "description": "Sale Discounts"
        },
        "taxes": {
          "items": {
            "$ref": "#/$defs/SaleTax"
          },
          "type": "array",
          "description": "Sale Taxes"
        },
        "payments": {
          "items": {
            "$ref": "#/$defs/SalePayment"
          },
          "type": "array",
          "description": "Payment type and amount"
        },
        "customer": {
          "allOf": [
            {
              "$ref": "#/$defs/SaleCustomer"
            }
          ],
          "description": "Customer Information",
          "type": [
            "string",
            "null"
          ]
        },
        "fees": {
          "items": {
            "$ref": "#/$defs/SaleFee"
          },
          "type": "array",
          "description": "Sale Fees"
        },
        "invoice": {
          "properties": {
            "pos_customer_id": {
              "type": [
                "string",
                "null"
              ],
              "description": "Wholesale POS customer ID"
            },
            "memo": {
              "type": [
                "string",
                "null"
              ],
              "description": "Invoice Memo"
            },
            "open_balance": {
              "type": [
                "number",
                "null"
              ],
              "format": "double",
              "description": "Invoice Open Balance"
            },
            "total": {
              "type": [
                "number",
                "null"
              ],
              "format": "double",
              "description": "Invoice Total"
            },
            "id": {
              "type": [
                "string",
                "null"
              ],
              "description": "Invoice Id"
            }
          },
          "required": [
            "pos_customer_id",
            "memo",
            "open_balance",
            "total",
            "id"
          ],
          "type": "object"
        }
      },
      "required": [
        "id",
        "pos_sale_id",
        "crb_id",
        "subtotal",
        "total_discounts",
        "tax_paid",
        "total_paid",
        "date",
        "local_date",
        "gc_created_date",
        "gc_updated_date",
        "transaction_type",
        "pos_name",
        "type",
        "line_items",
        "discounts",
        "taxes",
        "payments",
        "customer",
        "fees",
        "invoice"
      ],
      "type": "object",
      "additionalProperties": false
    }
  }
}