{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/paypal/json-schema/paypal-credit-note-create-request-schema.json",
  "title": "CreditNoteCreateRequest",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/paypal-credit-notes-api-openapi.yml#/components/schemas/CreditNoteCreateRequest",
  "type": "object",
  "required": [
    "invoice_id",
    "items"
  ],
  "properties": {
    "invoice_id": {
      "type": "string",
      "format": "uuid",
      "description": "The invoice unique identifier."
    },
    "reason": {
      "$ref": "#/$defs/CreditNoteReason"
    },
    "description": {
      "type": "string",
      "description": "The description of the credit note."
    },
    "credit_amount": {
      "description": "The total amount to be credited on the customer balance.",
      "anyOf": [
        {
          "$ref": "#/$defs/AmountNoCurrency"
        },
        {
          "type": "null"
        }
      ]
    },
    "refund_amount": {
      "description": "The total amount to be refunded to the customer.",
      "anyOf": [
        {
          "$ref": "#/$defs/AmountNoCurrency"
        },
        {
          "type": "null"
        }
      ]
    },
    "items": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "fee_id",
          "amount"
        ],
        "properties": {
          "fee_id": {
            "type": "string",
            "format": "uuid",
            "description": "The fee unique identifier."
          },
          "amount": {
            "$ref": "#/$defs/AmountNoCurrency",
            "description": "The amount of the credit note item."
          }
        }
      },
      "description": "The list of credit note's items."
    }
  },
  "$defs": {
    "AmountNoCurrency": {
      "type": "object",
      "required": [
        "value"
      ],
      "properties": {
        "value": {
          "type": "number",
          "format": "decimal",
          "description": "The amount value in the corresponding currency unit (e.g., two decimals for USD, no decimals for JPY).",
          "minimum": 0,
          "nullable": false,
          "default": 0
        }
      }
    },
    "CreditNoteReason": {
      "type": "string",
      "description": "The reason for credit note creation",
      "enum": [
        "DUPLICATED_CHARGE",
        "PRODUCT_UNSATISFACTORY",
        "ORDER_CHANGE",
        "ORDER_CANCELLATION",
        "FRAUDULENT_CHARGE",
        "OTHER"
      ],
      "x-enum-varnames": [
        "DUPLICATED_CHARGE",
        "PRODUCT_UNSATISFACTORY",
        "ORDER_CHANGE",
        "ORDER_CANCELLATION",
        "FRAUDULENT_CHARGE",
        "OTHER"
      ],
      "x-enum-descriptions": [
        "Credit note issued due to duplicate charge on customer account",
        "Credit note issued because the product or service was unsatisfactory",
        "Credit note issued due to changes made to the original order",
        "Credit note issued because the order was cancelled",
        "Credit note issued due to fraudulent or unauthorized charge",
        "Credit note issued for other reasons not covered by standard categories"
      ]
    }
  }
}