{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/invoice",
  "title": "Invoice",
  "type": "object",
  "description": "The invoice details which includes all information of the invoice like items, billing information.",
  "required": [
    "detail"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "The ID of the invoice.",
      "readOnly": true,
      "maxLength": 30
    },
    "parent_id": {
      "type": "string",
      "description": "The parent ID to an invoice that defines the group invoice to which the invoice is related.",
      "readOnly": true,
      "maxLength": 30
    },
    "status": {
      "$ref": "#/components/schemas/invoice_status",
      "readOnly": true
    },
    "detail": {
      "$ref": "#/components/schemas/invoice_detail",
      "description": "The details of the invoice. Includes the invoice number, date, payment terms, and audit metadata."
    },
    "invoicer": {
      "$ref": "#/components/schemas/invoicer_info",
      "description": "The invoicer information. Includes the business name, email, address, phone, fax, tax ID, additional notes, and logo URL."
    },
    "primary_recipients": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/recipient_info"
      },
      "maxItems": 100,
      "description": "The billing and shipping information. Includes name, email, address, phone and language."
    },
    "additional_recipients": {
      "type": "array",
      "maxItems": 100,
      "description": "An array of one or more CC: emails to which notifications are sent. If you omit this parameter, a notification is sent to all CC: email addresses that are part of the invoice.<blockquote><strong>Note:</strong> Valid values are email addresses in the `additional_recipients` value associated with the invoice.</blockquote>",
      "items": {
        "$ref": "#/components/schemas/email_address"
      }
    },
    "items": {
      "type": "array",
      "description": "An array of invoice line item information.",
      "maxItems": 100,
      "items": {
        "$ref": "#/components/schemas/item"
      }
    },
    "configuration": {
      "$ref": "#/components/schemas/configuration",
      "description": "The invoice configuration details. Includes partial payment, tip, and tax calculated after discount."
    },
    "amount": {
      "$ref": "#/components/schemas/amount_summary_detail",
      "description": "The invoice amount summary of item total, discount, tax total and shipping.."
    },
    "due_amount": {
      "description": "The due amount, which is the balance amount outstanding after payments.",
      "$ref": "#/components/schemas/money",
      "readOnly": true
    },
    "gratuity": {
      "description": "The amount paid by the payer as gratuity to the invoicer.",
      "$ref": "#/components/schemas/money",
      "readOnly": true
    },
    "payments": {
      "$ref": "#/components/schemas/payments",
      "description": "List of payments registered against the invoice.."
    },
    "refunds": {
      "$ref": "#/components/schemas/refunds",
      "description": "List of refunds against this invoice. The invoicing refund details includes refund type, date, amount, and method."
    },
    "links": {
      "type": "array",
      "description": "An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).",
      "readOnly": true,
      "items": {
        "$ref": "#/components/schemas/link_description"
      }
    }
  }
}