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.

VeriFactuAPI supports two distinct paths for cancelling a previously submitted invoice record. The first is a lightweight cancellation by internal record ID, suitable when you already know the VeriFactuAPI-assigned ID of the record you want to cancel. The second builds a full RegistroAnulacion object from invoice data fields — useful when you want to cancel by invoice series number and date, or when you need to supply additional metadata about why the cancellation is being issued.

Method 1 — Cancel by Record ID

If you have the VeriFactuAPI internal ID of the RegistroAlta you want to cancel, call bajaRegistro() with that integer ID:
$client->bajaRegistro(39);
This sends a POST request to /api/anulacion-registro-facturacion/{id} with no additional body payload. It is the fastest way to cancel a record when the ID is already known, for example after storing it from a previous listarRegistrosAlta() call.

Method 2 — Cancel with a RegistroAnulacion Object

For more control, build a RegistroAnulacion object using nuevoRegistroAnulacion() and then submit it with altaRegistroAnulacion(). This approach lets you identify the target invoice by its series number and issue date, and optionally include cancellation metadata.
1

Populate the cancellation data array

Provide the identifying fields for the invoice you are cancelling, along with any optional metadata fields your use case requires:
$dataRegistroAnulacion = [
    'IDEmisorFactura'        => 'A39200019',
    'numSerieFactura'        => 'AX/202412-075',
    'fechaExpedicionFactura' => '2024-12-16',
    'refExterna'             => 'Test Ref Externa',
];
2

Create the RegistroAnulacion object

Pass the data array to nuevoRegistroAnulacion():
$registroAnulacion = $client->nuevoRegistroAnulacion($dataRegistroAnulacion);
3

Submit the cancellation

Call altaRegistroAnulacion() to POST the cancellation record to /api/anulacion-registro-facturacion:
$client->altaRegistroAnulacion($registroAnulacion);

RegistroAnulacion Fields Reference

The following fields are accepted by nuevoRegistroAnulacion(). All fields are optional at the object-construction level, but IDEmisorFactura, numSerieFactura, and fechaExpedicionFactura are required by the API to identify the invoice being cancelled.
IDEmisorFactura
string
required
NIF of the issuer of the invoice being cancelled.
numSerieFactura
string
required
Series and number of the invoice being cancelled (e.g. AX/202412-075).
fechaExpedicionFactura
string
required
Issue date of the invoice being cancelled, in YYYY-MM-DD format.
refExterna
string
Your own external reference string for this cancellation record.
sinRegistroPrevio
int | string
Indicates there is no prior registration for this invoice (list L4).
rechazoPrevioA
int | string
Identifies a prior rejection that this cancellation addresses (list L4).
generadoPor
int | string
Identifies who generated this cancellation record (list L16).
generadorNombreRazon
string
Legal name of the entity that generated the cancellation.
generadorNIF
string
NIF of the entity that generated the cancellation.
generadorOtroCodPais
string
Country code of the generator, when the generator is a foreign entity.
generadorOtroIDType
int | string
Type of foreign identification used by the generator (list L7).
generadorOtroID
string
Foreign identification number of the generator.
You only need to include the fields relevant to your cancellation scenario. Any field left out of the data array is treated as empty and excluded from the API request body entirely — verifactuPHP never sends empty values to the API.

Build docs developers (and LLMs) love