Clearance api not validating if in xml file buyer details is missing tag like postal code, building number

all B2B invoice getting cleared without tag like postal code, building number. while this tag mentioned mandatory in einvoice data dictionary for B2B invoice

Hi,
Please share details where are getting cleared Sandbox, Simulation or PROD or SDK if SDK then version? Also sharing xml contents will provide more insite. You are getting any warnings or not so need more details. thanks

HI,
getting cleared in production environment by using below api link and not getting any warnings

https://gw-fatoora.zatca.gov.sa/e-invoicing/core/invoices/clearance/single

below is xml content.
thanks

ext:UBLExtensions

ext:UBLExtension

ext:ExtensionURIurn:oasis:names:specification:ubl:dsig:enveloped:xades</ext:ExtensionURI>

ext:ExtensionContent

<sig:UBLDocumentSignatures xmlns:sig=“urn:oasis:names:specification:ubl:schema:xsd:CommonSignatureComponents-2” xmlns:sac=“urn:oasis:names:specification:ubl:schema:xsd:SignatureAggregateComponents-2” xmlns:sbc=“urn:oasis:names:specification:ubl:schema:xsd:SignatureBasicComponents-2”>

sac:SignatureInformation

cbc:IDurn:oasis:names:specification:ubl:signature:1</cbc:ID>

sbc:ReferencedSignatureIDurn:oasis:names:specification:ubl:signature:Invoice</sbc:ReferencedSignatureID>

<ds:Signature xmlns:ds=“XML-Signature Syntax and Processing” Id=“signature”>

ds:SignedInfo

<ds:CanonicalizationMethod Algorithm=“Canonical XML 1.1”/>

<ds:SignatureMethod Algorithm=“xmldsig-more namespace”/>

<ds:Reference Id=“invoiceSignedData” URI=“”>

ds:Transforms

<ds:Transform Algorithm=“XML Path Language (XPath)”>

ds:XPathnot(//ancestor-or-self::ext:UBLExtensions)</ds:XPath>

</ds:Transform>

<ds:Transform Algorithm=“XML Path Language (XPath)”>

ds:XPathnot(//ancestor-or-self::cac:Signature)</ds:XPath>

</ds:Transform>

<ds:Transform Algorithm=“XML Path Language (XPath)”>

ds:XPathnot(//ancestor-or-self::cac:AdditionalDocumentReference[cbc:ID=‘QR’])</ds:XPath>

</ds:Transform>

<ds:Transform Algorithm=“Canonical XML 1.1”/>

</ds:Transforms>

<ds:DigestMethod Algorithm=“http://www.w3.org/2001/04/xmlenc#sha256”/>

ds:DigestValuexUyHDsg1xrwKzYE8oha1jXU6mBefsz2HPN2VItmnwjo=</ds:DigestValue>

</ds:Reference>

<ds:Reference Type=“http://www.w3.org/2000/09/xmldsig#SignatureProperties” URI=“#xadesSignedProperties”>

<ds:DigestMethod Algorithm=“http://www.w3.org/2001/04/xmlenc#sha256”/>

ds:DigestValueZGFmMzNmMDZiNjllNTcxM2I0YmEwOGMwYTNmOWVmYmVjNTU0YmFmZDE1NWUwNjg3MWMwZjFiYTViY2UzOTY4MQ==</ds:DigestValue>

</ds:Reference>

</ds:SignedInfo>

ds:SignatureValueMEUCIGMwy4MWMtkJKhdPLYOTIp8hhSCg8X/iopAYEPgttThtAiEAmU5wxzZrokGZZLclUgfLVwDZVNcptws/FW/THO10g3w=</ds:SignatureValue>

ds:KeyInfo

ds:X509Data

ds:X509CertificateMIICLzCCAdagAwIBAgIGAZC1xHjHMAoGCCqGSM49BAMCMBUxEzARBgNVBAMMCmVJbnZvaWNpbmcwHhcNMjQwNzE1MDk0MTA1WhcNMjkwNzE0MjEwMDAwWjBqMQswCQYDVQQGEwJTQTETMBEGA1UECwwKMzAxMTcxODg2MTEoMCYGA1UECgwfQUxRQVNSIEdMQVNTIElORFVTVFJJQUwgQ09NUEFOWTEcMBoGA1UEAwwTWkFUQ0EtQ29kZS1TaWduaW5nMTBWMBAGByqGSM49AgEGBSuBBAAKA0IABOQtvdmCbU0YOp5D/IwNqlsRIPu3pIjJwdopPWa54g1TjtMTYE4+/0LX1+IP4jVXWnHf0N4ZGWSgN3jVKVq3EZqjgb8wgbwwDAYDVR0TAQH/BAIwADCBqwYDVR0RBIGjMIGgpIGdMIGaMT4wPAYDVQQEDDUxLVBvc05hbWV8Mi1HNHwzLTRlYzg4MDdhLTQxZjMtNDk3MS05MWYwLTRjNmE4N2FiODJmNjEfMB0GCgmSJomT8ixkAQEMDzMwMTE3MTg4NjEwMDAwMzENMAsGA1UEDAwEMTEwMDEOMAwGA1UEGgwFUml5YWQxGDAWBgNVBA8MD0dsYXNzIEJ1c3NpbmVzczAKBggqhkjOPQQDAgNHADBEAiAKAaX2WlWf8wDed2WbxcVJl0PDjnWzEhqGW5FoMfFm9AIgXhiumgLAosIWUKU+tRH0h2X7hOQodAc5CxHTuqNTOlg=</ds:X509Certificate>

</ds:X509Data>

</ds:KeyInfo>

ds:Object

<xades:QualifyingProperties xmlns:xades=“Assigned ETSI XML URIs” Target=“signature”>

<xades:SignedProperties Id=“xadesSignedProperties”>

xades:SignedSignatureProperties

xades:SigningTime2024-07-30T18:10:41</xades:SigningTime>

xades:SigningCertificate

xades:Cert

xades:CertDigest

<ds:DigestMethod Algorithm=“http://www.w3.org/2001/04/xmlenc#sha256”/>

ds:DigestValueMDU3NDEzZWQ3N2U4N2JmNTZlZDM1ZjNlOTg5YWRlMmYxZTAxZTFkMmIzNWE1OWNjNGZiZjUyYjU3NzQ4MWM2ZQ==</ds:DigestValue>

</xades:CertDigest>

xades:IssuerSerial

ds:X509IssuerNameCN=eInvoicing</ds:X509IssuerName>

ds:X509SerialNumber1721036470471</ds:X509SerialNumber>

</xades:IssuerSerial>

</xades:Cert>

</xades:SigningCertificate>

</xades:SignedSignatureProperties>

</xades:SignedProperties>

</xades:QualifyingProperties>

</ds:Object>

</ds:Signature>

</sac:SignatureInformation>

</sig:UBLDocumentSignatures>

</ext:ExtensionContent>

</ext:UBLExtension>

</ext:UBLExtensions>

cbc:ProfileIDreporting:1.0</cbc:ProfileID>

cbc:IDINV2404605</cbc:ID>

cbc:UUID11bdadd6-0789-4798-8f3f-ecb327f1a54a</cbc:UUID>

cbc:IssueDate2024-07-30</cbc:IssueDate>

cbc:IssueTime08:30:00</cbc:IssueTime>

<cbc:InvoiceTypeCode name=“0100000”>388</cbc:InvoiceTypeCode>

cbc:DocumentCurrencyCodeSAR</cbc:DocumentCurrencyCode>

cbc:TaxCurrencyCodeSAR</cbc:TaxCurrencyCode>

cac:AdditionalDocumentReference

cbc:IDICV</cbc:ID>

cbc:UUID49</cbc:UUID>

</cac:AdditionalDocumentReference>

cac:AdditionalDocumentReference

cbc:IDPIH</cbc:ID>

cac:Attachment

<cbc:EmbeddedDocumentBinaryObject mimeCode=“text/plain”>bE5MRGVzSXZFZDVaRCtqKzZ5bmd3VnZQcFUrRTV6dDRXOFR6MWZvU3ZJZz0=</cbc:EmbeddedDocumentBinaryObject>

</cac:Attachment>

</cac:AdditionalDocumentReference>

cac:AdditionalDocumentReference

cbc:IDQR</cbc:ID>

cac:Attachment

<cbc:EmbeddedDocumentBinaryObject mimeCode=“text/plain”>AU/YtNix2YPYqSDYp9mE2YLYtdixINis2YTYp9izINin2YTYtdmG2KfYudmK2KkgfCBBTFFBU1IgR0xBU1MgSU5EVVNUUklBTCBDT01QQU5ZAg8zMDExNzE4ODYxMDAwMDMDEzIwMjQtMDctMzBUMDg6MzA6MDAEBTI5LjA0BQQzLjc5Bix4VXlIRHNnMXhyd0t6WUU4b2hhMWpYVTZtQmVmc3oySFBOMlZJdG1ud2pvPQdgTUVVQ0lHTXd5NE1XTXRrSktoZFBMWU9USXA4aGhTQ2c4WC9pb3BBWUVQZ3R0VGh0QWlFQW1VNXd4elpyb2tHWlpMY2xVZ2ZMVndEWlZOY3B0d3MvRlcvVEhPMTBnM3c9CFgwVjAQBgcqhkjOPQIBBgUrgQQACgNCAATkLb3Zgm1NGDqeQ/yMDapbESD7t6SIycHaKT1mueINU47TE2BOPv9C19fiD+I1V1px39DeGRlkoDd41SlatxGa</cbc:EmbeddedDocumentBinaryObject>

</cac:Attachment>

</cac:AdditionalDocumentReference>

cac:Signature

cbc:IDurn:oasis:names:specification:ubl:signature:Invoice</cbc:ID>

cbc:SignatureMethodurn:oasis:names:specification:ubl:dsig:enveloped:xades</cbc:SignatureMethod>

</cac:Signature>

cac:AccountingSupplierParty

cac:Party

cac:PartyIdentification

<cbc:ID schemeID=“CRN”>1010237709</cbc:ID>

</cac:PartyIdentification>

cac:PostalAddress

cbc:StreetNameالسمح بن مالك | As Samh Bin Malik</cbc:StreetName>

cbc:BuildingNumber6706</cbc:BuildingNumber>

cbc:CitySubdivisionNameالرياض | Riyadh</cbc:CitySubdivisionName>

cbc:CityNameالرياض | Riyadh</cbc:CityName>

cbc:PostalZone14315</cbc:PostalZone>

cac:Country

cbc:IdentificationCodeSA</cbc:IdentificationCode>

</cac:Country>

</cac:PostalAddress>

cac:PartyTaxScheme

cbc:CompanyID301171886100003</cbc:CompanyID>

cac:TaxScheme

cbc:IDVAT</cbc:ID>

</cac:TaxScheme>

</cac:PartyTaxScheme>

cac:PartyLegalEntity

cbc:RegistrationNameشركة القصر جلاس الصناعية | ALQASR GLASS INDUSTRIAL COMPANY</cbc:RegistrationName>

</cac:PartyLegalEntity>

</cac:Party>

</cac:AccountingSupplierParty>

cac:AccountingCustomerParty

cac:Party

cac:PostalAddress

cbc:StreetNameالرياض | الرياض</cbc:StreetName>

cbc:CitySubdivisionNameالرياض | RIYAD</cbc:CitySubdivisionName>

cbc:CityNameالرياض | RIYAD</cbc:CityName>

cac:Country

cbc:IdentificationCodeSA</cbc:IdentificationCode>

</cac:Country>

</cac:PostalAddress>

cac:PartyTaxScheme

cbc:CompanyID302187279300003</cbc:CompanyID>

cac:TaxScheme

cbc:IDVAT</cbc:ID>

</cac:TaxScheme>

</cac:PartyTaxScheme>

cac:PartyLegalEntity

cbc:RegistrationNameمؤسسة الإبداع الحديث للأبواب الأوتوماتيكية | MODREN CREATIVITY EST AUTOMATIC DOORS</cbc:RegistrationName>

</cac:PartyLegalEntity>

</cac:Party>

</cac:AccountingCustomerParty>

cac:Delivery

cbc:ActualDeliveryDate2024-07-30</cbc:ActualDeliveryDate>

</cac:Delivery>

cac:PaymentMeans

cbc:PaymentMeansCode10</cbc:PaymentMeansCode>

</cac:PaymentMeans>

cac:AllowanceCharge

cbc:ChargeIndicatorfalse</cbc:ChargeIndicator>

cbc:AllowanceChargeReasondiscount</cbc:AllowanceChargeReason>

<cbc:Amount currencyID=“SAR”>0.00</cbc:Amount>

cac:TaxCategory

<cbc:ID schemeID=“UN/ECE 5305” schemeAgencyID=“6”>S</cbc:ID>

cbc:Percent15</cbc:Percent>

cac:TaxScheme

<cbc:ID schemeID=“UN/ECE 5153” schemeAgencyID=“6”>VAT</cbc:ID>

</cac:TaxScheme>

</cac:TaxCategory>

</cac:AllowanceCharge>

cac:TaxTotal

<cbc:TaxAmount currencyID=“SAR”>3.79</cbc:TaxAmount>

</cac:TaxTotal>

cac:TaxTotal

<cbc:TaxAmount currencyID=“SAR”>3.79</cbc:TaxAmount>

cac:TaxSubtotal

<cbc:TaxableAmount currencyID=“SAR”>25.25</cbc:TaxableAmount>

<cbc:TaxAmount currencyID=“SAR”>3.79</cbc:TaxAmount>

cac:TaxCategory

<cbc:ID schemeID=“UN/ECE 5305” schemeAgencyID=“6”>S</cbc:ID>

cbc:Percent15</cbc:Percent>

cac:TaxScheme

<cbc:ID schemeID=“UN/ECE 5153” schemeAgencyID=“6”>VAT</cbc:ID>

</cac:TaxScheme>

</cac:TaxCategory>

</cac:TaxSubtotal>

</cac:TaxTotal>

cac:LegalMonetaryTotal

<cbc:LineExtensionAmount currencyID=“SAR”>25.25</cbc:LineExtensionAmount>

<cbc:TaxExclusiveAmount currencyID=“SAR”>25.25</cbc:TaxExclusiveAmount>

<cbc:TaxInclusiveAmount currencyID=“SAR”>29.04</cbc:TaxInclusiveAmount>

<cbc:AllowanceTotalAmount currencyID=“SAR”>0.00</cbc:AllowanceTotalAmount>

<cbc:PrepaidAmount currencyID=“SAR”>0.00</cbc:PrepaidAmount>

<cbc:PayableAmount currencyID=“SAR”>29.04</cbc:PayableAmount>

</cac:LegalMonetaryTotal>

cac:InvoiceLine

cbc:ID1</cbc:ID>

<cbc:InvoicedQuantity unitCode=“PCE”>1.01</cbc:InvoicedQuantity>

<cbc:LineExtensionAmount currencyID=“SAR”>25.25</cbc:LineExtensionAmount>

cac:TaxTotal

<cbc:TaxAmount currencyID=“SAR”>3.79</cbc:TaxAmount>

<cbc:RoundingAmount currencyID=“SAR”>29.04</cbc:RoundingAmount>

</cac:TaxTotal>

cac:Item

cbc:Name24 MM COG DOUBLE: [(LAYER 1: SINGLE COG 6MM GUR HD GRAY) + ( 12 - AIR GAP - SILICON BITE 6) + (LAYER 2: SINGLE COG 6MM CLEAR) ]</cbc:Name>

cac:ClassifiedTaxCategory

cbc:IDS</cbc:ID>

cbc:Percent15</cbc:Percent>

cac:TaxScheme

cbc:IDVAT</cbc:ID>

</cac:TaxScheme>

</cac:ClassifiedTaxCategory>

</cac:Item>

cac:Price

<cbc:PriceAmount currencyID=“SAR”>25</cbc:PriceAmount>

cac:AllowanceCharge

cbc:ChargeIndicatortrue</cbc:ChargeIndicator>

cbc:AllowanceChargeReasondiscount</cbc:AllowanceChargeReason>

<cbc:Amount currencyID=“SAR”>0.00</cbc:Amount>

</cac:AllowanceCharge>

</cac:Price>

</cac:InvoiceLine>

Please share valid XML which can open to see in browser seems shared one is not valid as giving errors of tags. thanks

hi.

please download from below link

xml file

thanks

Hi,
Please review your code something is wrong as the response you shared is not of clearance but of compliance and API you mentioned shall have error as I did a test and here is the result. Also confirm if you are using JSON of this XML of somthing is missed. This API reponse should be like below,

{
“invoiceHash”: “P3/QfnGR7eMON/LM8Vpiz6nCqrt5+msixDhj84Fo6Ww=”,
“status”: “Cleared”,
“clearedInvoice”: ‘signed invoice data’
}

so this is not correct https://gw-fatoora.zatca.gov.sa/e-invoicing/core/invoices/clearance/single

or
the response you shared is not correct please review your code.

********** Welcome to ZATCA E-Invoice Java SDK 3.3.3 *********************
This SDK uses Java to call the SDK (jar) passing it an invoice XML file.
It can take a Standard or Simplified XML, Credit Note, or Debit Note.
It returns if the validation is successful or shows errors where the XML validation fails.
It checks for syntax and content as well.
You can use the command (fatoora -help) for more information.


2024-07-31 18:28:14,603 [INFO] ValidationProcessorImpl - [XSD] validation result : PASSED
2024-07-31 18:28:15,365 [INFO] ValidationProcessorImpl - [EN] validation result : PASSED
2024-07-31 18:28:15,365 [ERROR] ValidationProcessorImpl - en validation warnings :
2024-07-31 18:28:15,366 [WARN] ValidationProcessorImpl - CODE : BR-10, MESSAGE : [BR-10]-An Invoice shall contain the Buyer postal address (BG-8).Not applicable for simplified tax invoices and associated credit notes and debit notes (KSA-2, position 1 and 2 = 02).
2024-07-31 18:28:15,598 [INFO] ValidationProcessorImpl - [KSA] validation result : PASSED
2024-07-31 18:28:15,599 [ERROR] ValidationProcessorImpl - ksa validation warnings :
2024-07-31 18:28:15,599 [WARN] ValidationProcessorImpl - CODE : BR-KSA-63, MESSAGE : [BR-KSA-63]-If the buyer country code (BT-55) is “SA”, then these fields are mandatory:street name (BT-50), building number (KSA-18), postal code (BT-53), city (BT-52), District (KSA-4), country code (BT-55).For more information please access this link:National Address | Saudi Post | SPL
2024-07-31 18:28:15,599 [WARN] ValidationProcessorImpl - CODE : BR-KSA-67, MESSAGE : [BR-KSA-67]-If the buyer country code (BT-55) is “SA”, then the Buyer postal code(BT-53) must be 5 digits.
2024-07-31 18:28:15,650 [INFO] ValidationProcessorImpl - [PIH] validation result : FAILED
2024-07-31 18:28:15,651 [ERROR] ValidationProcessorImpl - pih validation errors :
2024-07-31 18:28:15,651 [ERROR] ValidationProcessorImpl - CODE : KSA-13, MESSAGE : PIH is inValid
2024-07-31 18:28:15,651 [INFO] InvoiceValidationService - *** GLOBAL VALIDATION RESULT = FAILED

Hi,

As you mentioned, we are sending the same API response.

below is link and file that contain json format as you mentioned.

json

Thanks

I can clearly see that all mandatory tags are there, please specify the tags in xml format in order to help you

Hi

in below screen shot, building number and postal code tag are missing and as per the Einvoice Data Dictionary, this one is mandatory.

If I mention this tag, and if the postal code value is zero, it is still not giving any error.

Thanks

Hi,

Can you please send me the full xml file?

Regards,

Hi,

below is full xml file link

full xml file

Thanks

Hi,

OK, what is the error message you’re getting when sending this xml?

Regards,

Hi,

there is not any error message coming while calling clerance api.
issue is below mentioned.

Clearance api not validating if in xml file buyer details is missing tag like postal code, building number

user is asking why without postal code, building number invoice getting cleared.

Thanks

Hi,

If you read the data dictionary you’ll find the word: Required, if populated, which means if the tag mentioned then you have to write the accurate data, otherwise not needed
image.png

Regards,

Hi,

I populated the postal code with a zero value and received no errors.
and the same invoice I cleared twice is still not giving any errors, like clearance already done.

Thanks

Hi @Anil_K

I’ve tried validating your xml invoice, using the .Net SDK and through a web based validator. Your invoice should display a Warning as shown by @Malik in the previous post.

If in the Production of your invoice is approved without warning, only the admin working on the server side knows the cause.
Maybe the production server is implementing different validation.

Hi @eCloud

may I know who admin is here so I can send my query to admin mean you have any email address?

Thanks