Verifactu en Delphi: cómo enviar facturas con la API Verifactu
Con la API Verifactu envías una factura desde Delphi con THTTPClient (o con WinHttpRequest en versiones antiguas): una petición POST en JSON a https://api.verifacti.com/verifactu/create que devuelve al instante el QR en Base64, la huella y un uuid. No necesitas generar el XML, calcular la huella ni usar certificado digital.
Este tutorial usa Delphi XE8 o superior con System.Net.HttpClient y System.JSON. Para versiones anteriores, WinHttp.WinHttpRequest.5.1 por COM.
Antes de empezar
- Una cuenta gratuita de Verifacti: incluye entorno de test y NIF de prueba.
- La API key de test del NIF de prueba (empieza por
vf_test_) en la variable de entornoVERIFACTI_API_KEY. Nunca la escribas en el código. - Delphi XE8 o superior (o Delphi 7 a XE7 con WinHttpRequest).
Para dar de alta tus propios NIFs más adelante, sigue la guía rápida de la API Verifactu.
1. Autenticación
Todas las llamadas llevan el header Authorization: Bearer con tu API key. La API key fija el NIF emisor y el entorno (test o producción): no los indicas en la petición. La URL base es https://api.verifacti.com, la misma en test y en producción.
Este tutorial usa THTTPClient (la clase que hay debajo de TNetHTTPClient). Añade esta unidad como VerifactiApi.pas: los demás ejemplos la usan. El JSON va como texto y la respuesta vuelve como TJSONValue.
unit VerifactiApi;
// Una sola función para todas las llamadas a la API de Verifacti.
// Lee la API key de la variable de entorno VERIFACTI_API_KEY.
interface
uses
System.SysUtils, System.Classes, System.JSON, System.Net.HttpClient, System.Net.URLClient;
type
TVerifactiRespuesta = record
Status: Integer;
Json: TJSONValue; // libéralo con Json.Free
end;
function VerifactiSend(const Method, Path: string; const Body: string = '';
const IdempotencyKey: string = ''): TVerifactiRespuesta;
function Hoy: string;
implementation
const
BASE_URL = 'https://api.verifacti.com';
function Hoy: string;
begin
Result := FormatDateTime('dd-mm-yyyy', Now); // hora local del PC: tiene que estar en hora de España
end;
function VerifactiSend(const Method, Path, Body, IdempotencyKey: string): TVerifactiRespuesta;
var
Http: THTTPClient;
Headers: TNetHeaders;
Source: TStringStream;
Response: IHTTPResponse;
begin
Http := THTTPClient.Create;
Source := TStringStream.Create(Body, TEncoding.UTF8);
try
Headers := [TNetHeader.Create('Authorization', 'Bearer ' + GetEnvironmentVariable('VERIFACTI_API_KEY'))];
if Body <> '' then
Headers := Headers + [TNetHeader.Create('Content-Type', 'application/json')];
if IdempotencyKey <> '' then
Headers := Headers + [TNetHeader.Create('Idempotency-Key', IdempotencyKey)];
if Method = 'GET' then
Response := Http.Get(BASE_URL + Path, nil, Headers)
else
Response := Http.Post(BASE_URL + Path, Source, nil, Headers);
Result.Status := Response.StatusCode;
Result.Json := TJSONObject.ParseJSONValue(Response.ContentAsString(TEncoding.UTF8));
finally
Source.Free;
Http.Free;
end;
end;
end.Con otro cliente HTTP
En Delphi 7 a XE7 no hay System.Net.HttpClient: usa WinHttpRequest por COM, sin dependencias.
// Delphi 7 a XE7: WinHttp.WinHttpRequest.5.1 por COM, sin dependencias
uses
ComObj, ActiveX, SysUtils;
procedure CrearFacturaWinHttp;
var
Http: OleVariant;
Factura: string;
begin
CoInitialize(nil);
try
Factura :=
'{"serie": "A", "numero": "1", "fecha_expedicion": "' + FormatDateTime('dd-mm-yyyy', Now) + '",' +
' "tipo_factura": "F1", "descripcion": "Servicios de consultoria",' +
' "nif": "A15022510", "nombre": "Empresa Cliente SL",' +
' "lineas": [{"base_imponible": "200.00", "tipo_impositivo": "21", "cuota_repercutida": "42.00"}],' +
' "importe_total": "242.00"}';
Http := CreateOleObject('WinHttp.WinHttpRequest.5.1');
Http.Open('POST', 'https://api.verifacti.com/verifactu/create', False);
Http.Option[9] := $800; // TLS 1.2 en Windows 7 y 8
Http.SetRequestHeader('Authorization', 'Bearer ' + GetEnvironmentVariable('VERIFACTI_API_KEY'));
Http.SetRequestHeader('Content-Type', 'application/json; charset=utf-8');
Http.Send(Factura);
WriteLn(Integer(Http.Status), ' ', string(Http.ResponseText));
finally
CoUninitialize;
end;
end;2. Crear la factura
Crea la factura con POST /verifactu/create. Esta es una factura completa (F1) con una línea al 21 %. fecha_expedicion es la fecha de hoy en formato DD-MM-AAAA: el entorno de test solo acepta la de hoy (o la de ayer).
Los importes van como texto, con punto decimal y dos decimales como máximo. importe_total tiene que cuadrar con la suma de base_imponible y cuota_repercutida de las líneas. nif y nombre son los del destinatario: el NIF emisor lo pone la API key.
uses
System.SysUtils, System.IOUtils, System.JSON, VerifactiApi;
procedure CrearFactura;
var
Factura: string;
R: TVerifactiRespuesta;
begin
Factura :=
'{"serie": "A", "numero": "1", "fecha_expedicion": "' + Hoy + '",' +
' "tipo_factura": "F1", "descripcion": "Servicios de consultoria",' +
' "nif": "A15022510", "nombre": "Empresa Cliente SL",' +
' "lineas": [{"base_imponible": "200.00", "tipo_impositivo": "21", "cuota_repercutida": "42.00"}],' +
' "importe_total": "242.00"}';
R := VerifactiSend('POST', '/verifactu/create', Factura);
try
if R.Status <> 200 then
begin
WriteLn('Error ', R.Status, ': ', R.Json.ToString);
Exit;
end;
WriteLn('uuid: ', TJSONObject(R.Json).GetValue('uuid').Value);
WriteLn('estado: ', TJSONObject(R.Json).GetValue('estado').Value);
TFile.WriteAllText('respuesta.json', R.Json.ToString);
finally
R.Json.Free;
end;
end;Para otros tipos de factura (simplificada F2, rectificativas R1–R5, exentas…), mira los ejemplos de facturas de Verifactu.
3. Leer la respuesta y el QR
La respuesta llega al momento, sin esperar a la AEAT:
uuid: identificador del registro de facturación. Guárdalo para consultar el estado.estado: siemprePendienteal crear. Verifacti encola el registro y lo envía a la Agencia Tributaria (AEAT), normalmente en uno o dos minutos.url: URL de cotejo de la AEAT que contiene el QR.qr: imagen PNG del QR (290 × 290 px) en Base64.huella: huella (hash) del registro, ya encadenada con el anterior.
{
"estado": "Pendiente",
"uuid": "b018ced3-b362-4494-8776-9eefff1c160c",
"url": "https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR?nif=B12345674&numserie=A1&fecha=19-11-2026&importe=242.00",
"qr": "iVBORw0KGgoAAAANSUhEUgAAASIAAAEi...",
"huella": "B11F3A015173AD99075E2720F61E2DE1FF08CBFEDD85C6F73C77AD835301B2A3"
}uses
System.SysUtils, System.IOUtils, System.JSON, System.NetEncoding;
procedure GuardarQR;
var
Respuesta: TJSONObject;
begin
Respuesta := TJSONObject.ParseJSONValue(TFile.ReadAllText('respuesta.json')) as TJSONObject;
try
TFile.WriteAllBytes('qr.png', TNetEncoding.Base64.DecodeStringToBytes(Respuesta.GetValue('qr').Value));
WriteLn('QR guardado en qr.png. URL de verificación: ', Respuesta.GetValue('url').Value);
finally
Respuesta.Free;
end;
end;Tamaño, posición y leyenda del QR en la factura, en QR de Verifactu.
4. Pegar el QR en la factura en PDF
Para pegar el QR en un PDF desde Delphi puedes usar SynPDF (de mORMot). Este ejemplo dibuja en el lienzo del PDF el PNG que has guardado en el paso anterior, a unos 35 × 35 mm.
uses
System.Types, Vcl.Imaging.pngimage, SynPdf;
procedure QREnPDF;
var
Doc: TPdfDocumentGDI;
Qr: TPngImage;
begin
Doc := TPdfDocumentGDI.Create;
Qr := TPngImage.Create;
try
Doc.DefaultPaperSize := psA4;
Doc.ScreenLogPixels := 72; // coordenadas del lienzo en puntos
Doc.AddPage;
Qr.LoadFromFile('qr.png');
Qr.RemoveTransparency;
// 72 puntos por pulgada: 35 mm son unos 99 puntos
Doc.VCLCanvas.StretchDraw(Rect(28, 40, 127, 139), Qr);
Doc.SaveToFile('factura.pdf');
finally
Qr.Free;
Doc.Free;
end;
end;Con la API no hace falta generar el QR: viene en la respuesta. Si aun así quieres generarlo tú a partir de la url, puedes usar DelphiZXingQRCode o ZXing.Delphi.
5. Consultar el estado
Consulta el estado del registro con GET /verifactu/status?uuid=…. Hazlo pasado un minuto o, mejor, recibe el resultado por webhook (paso 8). Nunca en un bucle sin espera.
Los estados posibles son Pendiente, Correcto, Aceptado con errores, Incorrecto, Duplicado, Anulado, Factura inexistente, No registrado y Error servidor AEAT. Con Aceptado con errores o Incorrecto, la respuesta trae codigo_error y mensaje_error de la AEAT: qué hacer en cada caso, en errores de Verifactu.
uses
System.SysUtils, System.IOUtils, System.JSON, System.NetEncoding, VerifactiApi;
procedure ConsultarEstado;
var
Guardada: TJSONObject;
R: TVerifactiRespuesta;
Estado: string;
begin
Guardada := TJSONObject.ParseJSONValue(TFile.ReadAllText('respuesta.json')) as TJSONObject;
try
R := VerifactiSend('GET', '/verifactu/status?uuid=' + TNetEncoding.URL.Encode(Guardada.GetValue('uuid').Value));
finally
Guardada.Free;
end;
try
Estado := TJSONObject(R.Json).GetValue('estado').Value;
WriteLn('estado: ', Estado);
if (Estado = 'Incorrecto') or (Estado = 'Aceptado con errores') then
WriteLn('AEAT ', TJSONObject(R.Json).GetValue('codigo_error').Value, ': ',
TJSONObject(R.Json).GetValue('mensaje_error').Value);
finally
R.Json.Free;
end;
end;{
"nif": "B12345674",
"serie": "A",
"numero": "1",
"fecha_expedicion": "19-11-2026",
"operacion": "Alta",
"estado": "Correcto",
"url": "https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR?nif=B12345674&numserie=A1&fecha=19-11-2026&importe=242.00",
"qr": "iVBORw0KGgoAAAANSUhEUgAAASIAAAEi...",
"codigo_error": null,
"mensaje_error": null,
"estado_registro_duplicado": null
}6. Rectificativas y anulaciones
- Rectificativa: es una factura nueva con
tipo_facturade R1 a R5, creada con el mismoPOST /verifactu/create. Ver factura rectificativa. - Anulación:
POST /verifactu/cancel, solo para facturas que no debieron emitirse. Ver anulación. - Subsanación:
PUT /verifactu/modify, para corregir datos de un registro ya enviado. Ver subsanación.
uses
System.SysUtils, System.JSON, VerifactiApi;
procedure AnularFactura;
var
R: TVerifactiRespuesta;
begin
R := VerifactiSend('POST', '/verifactu/cancel',
'{"serie": "A", "numero": "1", "fecha_expedicion": "' + Hoy + '"}');
try
WriteLn(R.Status, ' ', R.Json.ToString);
finally
R.Json.Free;
end;
end;La anulación responde con su propio uuid, estado Pendiente y huella.
7. Reintentos sin duplicar
Envía el header opcional Idempotency-Key en /create, /create_bulk, /modify y /cancel. Genera un UUID por factura y reutilízalo en los reintentos de esa misma factura:
- Mismo cuerpo y misma clave: la API devuelve la primera respuesta, con el header
Idempotent-Replayed: true, sin crear otro registro. 409: la primera petición sigue en curso. Espera unos segundos y repite.422: has usado la clave con un cuerpo distinto. Usa una clave nueva.- Un
400también se guarda: si corriges los datos, usa una clave nueva. Las5xxno se guardan y el reintento se procesa de nuevo. - La clave se recuerda 24 horas y va ligada al NIF emisor. Si han pasado más de 24 horas sin respuesta, comprueba con
POST /verifactu/status(serie,numeroyfecha_expedicion) si la factura llegó a registrarse antes de reenviarla.
uses
System.SysUtils, System.Net.HttpClient, VerifactiApi;
function CrearConReintentos(const Factura, Clave: string): TVerifactiRespuesta;
var
Intento: Integer;
begin
for Intento := 1 to 5 do
begin
try
Result := VerifactiSend('POST', '/verifactu/create', Factura, Clave);
if (Result.Status <> 409) and (Result.Status < 500) then
Exit;
Result.Json.Free;
except
on ENetHTTPClientException do ; // sin respuesta: se reintenta con la misma clave
end;
if Intento < 5 then
Sleep(1000 shl Intento);
end;
raise Exception.Create('Sin respuesta tras 5 intentos: reintenta más tarde con la misma clave');
end;
procedure CrearFacturaSinDuplicar;
var
G: TGUID;
Clave: string;
R: TVerifactiRespuesta;
begin
CreateGUID(G);
Clave := Copy(GUIDToString(G), 2, 36); // sin llaves
R := CrearConReintentos(
'{"serie": "A", "numero": "2", "fecha_expedicion": "' + Hoy + '",' +
' "tipo_factura": "F1", "descripcion": "Servicios de consultoria",' +
' "nif": "A15022510", "nombre": "Empresa Cliente SL",' +
' "lineas": [{"base_imponible": "100.00", "tipo_impositivo": "21", "cuota_repercutida": "21.00"}],' +
' "importe_total": "121.00"}', Clave);
try
WriteLn(R.Status, ' ', R.Json.ToString);
finally
R.Json.Free;
end;
end;8. Webhooks
En lugar de consultar el estado, recibe el resultado por webhook. Los webhooks se crean con la API de gestión de NIFs y se asocian a uno o varios NIFs. Esa API usa la API key de la cuenta (empieza por vfn_, en la variable VERIFACTI_NIFS_API_KEY), que está disponible con una suscripción activa. Con la cuenta gratuita puedes crear un webhook desde el panel.
# Sustituye B12345674 por el NIF de prueba de tu cuenta
curl -X POST https://api.verifacti.com/webhooks \
-H "Authorization: Bearer $VERIFACTI_NIFS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://tu-dominio.com/webhook", "entorno": "test", "secret": "'"$VERIFACTI_WEBHOOK_SECRET"'", "nifs": ["B12345674"]}'Recibir el aviso
Cada aviso es un POST con un array JSON de registros, con los mismos campos que GET /verifactu/status más el uuid (y sin el QR). Si defines un secret, el header X-Webhook-Signature lleva el HMAC-SHA256 del cuerpo en hexadecimal: calcúlalo sobre el cuerpo tal como llega, antes de parsearlo. X-Webhook-Id es el mismo en todos los reintentos de un aviso: úsalo para no procesarlo dos veces. Responde 2xx en menos de 10 segundos. El receptor es el evento OnCommandGet de un TIdHTTPServer (Indy); THashSHA2.GetHMAC necesita Delphi 10 Seattle o superior.
// Delphi 10 Seattle o superior (System.Hash) con Indy (TIdHTTPServer)
uses
System.SysUtils, System.Classes, System.IOUtils, System.Hash, System.JSON, IdGlobal, IdContext, IdCustomHTTPServer;
// Compara en tiempo constante (no se corta en el primer carácter distinto)
function FirmaValida(const A, B: string): Boolean;
var
I, Diff: Integer;
begin
Result := Length(A) = Length(B);
if not Result then Exit;
Diff := 0;
for I := 1 to Length(A) do
Diff := Diff or (Ord(LowerCase(A)[I]) xor Ord(LowerCase(B)[I]));
Result := Diff = 0;
end;
procedure TFormServidor.IdHTTPServer1CommandGet(AContext: TIdContext;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
var
Cuerpo, Esperada, Firma: string;
Lista: TJSONArray;
I: Integer;
begin
Cuerpo := '';
if Assigned(ARequestInfo.PostStream) then
begin
ARequestInfo.PostStream.Position := 0;
Cuerpo := ReadStringFromStream(ARequestInfo.PostStream, -1, IndyTextEncoding_UTF8);
end;
Esperada := THashSHA2.GetHMAC(Cuerpo, GetEnvironmentVariable('VERIFACTI_WEBHOOK_SECRET'));
Firma := ARequestInfo.RawHeaders.Values['X-Webhook-Signature'];
if not FirmaValida(Esperada, Firma) then
begin
AResponseInfo.ResponseNo := 401;
Exit;
end;
Lista := TJSONObject.ParseJSONValue(Cuerpo) as TJSONArray;
try
for I := 0 to Lista.Count - 1 do
TFile.AppendAllText('webhooks.log',
ARequestInfo.RawHeaders.Values['X-Webhook-Id'] + ' ' +
TJSONObject(Lista.Items[I]).GetValue('serie').Value +
TJSONObject(Lista.Items[I]).GetValue('numero').Value + ': ' +
TJSONObject(Lista.Items[I]).GetValue('estado').Value + sLineBreak);
finally
Lista.Free;
end;
AResponseInfo.ResponseNo := 200;
end;Ejemplo completo en un solo archivo
Un programa de consola que crea la factura con Idempotency-Key, guarda el QR en PNG y consulta el estado. Ejecútalo con la variable de entorno VERIFACTI_API_KEY. Usa la fecha y la hora como número de factura para que puedas ejecutarlo varias veces.
// Verifactu en Delphi con la API de Verifacti: crea una factura, guarda el QR y consulta el estado.
// Delphi XE8 o superior. Ejecuta con la variable de entorno VERIFACTI_API_KEY=vf_test_...
program Completo;
{$APPTYPE CONSOLE}
uses
System.SysUtils, System.Classes, System.IOUtils, System.JSON, System.NetEncoding,
System.Net.HttpClient, System.Net.URLClient;
const
BASE_URL = 'https://api.verifacti.com';
function Send(const Method, Path: string; const Body: string; const Clave: string;
out Status: Integer): TJSONObject;
var
Http: THTTPClient;
Headers: TNetHeaders;
Source: TStringStream;
Response: IHTTPResponse;
begin
Http := THTTPClient.Create;
Source := TStringStream.Create(Body, TEncoding.UTF8);
try
Headers := [TNetHeader.Create('Authorization', 'Bearer ' + GetEnvironmentVariable('VERIFACTI_API_KEY'))];
if Body <> '' then
Headers := Headers + [TNetHeader.Create('Content-Type', 'application/json')];
if Clave <> '' then
Headers := Headers + [TNetHeader.Create('Idempotency-Key', Clave)];
if Method = 'GET' then
Response := Http.Get(BASE_URL + Path, nil, Headers)
else
Response := Http.Post(BASE_URL + Path, Source, nil, Headers);
Status := Response.StatusCode;
Result := TJSONObject.ParseJSONValue(Response.ContentAsString(TEncoding.UTF8)) as TJSONObject;
finally
Source.Free;
Http.Free;
end;
end;
var
Numero, Factura, Clave, Uuid, Estado: string;
Alta, Registro: TJSONObject;
Status, Intento, Consulta: Integer;
G: TGUID;
begin
Numero := FormatDateTime('yyyymmddhhnnss', Now);
Factura :=
'{"serie": "A", "numero": "' + Numero + '", "fecha_expedicion": "' + FormatDateTime('dd-mm-yyyy', Now) + '",' +
' "tipo_factura": "F1", "descripcion": "Servicios de consultoria",' +
' "nif": "A15022510", "nombre": "Empresa Cliente SL",' +
' "lineas": [{"base_imponible": "200.00", "tipo_impositivo": "21", "cuota_repercutida": "42.00"}],' +
' "importe_total": "242.00"}';
// 1. Crear la factura. La misma Idempotency-Key en cada reintento: nunca se duplica.
CreateGUID(G);
Clave := Copy(GUIDToString(G), 2, 36);
Alta := nil;
Status := 0;
for Intento := 1 to 5 do
begin
try
FreeAndNil(Alta);
Alta := Send('POST', '/verifactu/create', Factura, Clave, Status);
if (Status <> 409) and (Status < 500) then
Break;
except
on ENetHTTPClientException do ;
end;
if Intento < 5 then
Sleep(1000 shl Intento);
end;
if Status <> 200 then
begin
if Assigned(Alta) then
WriteLn('Error ', Status, ': ', Alta.ToString)
else
WriteLn('Sin respuesta');
Halt(1);
end;
Uuid := Alta.GetValue('uuid').Value;
WriteLn('Factura A', Numero, ' creada. uuid: ', Uuid);
// 2. Guardar el QR para la factura impresa o en PDF.
TFile.WriteAllBytes('qr.png', TNetEncoding.Base64.DecodeStringToBytes(Alta.GetValue('qr').Value));
WriteLn('QR guardado en qr.png');
Alta.Free;
// 3. Consultar el estado. El envío a la AEAT suele tardar uno o dos minutos.
Registro := nil;
for Consulta := 1 to 6 do
begin
Sleep(30000);
FreeAndNil(Registro);
Registro := Send('GET', '/verifactu/status?uuid=' + Uuid, '', '', Status);
if (Status = 200) and (Registro.GetValue('estado').Value <> 'Pendiente') then
Break;
end;
if (Status <> 200) or not Assigned(Registro) then
begin
WriteLn('Sin respuesta del estado: ', Status);
Halt(1);
end;
Estado := Registro.GetValue('estado').Value;
WriteLn('Estado: ', Estado);
if (Estado = 'Incorrecto') or (Estado = 'Aceptado con errores') then
WriteLn('AEAT ', Registro.GetValue('codigo_error').Value, ': ', Registro.GetValue('mensaje_error').Value);
Registro.Free;
end.Errores frecuentes
| Código | Causa | Solución |
|---|---|---|
| 401 | API key ausente o no válida | Revisa el header Authorization y que la clave sea la del NIF. |
| 403 | NIF desactivado | Actívalo en el panel o con la API de gestión de NIFs. |
400 vf-verifactu-fecha_expedicion_hoy | fecha_expedicion no es la fecha actual (entorno de test) | Envía la fecha de hoy en formato DD-MM-AAAA, hora de España. |
400 vf-verifactu-importe_total_cuadre | importe_total no cuadra con la suma de las líneas | Recalcula base, cuota y recargo de todas las líneas. |
400 vf-verifactu-factura_duplicada | Ya existe una factura con la misma serie, numero y fecha_expedicion | Revisa la numeración. |
| 409 | Otra petición con la misma Idempotency-Key sigue en curso | Espera unos segundos y repite con la misma clave. |
| 422 | Idempotency-Key reutilizada con otro cuerpo | Usa una clave nueva para la petición corregida. |
Todos los códigos y los estados, en errores de Verifactu.
¿Librería propia o API?
Para cumplir con Verifactu puedes integrarte directamente con la AEAT: generar el XML (estructura del XML de Verifactu), calcular la huella y el encadenamiento, enviar con certificado y respetar el control de flujo. O usar una API REST como la de Verifacti, que recibe JSON y no necesita certificado.
| Qué tienes que resolver | Generar y enviar tú el XML | Con la API Verifactu |
|---|---|---|
| Formato | Componer el XML según los esquemas XSD de la AEAT | Envías JSON |
| Huella y encadenamiento | Calcular la huella SHA-256 de cada registro y guardar la del anterior por NIF | Lo hace Verifacti; la huella vuelve en la respuesta |
| Certificado | Llamada autenticada con certificado electrónico, propio o del cliente | Sin certificado: Verifacti envía como colaborador social con el modelo de representación de cada NIF |
| Envío | Respetar el control de flujo de la AEAT (por defecto, un envío por minuto salvo que acumules 1.000 registros) y gestionar colas y reintentos | Respuesta inmediata; Verifacti encola y envía |
| QR | Generar la URL de cotejo y el QR | Viene en la respuesta (PNG en Base64) |
| Conservación | Guardar registros y respuestas | Consulta, listado y exportación de los XML por API |
Siguiente paso
Lee la documentación de la API Verifactu, copia los ejemplos de facturas o sigue la guía rápida para pasar a producción. Consulta los precios.
Otros tutoriales de Verifactu
Lo que dicen quienes ya lo han integrado

«La integración con Verifactu fue muy sencilla y el soporte ha sido excelente. Siempre atentos y rápidos para resolver dudas. Muy contento con el servicio.»
«Hemos integrado nuestro software en tiempo récord. La documentación es clara y sencilla, y los ejemplos variados y muy útiles. El equipo de soporte me ha ayudado con todas las dudas.»
“Verifacti’s SaaS platform is intuitive and reliable, and their team’s deep expertise and prompt, crystal-clear answers helped us reach our goals on time. They’re not only highly knowledgeable and professional but also a genuine pleasure to work with.”
“Verifacti made Veri*factu compliance surprisingly straightforward. Their API is clean, well-documented, and their support team responds with real solutions — not generic replies. For any SaaS serving Spanish businesses, Verifacti is the partner you want.”Preguntas sobre Verifactu en Delphi
¿Hay una librería oficial de Verifactu para Delphi?
¿Necesito certificado digital para enviar facturas a Verifactu desde Delphi?
¿Cómo obtengo el QR de la factura?
POST /verifactu/create, en el campo qr: una imagen PNG en Base64. Decodifícala y pégala en la factura; no hace falta generarlo.¿Puedo probar sin efectos fiscales?
vf_test_…).¿Cómo reintento un envío sin duplicar la factura?
Idempotency-Key: genera un UUID por factura y repítelo en cada reintento. Si la primera petición llegó, la API devuelve la misma respuesta y no crea otro registro.Prueba el código con la cuenta gratuita
Te da la API key de test con la que funciona todo el tutorial.