{
  "input_schema_version": "financewolf/einvoice/generation-input/v1",
  "document_type": "credit_note",
  "id": "EXAMPLE-CN-002",
  "issue_date": "2026-09-08",
  "currency": "GBP",
  "buyer_reference": "BUYER-REF-001",
  "seller": {
    "name": "Example Supplier Ltd",
    "endpoint": {
      "scheme": "0088",
      "value": "7300010000001"
    },
    "legal_identifier": {
      "value": "12345678"
    },
    "vat_identifier": "GB123456789",
    "address": {
      "street": "1 Example Street",
      "city": "London",
      "postal_code": "SW1A 1AA",
      "country": "GB",
      "additional_street": "Building A",
      "address_line": "Floor 2",
      "region": "London"
    },
    "trading_name": "Example Trading",
    "identifier": {
      "scheme": "0088",
      "value": "7300010000001"
    },
    "contact": {
      "name": "Example Contact",
      "telephone": "+44 20 0000 0000",
      "email": "billing@example.invalid"
    }
  },
  "buyer": {
    "name": "Example Buyer Ltd",
    "endpoint": {
      "scheme": "0088",
      "value": "7300010000001"
    },
    "legal_identifier": {
      "value": "87654321"
    },
    "address": {
      "street": "2 Example Street",
      "city": "London",
      "postal_code": "SW1A 2AA",
      "country": "GB"
    },
    "contact": {
      "name": "Example Buyer Contact"
    }
  },
  "lines": [
    {
      "id": "1",
      "quantity": "3",
      "unit": "C62",
      "price_amount": "19.995",
      "price_base_quantity": "1",
      "net_amount": "58.00",
      "item": {
        "name": "Example item",
        "description": "Description & <escaping>",
        "seller_id": "SELLER-ITEM-1",
        "buyer_id": "BUYER-ITEM-1",
        "standard_id": {
          "scheme": "0088",
          "value": "7300010000001"
        }
      },
      "tax": {
        "category": "S",
        "rate": "20.000"
      },
      "allowances": [
        {
          "amount": "2.00",
          "reason": "Example discount",
          "reason_code": "95",
          "base_amount": "40.00",
          "percentage": "5"
        }
      ],
      "charges": [
        {
          "amount": "0.01",
          "reason": "Example charge"
        }
      ],
      "note": "Example line note",
      "order_line_reference": "PO-LINE-1",
      "accounting_cost": "LINE-COST"
    },
    {
      "id": "2",
      "quantity": "2",
      "unit": "C62",
      "price_amount": "5",
      "item": {
        "name": "Example zero-rated item"
      },
      "tax": {
        "category": "Z",
        "rate": "0"
      }
    },
    {
      "id": "3",
      "quantity": "-1",
      "unit": "C62",
      "price_amount": "2",
      "item": {
        "name": "Example correction"
      },
      "tax": {
        "category": "S",
        "rate": "20"
      }
    }
  ],
  "preceding_invoices": [
    {
      "id": "PRIOR-001",
      "issue_date": "2026-08-08"
    }
  ],
  "note": "Example only. Terms & references <must> be preserved. Café 🐺",
  "accounting_cost": "COST-123",
  "tax_point_date": "2026-09-07",
  "purchase_order_reference": "PO-456",
  "contract_reference": "CONTRACT-789",
  "payment": {
    "code": "30",
    "reference": "PAYMENT-001",
    "account": {
      "id": "EXAMPLE-ACCOUNT-001",
      "name": "Example Supplier Ltd",
      "branch_id": "EXAMPLE-BRANCH"
    }
  },
  "payment_terms": "Payment within 30 days",
  "prepaid_amount": "10.00",
  "rounding_amount": "-0.20",
  "delivery": {
    "date": "2026-09-07",
    "address": {
      "street": "3 Delivery Street",
      "country": "GB"
    }
  },
  "allowances": [
    {
      "amount": "1.00",
      "reason": "Example document discount",
      "reason_code": "95",
      "tax": {
        "category": "S",
        "rate": "20"
      }
    }
  ],
  "charges": [
    {
      "amount": "3.50",
      "reason": "Example document charge",
      "reason_code": "CG",
      "base_amount": "35.00",
      "percentage": "10",
      "tax": {
        "category": "S",
        "rate": "20"
      }
    }
  ],
  "totals": {
    "line_net_amount": "66.00",
    "allowance_total": "1.00",
    "charge_total": "3.50",
    "tax_exclusive_amount": "68.50",
    "tax_amount": "11.70",
    "tax_inclusive_amount": "80.20",
    "prepaid_amount": "10.00",
    "rounding_amount": "-0.20",
    "payable_amount": "70.00"
  },
  "tax_subtotals": [
    {
      "tax": {
        "category": "S",
        "rate": "20"
      },
      "taxable_amount": "58.50",
      "tax_amount": "11.70"
    },
    {
      "tax": {
        "category": "Z",
        "rate": "0"
      },
      "taxable_amount": "10.00",
      "tax_amount": "0.00"
    }
  ]
}
