{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/collectly/json-schema/collectly-payment-schema.json",
  "title": "Payment",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/collectly-payments-api-openapi.yml#/components/schemas/Payment",
  "properties": {
    "allocations": {
      "items": {
        "$ref": "#/$defs/Allocation"
      },
      "type": "array"
    },
    "amount": {
      "type": [
        "number",
        "null"
      ]
    },
    "collectly_id": {
      "description": "Unique Collectly resource ID",
      "readOnly": true,
      "type": "string"
    },
    "collectly_payment_plan_id": {
      "description": "Collectly payment plan ID. It is NOT null in case the payment was charged as a part of the payment plan",
      "type": "string"
    },
    "collectly_source_payment_id": {
      "description": "Collectly source payment ID. Used only for refunds.",
      "type": "string"
    },
    "copay_amount": {
      "type": "number"
    },
    "created_at": {
      "readOnly": true
    },
    "id": {
      "description": "Unique resource ID from your integration",
      "type": "string"
    },
    "modified_at": {
      "readOnly": true
    },
    "patient_id": {
      "description": "Patient ID from your integration who owns the resource",
      "type": "string"
    },
    "payment_type": {
      "enum": [
        "payment",
        "copay",
        "refund",
        "part_ref",
        "autodeb",
        "collect"
      ],
      "type": "string"
    },
    "post_date": {
      "format": "date",
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "readOnly": true,
      "type": "string"
    },
    "transaction_id": {
      "type": [
        "string",
        "null"
      ]
    }
  },
  "required": [
    "id",
    "patient_id"
  ],
  "type": "object",
  "$defs": {
    "Allocation": {
      "properties": {
        "amount": {
          "type": "number"
        },
        "charge_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "id": {
          "readOnly": true,
          "type": "string"
        },
        "visit_id": {}
      },
      "required": [
        "amount"
      ],
      "type": "object"
    }
  }
}