Spanish Verifactu?

Has anyone managed to perform tests with Xojo for the Spanish Verifactu?

Welcome to the forum, Victor!

I haven’t give this a try but, as far as I understand (and maybe I’m wrong, I haven’t read the full BOE in detail), what you have to create is a XML file that contains a hash field and then upload it to AEAT.

Relevant documentation:

  • Crypto.Hash: For generating the hash, based on the invoice fields (NIF, Receiver, Amount, …)
  • XMLDocument: For building the machine readable VeriFactu file that includes the invoice hash
  • URLConnection: For uploading the VeriFactu file to AEAT
  • Barcode.Image: For creating the (optional) QR code that can be embedded in the PDF file
  • PDFDocument: For building the human readable Invoice

There is a AEAT preproduction environment to start testing all this:
https://preportal.aeat.es/

Technical VeriFactu documentation:

Please note that there is also a Spanish forum, if you prefer:

1 Like

Hi Ricardo, thank you very much for your response.
Yes, I already have the part about creating the HASH for each record and the XML file ready.
What I don’t know is how I can send that XML file to the AEAT test URLs (the ones that appear in the https://preportal.aeat.es/ environment you also mentioned). I’ve never worked with URLConnection before.

There are some URLConnection examples included with Xojo. This one should be useful to understand how you can use it to send the XML to AEAT portal:

Thank you very much, Ricardo.
Yes, it’s the example I was trying, but it’s giving me an error.
But I think it’s a problem with the AEAT Testing environment because they have an option to upload an XML file and validate it, but that also gives an error. Even if you copy one of the examples included in the PDF file published by the AEAT and try to upload it for validation, it says “Codigo[4118].Error técnico: la dirección no se corresponde con el fichero de entrada.”

Where can I find that PDF? Is this one? :thinking:

Pareciera que el error esta en el formato.
Al inicio, se pide una dirección, como este ejemplo:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">

Si esta dirección no corresponde, te da el error que mencionas.

Un saludo.