Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/NemonInvocash/verifactu-php/llms.txt

Use this file to discover all available pages before exploring further.

The RegistroAlta is the core invoice submission record in VeriFactu. It combines a set of object dependencies — such as an emisor, a destinatario, and a desglose — with a set of data fields that describe the invoice itself. Once built, you submit the record to VeriFactuAPI with altaRegistroAlta(), which POSTs it to the /api/alta-registro-facturacion endpoint for processing and, if enviarAeat is enabled on the emisor, onward submission to AEAT.

Build and Submit a RegistroAlta

The nuevoRegistroAlta() method accepts two required arrays and one optional integer:
  • $objetos — an associative array of model objects (emisor, destinatario, desglose, tercero, facturaRectificada, facturaSustituida). Only emisor is required; the rest default to empty objects.
  • $dataRegistroAlta — an associative array of invoice data fields.
  • $webhookID (optional) — an integer webhook ID. If omitted or 0, the emisor’s own webhookID is used automatically.
The examples below show the three most common invoice types. Each builds on the same emisor and desglose for brevity.
A standard invoice (F1) requires an emisor, a destinatario, and a desglose. The IDEmisorFactura and NombreRazonEmisor fields are automatically populated from the $emisor object.
$emisor = $client->nuevoEmisor([
    'nif'        => 'A39200019',
    'nombre'     => 'Mi Empresa S.L.',
    'enviarAeat' => true,
]);

$destinatario = $client->nuevoDestinatario([
    'nombreRazon' => 'Cliente S.A.',
    'nif'         => '39707287H',
]);

$desglose = $client->nuevoDesglose([
    'impuesto'                     => '01',
    'claveRegimen'                 => 1,
    'tipoImpositivo'               => 21,
    'baseImponibleOImporteNoSujeto' => 100,
    'cuotaRepercutida'             => 21,
]);

$registroAlta = $client->nuevoRegistroAlta(
    [
        'emisor'       => $emisor,
        'destinatario' => $destinatario,
        'desglose'     => $desglose,
    ],
    [
        'numSerieFactura'        => 'AX/202412-118',
        'fechaExpedicionFactura' => '2024-12-16',
        'tipoFactura'            => 'F1',
        'cuotaTotal'             => 21.0,
        'importeTotal'           => 121.0,
    ]
);

$client->altaRegistroAlta($registroAlta);

RegistroAlta Data Fields Reference

The second argument to nuevoRegistroAlta() accepts the following fields. All fields are optional at the object-construction level, but VeriFactuAPI may require certain fields depending on the invoice type.
FieldTypeDescription
numSerieFacturastringInvoice series and number (e.g. AX/202412-118)
fechaExpedicionFacturastringInvoice issue date in YYYY-MM-DD format
refExternastringYour own external reference string for this record
tipoFacturaint|stringInvoice type (list L2): F1 = standard, F2 = simplified, R1R5 = rectified
tipoRectificativaint|stringRectification type (list L3); required when tipoFactura is a rectificative type
baseRectificadafloatRectified taxable base amount
cuotaRectificadafloatRectified tax quota amount
cuotaRecargoRectificadofloatRectified surcharge quota amount
fechaOperacionstringDate of the actual operation if different from the issue date (YYYY-MM-DD)
descripcionOperacionstringFree-text description of the operation
facturaSimplificadaArt7273int|stringSimplified invoice under Art. 72/73 flag (list L4)
facturaSinIdentifDestinatarioArt61dint|stringInvoice without buyer identification under Art. 61d (list L5); use 'S' for simplified invoices with no destinatario
macrodatoint|stringLarge-amount transaction flag (list L14)
emitidaPorTercODestinatarioint|stringIssued by third party or buyer flag (list L6)
cuponint|stringCoupon flag (list L4)
subsanacionint|stringAmendment of a previously rejected record (list L4)
rechazoPrevioint|stringPrior rejection reference (list L17)
cuotaTotalfloatTotal tax quota for the invoice
importeTotalfloatTotal invoice amount including tax
List-based fields such as tipoFactura and tipoRectificativa accept both the integer ID and the string code interchangeably — for example, 1 and 'F1' are equivalent for tipoFactura. Use listarListas() or idValorLista() to look up valid values for any list at runtime. See Listing Resources for details.
If you do not pass a $webhookID as the third argument to nuevoRegistroAlta(), the emisor’s own webhookID is used automatically. Pass an explicit integer to override the default on a per-record basis.

Build docs developers (and LLMs) love