Payment Means Type code for Credit Notes

I have tried to validate a credit note using SDK toolkit. We received the below error stating:

Schema validation failed; XML does not comply with UBL 2.1 standards in line with ZATCA specifications. ERROR: org.xml.sax.SAXParseException; lineNumber: 78; columnNumber: 24; cvc-complex-type.2.4.a: Invalid content was found starting with element ‘{“urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2”:InstructionNote}’. One of ‘{“urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2”:ID, “urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2”:PaymentMeansCode}’ is expected.

On adding the Payment means type code field along with a value in the XML file it successfully validates.

However, we understand that the Payment means type code is an optional field. Why are we still receiving this error?
Request you to kindly assist.

@juhisomaya you are correct that payment means code is optional field. However, please note that "Reasons for issuing credit / debit note (KSA-10) uses a common parent tag “cac:PaymentMeans”, this is why UBL is expecting the mandatory child element “cbc:Paymentmeanscode” once parent tag “cac:paymentmeans” exists on XML. In credit / debit notes, you have to include cbc:paymentmeanscode tag to satisfy UBL’s requirement technically. Hope this clarifies